[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)

Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 8 11:18:26 PST 2025


================
@@ -164,12 +164,17 @@ void lldb_private::ParseLinuxSMapRegions(llvm::StringRef linux_smap,
     if (!name.contains(' ')) {
       if (region) {
         if (name == "VmFlags") {
-          if (value.contains("mt"))
-            region->SetMemoryTagged(MemoryRegionInfo::eYes);
-          else
-            region->SetMemoryTagged(MemoryRegionInfo::eNo);
+          region->SetMemoryTagged(MemoryRegionInfo::eNo);
+          region->SetIsShadowStack(MemoryRegionInfo::eNo);
+
+          llvm::SmallVector<llvm::StringRef> flags;
+          value.split(flags, ' ', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
+          for (llvm::StringRef flag : flags)
----------------
omjavaid wrote:

instead of tokenizing and checking cant we just use
`if (value.contains("mt"))
region_info.SetMemoryTagged(MemoryRegionInfo::eYes);

if (value.contains("ss"))
region_info.SetIsShadowStack(MemoryRegionInfo::eYes);`

https://github.com/llvm/llvm-project/pull/117861


More information about the lldb-commits mailing list