<div dir="ltr">Hi Zhaoshi,<div><br></div><div>Currently there's no global tagging instrumentation for MTE. We have a good idea about the implementation's design - but no patches are ready to be shared at this stage.</div><div><br></div><div>If you'd like - I'd be more than happy to CC yourself and Stephen on any Phabricator reviews :).</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 14, 2020 at 5:04 PM Zhaoshi Zheng via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-522822085677361682WordSection1">
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We’re evaluating memory tagging (MTE) on some internal workloads.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We noticed that stack variables are tagged by an instrumentation pass and heap objects are handled by the allocator (Scudo).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">How about global variables? We tried a simple case using -march=armv8a+memtag -fsanitize=memtag, but found no tagging:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Are we missing anything or tagging globals is still in progress?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><i>int global_array[16];<u></u><u></u></i></p>
<p class="MsoNormal"><i><u></u> <u></u></i></p>
<p class="MsoNormal"><i>int main(int argc, char **argv) {<u></u><u></u></i></p>
<p class="MsoNormal"><i> global_array[1] = 0;<u></u><u></u></i></p>
<p class="MsoNormal"><i> return global_array[argc + 16]; // BOOM<u></u><u></u></i></p>
<p class="MsoNormal"><i>}<u></u><u></u></i></p>
<p class="MsoNormal"><i><u></u> <u></u></i></p>
<p class="MsoNormal">clang++ -O1 --target=aarch64-linux -march=armv8.5a+memtag -fsanitize=memtag test.cpp -S -o test.s<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><i>main: // @main<u></u><u></u></i></p>
<p class="MsoNormal"><i>.Lmain$local:<u></u><u></u></i></p>
<p class="MsoNormal"><i>// %bb.0: // %entry<u></u><u></u></i></p>
<p class="MsoNormal"><i> adrp x8, global_array<u></u><u></u></i></p>
<p class="MsoNormal"><i> add x8, x8, :lo12:global_array<u></u><u></u></i></p>
<p class="MsoNormal"><i> str wzr, [x8, #4]<u></u><u></u></i></p>
<p class="MsoNormal"><i> add x8, x8, w0, sxtw #2<u></u><u></u></i></p>
<p class="MsoNormal"><i> ldr w0, [x8, #64]<u></u><u></u></i></p>
<p class="MsoNormal"><i> ret<u></u><u></u></i></p>
<p class="MsoNormal"><i>.Lfunc_end0:<u></u><u></u></i></p>
<p class="MsoNormal"><i> .size main, .Lfunc_end0-main<u></u><u></u></i></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>