[Lldb-commits] [lldb] [lldb][Darwin] Add `process launch --memory-tagging` option (PR #162944)

Julian Lettner via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 14 12:59:06 PDT 2025


================
@@ -1210,6 +1210,39 @@ static Status LaunchProcessPosixSpawn(const char *exe_path,
     }
   }
 
+  if (launch_info.GetFlags().Test(eLaunchFlagMemoryTagging)) {
+    // The following function configures the spawn attributes to launch the
+    // process with memory tagging explicitly enabled.  We look it up
+    // dynamically since it is only available on newer OS.  Does nothing on
+    // hardware which does not support MTE.
+    //
+    //   int posix_spawnattr_set_use_sec_transition_shims_np(
+    //       posix_spawnattr_t *attr, uint32_t flags);
+    //
----------------
yln wrote:

The call of this API (through the function pointer) is the line that does the work.
```
posix_spawnattr_set_use_sec_transition_shims_np_fn(&attr, 0)
```
It means "launch with memory tagging enabled".

* The naming of this function is unfortunate
* We call through function pointer that is looked up via `dlsym()` because the function is not available on older OS
* The `flags=0` value allows for future, more specific semantics.
* Everything else is just error handling

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


More information about the lldb-commits mailing list