<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>I thought I recognized this issue, and started searching the mail
archive. Seems the same question was asked last year by ... you.
:-)</p>
<p><a class="moz-txt-link-freetext" href="https://mail.openjdk.org/pipermail/build-dev/2024-August/046011.html">https://mail.openjdk.org/pipermail/build-dev/2024-August/046011.html</a></p>
<p>I guess nobody still has a simple answer to give you. I don't
understand how the msan internal functions are supposed to work,
if there is no library to link to. Are they added by the compiler?<br>
</p>
<p>Maybe you can try patching out -fvisibility=hidden from the
compile command line to see if that makes any difference. <br>
</p>
<p>/Magnus<br>
</p>
<div class="moz-cite-prefix">On 2025-04-25 16:28, Baesken, Matthias
wrote:<br>
</div>
<blockquote type="cite" cite="mid:AM9PR02MB6770D986FF830FD276620ABF93842@AM9PR02MB6770.eurprd02.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Aptos;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi, Memory sanitizer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="https://clang.llvm.org/docs/MemorySanitizer.html" moz-do-not-send="true" class="moz-txt-link-freetext">https://clang.llvm.org/docs/MemorySanitizer.html</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">is supported with the
clang toolchain (e.g. on Linux) ; “</span><span lang="en-DE">MemorySanitizer is a detector of uninitialized
memory use</span><span lang="EN-US">” .<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">For small examples it is
rather easy to use, you just compile and link with
</span>-fsanitize=memory (and for better results maybe
additionally -fno-omit-frame-pointer ) .<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So I gave it a try with OpenJDK too and
added -fsanitize=memory to the C/CXX and LD flags
(--with-extra-cflags=-fsanitize=memory
--with-extra-cxxflags=-fsanitize=memory
--with-extra-ldflags=-fsanitize=memory ).<o:p></o:p></p>
<p class="MsoNormal">As far as compiling single compilation
units this seems to be okay .<o:p></o:p></p>
<p class="MsoNormal">But when it comes to executing the new
generated binaries in the build process we unfortunately
get lookup errors / undefined symbols :<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/builddir/jdk/bin/javac: symbol lookup
error: /builddir/jdk/bin/../lib/libjli.so: undefined symbol:
__msan_param_tls<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there something special in our OpenJDK
build that causes trouble here ?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here I found an somewhat similar looking
issue :<o:p></o:p></p>
<p class="MsoNormal"><a href="https://groups.google.com/g/memory-sanitizer/c/xV3OZZCiL9A" moz-do-not-send="true" class="moz-txt-link-freetext">https://groups.google.com/g/memory-sanitizer/c/xV3OZZCiL9A</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">where re-exporting symbols is mentioned -
is this maybe something that hits us in OpenJDK too ?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For address sanitizer, we set
-shared-libasan in the OpenJDK :
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><a href="https://github.com/openjdk/jdk/blob/5c067232bf21aaca2b7addd2a862e15a8696ffb8/make/autoconf/jdk-options.m4#L449" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jdk/blob/5c067232bf21aaca2b7addd2a862e15a8696ffb8/make/autoconf/jdk-options.m4#L449</a><o:p></o:p></p>
<p class="MsoNormal">ASAN_LDFLAGS="$ASAN_LDFLAGS
-shared-libasan"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">But I could not find something similar for
msan .<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(btw. I use clang 15.0.7 on SUSE Linux
x86_64 in case this matters)
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards, Matthias<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
</body>
</html>