Fail to make images when enable ASan for OpenJDK X86 with LLVM toolchain

Leslie Zhai zhaixiang at loongson.cn
Tue Mar 19 15:33:40 UTC 2019


Hi,

I want to run dynamic analysis test with the help of Address Sanitizer.  
And I read the blog 'Running Java with AddressSanitizer'[1]  wrote by 
Artem who also added support for ASan[2].  Thanks for his great job!

But I failed to make images for X86:

Compiling 4 files for BUILD_JIGSAW_TOOLS
ERROR: Invalid value for bool option: '0"'
ERROR: Flag parsing failed.
ExplodedImageOptimize.gmk:39: recipe for target 
'/home/xiangzhai/project/jdk/build/linux-x86_64-server-fastdebug/jdk/_optimize_image_exec.marker' 
failed
gmake[3]: *** 
[/home/xiangzhai/project/jdk/build/linux-x86_64-server-fastdebug/jdk/_optimize_image_exec.marker] 
Error 1
make/Main.gmk:372: recipe for target 'exploded-image-optimize' failed
gmake[2]: *** [exploded-image-optimize] Error 1

ERROR: Build failed for target 'images' in configuration 
'linux-x86_64-server-fastdebug' (exit code 2)
Stopping sjavac server

=== Output from failing command(s) repeated here ===
* For target jdk__optimize_image_exec:
ERROR: Invalid value for bool option: '0"'
ERROR: Flag parsing failed.

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

jdk__optimize_image_exec.cmdline[3], jdk__optimize_image_exec.log[4],  
and dynamic analysis report[5] by running the cmdline.

using configure arguments '--with-toolchain-type=clang 
--disable-warnings-as-errors --enable-asan 
--with-boot-jdk=/home/xiangzhai/jdk-11.0.2 --with-debug-level=fastdebug'

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

And I also make images with extra CFLAGS, CXXFLAGS and LDFLAGS to enable 
TSan for mips64el with LLVM toolchain especially integrated assembler:

sh configure --with-toolchain-type=clang \
   --disable-warnings-as-errors \
--with-boot-jdk=/home/loongson/zhaixiang/jdk-mips-f21-build-server-release-072 
\
   --with-debug-level=fastdebug \
   --with-extra-cflags="-fintegrated-as -fsanitize=thread" \
   --with-extra-cxxflags="-fintegrated-as -fsanitize=thread" \
   --with-extra-ldflags="-fsanitize=thread"

Although successfully built libjvm.so,  it means make hotspot works,  
failed to bootstrap near the end of make images.

So workaround might be make images at first without ASan nor TSan, then 
make hotspot with ASan or TSan?

Thanks,

Leslie Zhai

[1] 
https://blog.gypsyengineer.com/en/security/running-java-with-addresssanitizer.html

[2] https://bugs.openjdk.java.net/browse/JDK-8189800

[3] 
https://raw.githubusercontent.com/xiangzhai/jdk-dev/master/jdk__optimize_image_exec.cmdline

[4] 
https://raw.githubusercontent.com/xiangzhai/jdk-dev/master/jdk__optimize_image_exec.log

[5] 
https://raw.githubusercontent.com/xiangzhai/jdk-dev/master/make-enable-asan.log




More information about the build-dev mailing list