<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Mitch,<br>
<br>
Thank you for quick response.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Since MSan is usable as dso it would be very nice if you could patch /compiler-rt-$(VERSION).src/lib/msan/CMakeLists.txt in order to generate msan.so when compiling llvm from source (similar as for ASan or UBSan).<br>
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Also, I believe there is a mistake in <a href="https://clang.llvm.org/docs/MemorySanitizer.html#limitations" title="https://clang.llvm.org/docs/MemorySanitizer.html#limitations">
MSan documentation</a> where it's said that static linking with MSan is not supported.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have situation where I want to use MSan with mixed code (Python->swig.cxx->native.so, as mentioned it is possible for ASan
<a href="https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso#asan-and-ld_preload" title="https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso#asan-and-ld_preload">
here</a>), I'm using clang 7.0.1 and I keep getting DEADLYSIGNAL from MSan when trying to use it in that way.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Error message:<br>
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">MemorySanitizer:DEADLYSIGNAL</span><br>
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">==17609==ERROR: MemorySanitizer: stack-overflow on address 0x7fffdd85afe8 (pc 0x7fbe5c948e34
bp 0x7fffdd85b050 sp 0x7fffdd85afe0 T17609)</span><br style="user-select:all;background-color:rgb(255, 255, 255);font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">MemorySanitizer:DEADLYSIGNAL</span><br style="user-select:all;background-color:rgb(255, 255, 255);font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">MemorySanitizer: nested bug in the same thread, aborting.</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">When I'm using ASan in the same way it works as expected.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important">Kind regards,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:-apple-system, "Segoe UI", "Segoe UI Emoji", sans-serif, Meiryo;font-size:14px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:12pt;font-family:Calibri, Arial, Helvetica, sans-serif;color:black;background-color:rgb(255, 255, 255)">Marko
Stanojloviĉ</span>
<div style="margin:0px;font-size:12pt;font-family:Calibri, Arial, Helvetica, sans-serif;color:black;background-color:rgb(255, 255, 255)">
<br>
<span style="margin:0px;font-weight:300;font-family:Roboto, sans-serif;color:rgb(68, 68, 68);text-align:center;background-color:white;letter-spacing:1px">SYRMIA LLC @ Belgrade Office Park</span><br>
<span style="margin:0px;font-weight:300;font-family:Roboto, sans-serif;color:rgb(68, 68, 68);text-align:center;background-color:white;letter-spacing:1px">Djordja Stanojevica 12,</span><br>
<span style="margin:0px;font-weight:300;font-family:Roboto, sans-serif;color:rgb(68, 68, 68);text-align:center;background-color:white;letter-spacing:1px">Beograd 11070</span></div>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mitch Phillips <mitchp@google.com><br>
<b>Sent:</b> Wednesday, April 7, 2021 9:09 PM<br>
<b>To:</b> Marko Stanojlovic <Marko.Stanojlovic@syrmia.com><br>
<b>Cc:</b> llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [llvm-dev] Using MSan as dso</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Marko,
<div><br>
</div>
<div>Uninstrumented code under ASan leads to false negatives. Under MSan, uninstrumented code leads to false positives. MSan is thus not suitable to be used as a preloaded DSO.</div>
<div><br>
</div>
<div>If you're really, really, extremely dedicated and willing to <a href="https://clang.llvm.org/docs/MemorySanitizer.html#blacklist">
annotate</a> <i>every</i> instance where memory that's initialized in uninstrumented code flows to instrumented code, then you might be able to find some bugs. But it's worth bearing in mind that usage of MSan in this way is warranty-voiding.</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, Apr 7, 2021 at 12:01 PM Marko Stanojlovic via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello llvm developers,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Is there a way to use Memory Sanitizer when there is a third-party executable which cannot be recompiled,<br>
but it loads shared libraries that can be recompiled and we want to test them with MSan? In other words could be MSan used as dso?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Similar to ASan usage described on its wiki page - <a href="https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso" id="x_gmail-m_-2048485037648791402LPlnk" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso</a>. </div>
<div></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Kind regards and thanks<span style="background-color:rgb(255,255,255); display:inline"><span> </span>in advance</span> for response,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Marko Stanojloviĉ</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
<span style="color:rgb(68,68,68); font-family:Roboto,sans-serif; font-weight:300; letter-spacing:1px; text-align:center; background-color:rgb(255,255,255); display:inline">SYRMIA LLC @ Belgrade Office Park</span><br>
<span style="color:rgb(68,68,68); font-family:Roboto,sans-serif; font-weight:300; letter-spacing:1px; text-align:center; background-color:rgb(255,255,255); display:inline">Djordja Stanojevica 12,</span><br style="box-sizing:border-box; color:rgb(68,68,68); font-family:Roboto,sans-serif; font-weight:300; letter-spacing:1px; text-align:center; background-color:rgb(255,255,255)">
<span style="color:rgb(68,68,68); font-family:Roboto,sans-serif; font-weight:300; letter-spacing:1px; text-align:center; background-color:rgb(255,255,255); display:inline">Beograd 11070</span><br>
</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>
</div>
</body>
</html>