[GH-ISSUE #1239] --encoding=[any but ASCII] --list=[format-tests, format-all-details, format-details] with ASan #778

Closed
opened 2026-10-14 03:23:37 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @loverszhaokai on GitHub (Apr 28, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1239

Originally assigned to: @loverszhaokai on GitHub.

The GDB info likes #1231, maybe they are the same problem.
#1. Prepare

$ export ASAN_OPTIONS='abort_on_error=1'
$ CC=clang AFL_USE_ASAN=1 AFL_HARDEN=1 ./configure --enable-asan --enable-memdbg && make -sj8
#2. Reproduce

$ ./john --encoding=[any but ASCII] --list=[format-tests, format-all-details, format-details]
...
...
Segmentation fault
#3. Gdb

$ gdb ./john
$ set args --encoding=UTF-8 --list=format-details
$ r
...
...
Program received signal SIGSEGV, Segmentation fault.
__interceptor_free (ptr=0x6060000e9720) at /home/kai/workspace/llvm-3.6.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:29
29 INTERCEPTOR(void, free, void *ptr) {
(gdb) bt
#0 __interceptor_free (ptr=0x6060000e9720) at /home/kai/workspace/llvm-3.6.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:29
#1 0x00007fffea824637 in ?? () from /usr/lib64/libnvidia-opencl.so.1
#2 0x00007fffea846070 in ?? () from /usr/lib64/libnvidia-opencl.so.1
#3 0x00007fffea8194e2 in ?? () from /usr/lib64/libnvidia-opencl.so.1
#4 0x00007fffea8c4388 in ?? () from /usr/lib64/libnvidia-opencl.so.1
#5 0x00007fffea8c4026 in ?? () from /usr/lib64/libnvidia-opencl.so.1
#6 0x00007ffff70e6172 in khrIcdVendorAdd () from /usr/lib64/libOpenCL.so.1
#7 0x00007ffff70e8106 in khrIcdOsVendorsEnumerate () from /usr/lib64/libOpenCL.so.1
#8 0x00007ffff70e77e0 in clGetPlatformIDs () from /usr/lib64/libOpenCL.so.1
#9 0x00000000009673ce in start_opencl_environment ()
#10 0x000000000095a14b in opencl_preinit ()
#11 0x00000000009620c1 in opencl_prepare_dev ()
#12 0x0000000000962ceb in opencl_init ()
#13 0x00000000007aacf8 in init ()
#14 0x00000000008bb058 in fmt_init ()
#15 0x0000000000926386 in listconf_parse_late ()
#16 0x00000000008c7fed in john_init ()
#17 0x00000000008c6a58 in main ()

Originally created by @loverszhaokai on GitHub (Apr 28, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1239 Originally assigned to: @loverszhaokai on GitHub. The GDB info likes #1231, maybe they are the same problem. #1. Prepare $ export ASAN_OPTIONS='abort_on_error=1' $ CC=clang AFL_USE_ASAN=1 AFL_HARDEN=1 ./configure --enable-asan --enable-memdbg && make -sj8 #2. Reproduce $ ./john --encoding=[any but ASCII] --list=[format-tests, format-all-details, format-details] ... ... Segmentation fault #3. Gdb $ gdb ./john $ set args --encoding=UTF-8 --list=format-details $ r ... ... Program received signal SIGSEGV, Segmentation fault. __interceptor_free (ptr=0x6060000e9720) at /home/kai/workspace/llvm-3.6.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:29 29 INTERCEPTOR(void, free, void *ptr) { (gdb) bt #0 __interceptor_free (ptr=0x6060000e9720) at /home/kai/workspace/llvm-3.6.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:29 #1 0x00007fffea824637 in ?? () from /usr/lib64/libnvidia-opencl.so.1 #2 0x00007fffea846070 in ?? () from /usr/lib64/libnvidia-opencl.so.1 #3 0x00007fffea8194e2 in ?? () from /usr/lib64/libnvidia-opencl.so.1 #4 0x00007fffea8c4388 in ?? () from /usr/lib64/libnvidia-opencl.so.1 #5 0x00007fffea8c4026 in ?? () from /usr/lib64/libnvidia-opencl.so.1 #6 0x00007ffff70e6172 in khrIcdVendorAdd () from /usr/lib64/libOpenCL.so.1 #7 0x00007ffff70e8106 in khrIcdOsVendorsEnumerate () from /usr/lib64/libOpenCL.so.1 #8 0x00007ffff70e77e0 in clGetPlatformIDs () from /usr/lib64/libOpenCL.so.1 #9 0x00000000009673ce in start_opencl_environment () #10 0x000000000095a14b in opencl_preinit () #11 0x00000000009620c1 in opencl_prepare_dev () #12 0x0000000000962ceb in opencl_init () #13 0x00000000007aacf8 in init () #14 0x00000000008bb058 in fmt_init () #15 0x0000000000926386 in listconf_parse_late () #16 0x00000000008c7fed in john_init () #17 0x00000000008c6a58 in main ()
bsakaguchi 2026-10-14 03:23:37 +07:00
Author
Owner

@frank-dittrich commented on GitHub (Apr 28, 2015):

Given all the trouble ASan seems to have with OpenCL and CUDA, may be it is indeed better to first fuzz a --disable-opencl --disable-cuda build.

A second step could then be to test a build with OpenCL and CUDA and with memdbg, but without ASan, and check the memdbg output for errors.
Since only GPU related problems should remain for this second step, you might limit fuzzing to GPU specific options (--device, --list=cuda-devices, --list=opencl-devices) or options that behave differently when OpenCL or CUDA are supported (--list=build-info, which shows OpenCL specific or CUDA specific information)
For everything related to formats (--test, --list?formats, --list=format-*`), you might alway add --format=gpu, to avoid repeating tests of CPU formats.

<!-- gh-comment-id:97083010 --> @frank-dittrich commented on GitHub (Apr 28, 2015): Given all the trouble ASan seems to have with OpenCL and CUDA, may be it is indeed better to first fuzz a `--disable-opencl --disable-cuda` build. A second step could then be to test a build with OpenCL and CUDA and with memdbg, but without ASan, and check the memdbg output for errors. Since only GPU related problems should remain for this second step, you might limit fuzzing to GPU specific options (`--device`, `--list=cuda-devices`, `--list=opencl-devices`) or options that behave differently when OpenCL or CUDA are supported (`--list=build-info`, which shows OpenCL specific or CUDA specific information) For everything related to formats (`--test`, `--list?formats`, --list=format-*`), you might alway add --format=gpu, to avoid repeating tests of CPU formats.
Author
Owner

@loverszhaokai commented on GitHub (Apr 28, 2015):

@frank-dittrich

Thanks for your advice.

<!-- gh-comment-id:97084138 --> @loverszhaokai commented on GitHub (Apr 28, 2015): @frank-dittrich Thanks for your advice.
Author
Owner

@frank-dittrich commented on GitHub (Apr 28, 2015):

Probably asan cannot rewrite malloc() etc. for libraries which get loaded prior to libasan.

gcc 4.9 and newer do have

      -static-libasan
           When the -fsanitize=address option is used to link a program, the
           GCC driver automatically links against libasan.  If libasan is
           available as a shared library, and the -static option is not used,
           then this links against the shared version of libasan.  The
           -static-libasan option directs the GCC driver to link libasan
           statically, without necessarily linking other libraries statically.

       -static-libtsan
           When the -fsanitize=thread option is used to link a program, the
           GCC driver automatically links against libtsan.  If libtsan is
           available as a shared library, and the -static option is not used,
           then this links against the shared version of libtsan.  The
           -static-libtsan option directs the GCC driver to link libtsan
           statically, without necessarily linking other libraries statically.

This can be be a workaround.

Another could be using LD_PRELOAD, see https://code.google.com/p/address-sanitizer/wiki/AsanAsDso

But I really suggest you fuzz non-gpu builds first (should also be much faster).

<!-- gh-comment-id:97092992 --> @frank-dittrich commented on GitHub (Apr 28, 2015): Probably asan cannot rewrite malloc() etc. for libraries which get loaded prior to libasan. gcc 4.9 and newer do have ``` -static-libasan When the -fsanitize=address option is used to link a program, the GCC driver automatically links against libasan. If libasan is available as a shared library, and the -static option is not used, then this links against the shared version of libasan. The -static-libasan option directs the GCC driver to link libasan statically, without necessarily linking other libraries statically. -static-libtsan When the -fsanitize=thread option is used to link a program, the GCC driver automatically links against libtsan. If libtsan is available as a shared library, and the -static option is not used, then this links against the shared version of libtsan. The -static-libtsan option directs the GCC driver to link libtsan statically, without necessarily linking other libraries statically. ``` This can be be a workaround. Another could be using LD_PRELOAD, see https://code.google.com/p/address-sanitizer/wiki/AsanAsDso But I really suggest you fuzz non-gpu builds first (should also be much faster).
Author
Owner

@magnumripper commented on GitHub (Apr 28, 2015):

Given all the trouble ASan seems to have with OpenCL and CUDA, may be it is indeed better to first fuzz a --disable-opencl --disable-cuda build.

Absolutely. Please do not add any more issues with Asan in combination of OpenCL or CUDA unless you can verify there is still a problem when ASan is not involved. I regard this an invalid issue.

<!-- gh-comment-id:97171217 --> @magnumripper commented on GitHub (Apr 28, 2015): > Given all the trouble ASan seems to have with OpenCL and CUDA, may be it is indeed better to first fuzz a --disable-opencl --disable-cuda build. Absolutely. Please do not add any more issues with Asan in combination of OpenCL or CUDA unless you can verify there is still a problem when ASan is not involved. I regard this an invalid issue.
Author
Owner

@loverszhaokai commented on GitHub (Apr 29, 2015):

Absolutely. Please do not add any more issues with Asan in combination of OpenCL or CUDA unless you can verify there is still a problem when ASan is not involved. I regard this an invalid issue.

OK. Get it.

<!-- gh-comment-id:97270198 --> @loverszhaokai commented on GitHub (Apr 29, 2015): > Absolutely. Please do not add any more issues with Asan in combination of OpenCL or CUDA unless you can verify there is still a problem when ASan is not involved. I regard this an invalid issue. OK. Get it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#778
No description provided.