[clang] [llvm] [MTE] Add an attribute to opt-in memory tagging of global variables while using fsanitize=memtag-globals (#166380) (PR #168535)
TarcĂsio Fischer via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 01:58:16 PST 2025
================
@@ -3659,9 +3659,11 @@ def ForceMemtagDocs : Documentation {
let Category = DocCatVariable;
let Content = [{
Use the ``force_memtag`` attribute on a global variable declaration that also
-has the attribute section and the memory tag sanitizer is active to force the
-global variable to be MTE tagged. Global variables under sections are not
+has the attribute section. If the memory tag sanitizer is active, will force
+the global variable to be MTE tagged. Global variables under sections are not
tagged by default, so you need to explicitly opt-in using this attribute.
+Please note that, unfortunately, in some non-trivial cases where memory layout
+is assumed, forcing enabling the memtag will cause SIGSEGV/MTE[AS]ERR.
----------------
tarcisiofischer wrote:
I've updated this, but please let me know if it is still not good enough, in which case I think maybe a quick discussion might be worth. Thank you for the highlight!
https://github.com/llvm/llvm-project/pull/168535
More information about the llvm-commits
mailing list