[Lldb-commits] [lldb] f31e390 - [lldb][AArch64] Don't check for VmFlags in smaps files

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 29 01:30:20 PDT 2021


Author: David Spickett
Date: 2021-04-29T09:30:14+01:00
New Revision: f31e390453d255bc6a486bbd5cb990e684b29510

URL: https://github.com/llvm/llvm-project/commit/f31e390453d255bc6a486bbd5cb990e684b29510
DIFF: https://github.com/llvm/llvm-project/commit/f31e390453d255bc6a486bbd5cb990e684b29510.diff

LOG: [lldb][AArch64] Don't check for VmFlags in smaps files

AArch64 kernel builds default to having /smaps and
the "VmFlags" line was added in 3.8. Long before MTE
was supported.

So we can assume that if you're AArch64 with MTE,
you can run this test.

The previous method of checking had a race condition
where the process we read smaps for, could finish before
we get to read the file.

I explored some alternatives but in the end I think
it's fine to just assume we have what we need.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D100493

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbtest.py
    lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index d94f8e9c28b9c..77b1eb3a1567a 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1300,30 +1300,6 @@ def isAArch64MTE(self):
     def isAArch64PAuth(self):
         return "paca" in self.getCPUInfo()
 
-    def hasLinuxVmFlags(self):
-        """ Check that the target machine has "VmFlags" lines in
-        its /proc/{pid}/smaps files."""
-
-        triple = self.dbg.GetSelectedPlatform().GetTriple()
-        if not re.match(".*-.*-linux", triple):
-            return False
-
-        self.runCmd('platform process list')
-        pid = None
-        for line in self.res.GetOutput().splitlines():
-            if 'lldb-server' in line:
-                pid = line.split(' ')[0]
-                break
-
-        if pid is None:
-            return False
-
-        smaps_path = self.getBuildArtifact('smaps')
-        self.runCmd('platform get-file "/proc/{}/smaps" {}'.format(pid, smaps_path))
-
-        with open(smaps_path, 'r') as f:
-            return "VmFlags" in f.read()
-
     def getArchitecture(self):
         """Returns the architecture in effect the test suite is running with."""
         module = builder_module()

diff  --git a/lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py b/lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
index 29035c3b8608f..e271a8bf69200 100644
--- a/lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
+++ b/lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
@@ -23,8 +23,12 @@ class AArch64LinuxMTEMemoryRegionTestCase(TestBase):
     def test_mte_regions(self):
         if not self.isAArch64MTE():
             self.skipTest('Target must support MTE.')
-        if not self.hasLinuxVmFlags():
-            self.skipTest('/proc/{pid}/smaps VmFlags must be present')
+
+        # This test assumes that we have /proc/<PID>/smaps files
+        # that include "VmFlags:" lines.
+        # AArch64 kernel config defaults to enabling smaps with
+        # PROC_PAGE_MONITOR and "VmFlags" was added in kernel 3.8,
+        # before MTE was supported at all.
 
         self.build()
         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)


        


More information about the lldb-commits mailing list