[GH-ISSUE #1125] ASan error "attempting free on address which was not malloc()-ed" in debug build. #701

Closed
opened 2026-10-14 03:20:39 +07:00 by bsakaguchi · 18 comments
Owner

Originally created by @frank-dittrich on GitHub (Mar 19, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1125

This is on 64bit Linux, latest commit at time of test: commit b1aab2545c

(bleeding-jumbo)src $ make -s distclean 
(bleeding-jumbo)src $ ./configure --enable-asan  
[...]
Development options (these may hurt performance when enabled):
Memdbg memory debugging settings ............ disabled
AddressSanitizer ("ASan") ................... enabled

Install missing libraries to get any needed features that were omitted.

Configure finished.  Now 'make clean && make -s' to compile.
(bleeding-jumbo)src $ make -s -j 16 debug 
/usr/bin/ar: creating aes.a

Make process completed.
(bleeding-jumbo)src $ cd ../run/
(bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
=================================================================
==26170== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fb9e17a3010
    #0 0x7fb9ef7fa0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415)
    #2 0x69aaab (/home/fd/git/JtR/run/john+0x69aaab)
    #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd)
    #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39)
    #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7)
    #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
==26170== ABORTING
(bleeding-jumbo)run $ ./asan_symbolize.py 
    #0 0x7fb9ef7fa0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415)
    #2 0x69aaab (/home/fd/git/JtR/run/john+0x69aaab)
    #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd)
    #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39)
    #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7)
    #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1
    #0 0x7fb9ef7fa0f9 in __interceptor_free ??:?
    #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099
    #2 0x69aaab in done /home/fd/git/JtR/src/rawSHA1_ng_fmt_plug.c:274 (discriminator 1)
    #3 0x7449cd in fmt_done /home/fd/git/JtR/src/formats.c:112
    #4 0x72db39 in benchmark_all /home/fd/git/JtR/src/bench.c:754
    #5 0x7509c7 in john_run /home/fd/git/JtR/src/john.c:1309
    #6 0x751f4f in main /home/fd/git/JtR/src/john.c:1687
    #7 0x342fa21d64 in ?? ??:0

And with --enable-memdbg in addition to --enable-asan:

(bleeding-jumbo)src $ make -s distclean 
(bleeding-jumbo)src $ ./configure --enable-asan --enable-memdbg 
[...]
Development options (these may hurt performance when enabled):
Memdbg memory debugging settings ............ -DMEMDBG_ON
AddressSanitizer ("ASan") ................... enabled

Install missing libraries to get any needed features that were omitted.

Configure finished.  Now 'make clean && make -s' to compile.
(bleeding-jumbo)src $ make -s -j 16 debug 
/usr/bin/ar: creating aes.a

Make process completed.
(bleeding-jumbo)src $ cd ../run/
(bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
=================================================================
==20685== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fedb26e5010
    #0 0x7fedc073c0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7bf54b (/home/fd/git/JtR/run/john+0x7bf54b)
    #2 0x69e615 (/home/fd/git/JtR/run/john+0x69e615)
    #3 0x7492d1 (/home/fd/git/JtR/run/john+0x7492d1)
    #4 0x7321e5 (/home/fd/git/JtR/run/john+0x7321e5)
    #5 0x7553a1 (/home/fd/git/JtR/run/john+0x7553a1)
    #6 0x75693d (/home/fd/git/JtR/run/john+0x75693d)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
==20685== ABORTING
(bleeding-jumbo)run $ ./asan_symbolize.py 
    #0 0x7fedc073c0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7bf54b (/home/fd/git/JtR/run/john+0x7bf54b)
    #2 0x69e615 (/home/fd/git/JtR/run/john+0x69e615)
    #3 0x7492d1 (/home/fd/git/JtR/run/john+0x7492d1)
    #4 0x7321e5 (/home/fd/git/JtR/run/john+0x7321e5)
    #5 0x7553a1 (/home/fd/git/JtR/run/john+0x7553a1)
    #6 0x75693d (/home/fd/git/JtR/run/john+0x75693d)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1
    #0 0x7fedc073c0f9 in __interceptor_free ??:?
    #1 0x7bf54b in MEMDBG_free /home/fd/git/JtR/src/memdbg.c:960
    #2 0x69e615 in done /home/fd/git/JtR/src/rawSHA1_ng_fmt_plug.c:274 (discriminator 1)
    #3 0x7492d1 in fmt_done /home/fd/git/JtR/src/formats.c:112
    #4 0x7321e5 in benchmark_all /home/fd/git/JtR/src/bench.c:754
    #5 0x7553a1 in john_run /home/fd/git/JtR/src/john.c:1309
    #6 0x75693d in main /home/fd/git/JtR/src/john.c:1687
    #7 0x342fa21d64 in ?? ??:0
Originally created by @frank-dittrich on GitHub (Mar 19, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1125 This is on 64bit Linux, latest commit at time of test: commit b1aab2545c47f774d1af16e9f31a77029613231e ``` (bleeding-jumbo)src $ make -s distclean (bleeding-jumbo)src $ ./configure --enable-asan [...] Development options (these may hurt performance when enabled): Memdbg memory debugging settings ............ disabled AddressSanitizer ("ASan") ................... enabled Install missing libraries to get any needed features that were omitted. Configure finished. Now 'make clean && make -s' to compile. (bleeding-jumbo)src $ make -s -j 16 debug /usr/bin/ar: creating aes.a Make process completed. (bleeding-jumbo)src $ cd ../run/ (bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS ================================================================= ==26170== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fb9e17a3010 #0 0x7fb9ef7fa0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415) #2 0x69aaab (/home/fd/git/JtR/run/john+0x69aaab) #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd) #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39) #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7) #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) ==26170== ABORTING (bleeding-jumbo)run $ ./asan_symbolize.py #0 0x7fb9ef7fa0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415) #2 0x69aaab (/home/fd/git/JtR/run/john+0x69aaab) #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd) #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39) #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7) #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1 #0 0x7fb9ef7fa0f9 in __interceptor_free ??:? #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099 #2 0x69aaab in done /home/fd/git/JtR/src/rawSHA1_ng_fmt_plug.c:274 (discriminator 1) #3 0x7449cd in fmt_done /home/fd/git/JtR/src/formats.c:112 #4 0x72db39 in benchmark_all /home/fd/git/JtR/src/bench.c:754 #5 0x7509c7 in john_run /home/fd/git/JtR/src/john.c:1309 #6 0x751f4f in main /home/fd/git/JtR/src/john.c:1687 #7 0x342fa21d64 in ?? ??:0 ``` And with --enable-memdbg in addition to --enable-asan: ``` (bleeding-jumbo)src $ make -s distclean (bleeding-jumbo)src $ ./configure --enable-asan --enable-memdbg [...] Development options (these may hurt performance when enabled): Memdbg memory debugging settings ............ -DMEMDBG_ON AddressSanitizer ("ASan") ................... enabled Install missing libraries to get any needed features that were omitted. Configure finished. Now 'make clean && make -s' to compile. (bleeding-jumbo)src $ make -s -j 16 debug /usr/bin/ar: creating aes.a Make process completed. (bleeding-jumbo)src $ cd ../run/ (bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS ================================================================= ==20685== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fedb26e5010 #0 0x7fedc073c0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7bf54b (/home/fd/git/JtR/run/john+0x7bf54b) #2 0x69e615 (/home/fd/git/JtR/run/john+0x69e615) #3 0x7492d1 (/home/fd/git/JtR/run/john+0x7492d1) #4 0x7321e5 (/home/fd/git/JtR/run/john+0x7321e5) #5 0x7553a1 (/home/fd/git/JtR/run/john+0x7553a1) #6 0x75693d (/home/fd/git/JtR/run/john+0x75693d) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) ==20685== ABORTING (bleeding-jumbo)run $ ./asan_symbolize.py #0 0x7fedc073c0f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7bf54b (/home/fd/git/JtR/run/john+0x7bf54b) #2 0x69e615 (/home/fd/git/JtR/run/john+0x69e615) #3 0x7492d1 (/home/fd/git/JtR/run/john+0x7492d1) #4 0x7321e5 (/home/fd/git/JtR/run/john+0x7321e5) #5 0x7553a1 (/home/fd/git/JtR/run/john+0x7553a1) #6 0x75693d (/home/fd/git/JtR/run/john+0x75693d) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1 #0 0x7fedc073c0f9 in __interceptor_free ??:? #1 0x7bf54b in MEMDBG_free /home/fd/git/JtR/src/memdbg.c:960 #2 0x69e615 in done /home/fd/git/JtR/src/rawSHA1_ng_fmt_plug.c:274 (discriminator 1) #3 0x7492d1 in fmt_done /home/fd/git/JtR/src/formats.c:112 #4 0x7321e5 in benchmark_all /home/fd/git/JtR/src/bench.c:754 #5 0x7553a1 in john_run /home/fd/git/JtR/src/john.c:1309 #6 0x75693d in main /home/fd/git/JtR/src/john.c:1687 #7 0x342fa21d64 in ?? ??:0 ```
bsakaguchi 2026-10-14 03:20:39 +07:00
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

I too saw some strange effects of using ASan today. Perhaps it's not working really well together with our recent introduction of posix_memalign()?

I got some really random behavior with OpenCL and CUDA when using ASan (eg no devices seen at all, or random garbage seen in --list=cuda-devices). I also got some less critical version of what you posted, with a notice that I could disable it (in case of false positive) with some environment variable (which I did). BTW that one was from dynamic_fmt.c.

I'll check what gcc version that was.

<!-- gh-comment-id:83767312 --> @magnumripper commented on GitHub (Mar 19, 2015): I too saw some strange effects of using ASan today. Perhaps it's not working really well together with our recent introduction of posix_memalign()? I got some really random behavior with OpenCL and CUDA when using ASan (eg no devices seen at all, or random garbage seen in --list=cuda-devices). I also got some less critical version of what you posted, with a notice that I could disable it (in case of false positive) with some environment variable (which I did). BTW that one was from dynamic_fmt.c. I'll check what gcc version that was.
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

I also saw that reference to MEMDBG_off_free btw. Why is memdbg involved at all when memdbg is not in use? Perhaps we have some bug in that?

<!-- gh-comment-id:83768150 --> @magnumripper commented on GitHub (Mar 19, 2015): I also saw that reference to MEMDBG_off_free btw. Why is memdbg involved **at all** when memdbg is not in use? Perhaps we have some bug in that?
Author
Owner

@frank-dittrich commented on GitHub (Mar 19, 2015):

When built without memdbg, it is MEMDBG_off_free, when built with memdbg, it is MEMDBG_free.

<!-- gh-comment-id:83770358 --> @frank-dittrich commented on GitHub (Mar 19, 2015): When built without memdbg, it is MEMDBG_off_free, when built with memdbg, it is MEMDBG_free.
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

Yes. I meant MEMDBG_off_free. Why is memdbg involved when I did not ask for it. The fact it's named _off_ doesn't really cut it. I want memdbg to not be involved at all unless I wanted it.

<!-- gh-comment-id:83771126 --> @magnumripper commented on GitHub (Mar 19, 2015): Yes. I meant MEMDBG_off_free. Why is memdbg involved when I did not ask for it. The fact it's named `_off_` doesn't really cut it. I want memdbg to not be involved at all unless I wanted it.
Author
Owner

@frank-dittrich commented on GitHub (Mar 19, 2015):

BTW, it is not just raw-sha1-ng format.
Probably it just depends on the alignment of the allocated buffer.

(bleeding-jumbo)run $ ./john --stress-test=0 
Will run 8 OpenMP threads
Testing: descrypt, traditional crypt(3) [DES 128/128 AVX-16]... (8xOMP) PASS
Testing: bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations) [DES 128/128 AVX-16]... (8xOMP) PASS
Testing: md5crypt, crypt(3) $1$ [MD5 128/128 AVX 12x]... (8xOMP) PASS
Testing: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X2]... (8xOMP) PASS
Testing: scrypt (16384, 8, 1) [Salsa20/8 128/128 AVX]... (8xOMP) PASS
Testing: LM [DES 128/128 AVX-16]... (8xOMP) PASS
Testing: AFS, Kerberos AFS [DES 48/64 4K]... PASS
Testing: tripcode [DES 128/128 AVX-16]... (8xOMP) PASS
Testing: dummy [N/A]... PASS
Testing: dynamic_0 [md5($p) (raw-md5) 128/128 AVX (480*1)x4x3]... (8xOMP) PASS
=================================================================
==5039== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x0000016f6080
    #0 0x7efe908980f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415)
    #2 0x48990a (/home/fd/git/JtR/run/john+0x48990a)
    #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd)
    #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39)
    #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7)
    #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
==5039== ABORTING
(bleeding-jumbo)run $ ./asan_symbolize.py 
    #0 0x7efe908980f9 (/usr/lib64/libasan.so.0.0.0+0x160f9)
    #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415)
    #2 0x48990a (/home/fd/git/JtR/run/john+0x48990a)
    #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd)
    #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39)
    #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7)
    #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f)
    #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64)
llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1
    #0 0x7efe908980f9 in __interceptor_free ??:?
    #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099
    #2 0x48990a in done /home/fd/git/JtR/src/dynamic_fmt.c:861 (discriminator 1)
    #3 0x7449cd in fmt_done /home/fd/git/JtR/src/formats.c:112
    #4 0x72db39 in benchmark_all /home/fd/git/JtR/src/bench.c:754
    #5 0x7509c7 in john_run /home/fd/git/JtR/src/john.c:1309
    #6 0x751f4f in main /home/fd/git/JtR/src/john.c:1687
    #7 0x342fa21d64 in ?? ??:0
<!-- gh-comment-id:83771501 --> @frank-dittrich commented on GitHub (Mar 19, 2015): BTW, it is not just raw-sha1-ng format. Probably it just depends on the alignment of the allocated buffer. ``` (bleeding-jumbo)run $ ./john --stress-test=0 Will run 8 OpenMP threads Testing: descrypt, traditional crypt(3) [DES 128/128 AVX-16]... (8xOMP) PASS Testing: bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations) [DES 128/128 AVX-16]... (8xOMP) PASS Testing: md5crypt, crypt(3) $1$ [MD5 128/128 AVX 12x]... (8xOMP) PASS Testing: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X2]... (8xOMP) PASS Testing: scrypt (16384, 8, 1) [Salsa20/8 128/128 AVX]... (8xOMP) PASS Testing: LM [DES 128/128 AVX-16]... (8xOMP) PASS Testing: AFS, Kerberos AFS [DES 48/64 4K]... PASS Testing: tripcode [DES 128/128 AVX-16]... (8xOMP) PASS Testing: dummy [N/A]... PASS Testing: dynamic_0 [md5($p) (raw-md5) 128/128 AVX (480*1)x4x3]... (8xOMP) PASS ================================================================= ==5039== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x0000016f6080 #0 0x7efe908980f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415) #2 0x48990a (/home/fd/git/JtR/run/john+0x48990a) #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd) #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39) #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7) #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) ==5039== ABORTING (bleeding-jumbo)run $ ./asan_symbolize.py #0 0x7efe908980f9 (/usr/lib64/libasan.so.0.0.0+0x160f9) #1 0x7b8415 (/home/fd/git/JtR/run/john+0x7b8415) #2 0x48990a (/home/fd/git/JtR/run/john+0x48990a) #3 0x7449cd (/home/fd/git/JtR/run/john+0x7449cd) #4 0x72db39 (/home/fd/git/JtR/run/john+0x72db39) #5 0x7509c7 (/home/fd/git/JtR/run/john+0x7509c7) #6 0x751f4f (/home/fd/git/JtR/run/john+0x751f4f) #7 0x342fa21d64 (/usr/lib64/libc-2.18.so+0x21d64) llvm-symbolizer: for the -functions option: 'short' is invalid value for boolean argument! Try 0 or 1 #0 0x7efe908980f9 in __interceptor_free ??:? #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099 #2 0x48990a in done /home/fd/git/JtR/src/dynamic_fmt.c:861 (discriminator 1) #3 0x7449cd in fmt_done /home/fd/git/JtR/src/formats.c:112 #4 0x72db39 in benchmark_all /home/fd/git/JtR/src/bench.c:754 #5 0x7509c7 in john_run /home/fd/git/JtR/src/john.c:1309 #6 0x751f4f in main /home/fd/git/JtR/src/john.c:1687 #7 0x342fa21d64 in ?? ??:0 ```
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

After d298640 I see no problem whatsoever using ASan with gcc-4.9.2 under OSX and using posix_memalign(). I think the machine I had problems with (some vanilla LTS Linux) were using gcc-4.8 at best, possibly 4.7. I'm pretty sure that system ended up using aligned_alloc() - not sure that matters at all (should not).

<!-- gh-comment-id:83772645 --> @magnumripper commented on GitHub (Mar 19, 2015): After d298640 I see no problem whatsoever using ASan with gcc-4.9.2 under OSX and using `posix_memalign()`. I think the machine I had problems with (some vanilla LTS Linux) were using gcc-4.8 at best, possibly 4.7. I'm pretty sure that system ended up using `aligned_alloc()` - not sure that matters at all (should not).
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

I also see no problem using ASan with clang "Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)" (ending up using posix_memalign())

EDIT it turns out I do not get ASan with that compiler. The --enable-asan silently fails.

<!-- gh-comment-id:83774276 --> @magnumripper commented on GitHub (Mar 19, 2015): I also see no problem using ASan with clang "Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)" (ending up using `posix_memalign()`) **EDIT** it turns out I do not get ASan with that compiler. The --enable-asan silently fails.
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

I think we have now already established this is an external issue (ASan bug in older versions) but let's document it further. I am REALLY glad it did not end up a real problem with something else.

<!-- gh-comment-id:83778352 --> @magnumripper commented on GitHub (Mar 19, 2015): I think we have now already established this is an external issue (ASan bug in older versions) but let's document it further. I am REALLY glad it did not end up a real problem with something else.
Author
Owner

@magnumripper commented on GitHub (Mar 19, 2015):

Probably it just depends on the alignment of the allocated buffer.

Try a 32-bit build, that's much more likely to get alignment problems.

<!-- gh-comment-id:83779692 --> @magnumripper commented on GitHub (Mar 19, 2015): > Probably it just depends on the alignment of the allocated buffer. Try a 32-bit build, that's **much** more likely to get alignment problems.
Author
Owner

@jfoug commented on GitHub (Mar 20, 2015):

The MEMDBG_off_free() was added to 'mimick' MEM_FREE() behavior for times when free() was used vs MEM_FREE(). I know this was talked about a year ago. It would harm nothing to simply remove it, and let calls to free() be straight to free(), instead of being a macro wrapper checking for null and later setting pointer TO null.

#if !defined(__MEMDBG__)
/* this code mimicks JtR's FREE_MEM(a) but does it for any normal free(a) call */
#if !defined _MSC_VER
extern void MEMDBG_off_free(void *a);
#define free(a)   do { if(a) MEMDBG_off_free(a); a=0; } while(0)
#endif
#endif
<!-- gh-comment-id:83993919 --> @jfoug commented on GitHub (Mar 20, 2015): The MEMDBG_off_free() was added to 'mimick' MEM_FREE() behavior for times when free() was used vs MEM_FREE(). I know this was talked about a year ago. It would harm nothing to simply remove it, and let calls to free() be straight to free(), instead of being a macro wrapper checking for null and later setting pointer TO null. ``` #if !defined(__MEMDBG__) /* this code mimicks JtR's FREE_MEM(a) but does it for any normal free(a) call */ #if !defined _MSC_VER extern void MEMDBG_off_free(void *a); #define free(a) do { if(a) MEMDBG_off_free(a); a=0; } while(0) #endif #endif ```
Author
Owner

@magnumripper commented on GitHub (Mar 20, 2015):

Hmm so what you are saying is the one that I see is not using MEM_FREE() but simply a free()? In that case it might be a good thing.

<!-- gh-comment-id:84189049 --> @magnumripper commented on GitHub (Mar 20, 2015): Hmm so what you are saying is the one that I see is not using MEM_FREE() but simply a free()? In that case it might be a good thing.
Author
Owner

@jfoug commented on GitHub (Mar 21, 2015):

Yes, the simple free is a macro (in non memdbg mode). It behaves much like MEM_FREE. In that it is a macro that behaves the same . so I needed a function to use for free. That's the one you see

<!-- gh-comment-id:84215388 --> @jfoug commented on GitHub (Mar 21, 2015): Yes, the simple free is a macro (in non memdbg mode). It behaves much like MEM_FREE. In that it is a macro that behaves the same . so I needed a function to use for free. That's the one you see
Author
Owner

@magnumripper commented on GitHub (Mar 21, 2015):

I think the machine I had problems with (some vanilla LTS Linux) were using gcc-4.8 at best, possibly 4.7

Confirmed, it was gcc 4.8.2 (Ubuntu).

<!-- gh-comment-id:84408684 --> @magnumripper commented on GitHub (Mar 21, 2015): > I think the machine I had problems with (some vanilla LTS Linux) were using gcc-4.8 at best, possibly 4.7 Confirmed, it was gcc 4.8.2 (Ubuntu).
Author
Owner

@magnumripper commented on GitHub (Mar 21, 2015):

Hmm so what you are saying is the one that I see is not using MEM_FREE() but simply a free()?

Yes, the simple free is a macro (in non memdbg mode). It behaves much like MEM_FREE. In that it is a macro that behaves the same . so I needed a function to use for free. That's the one you see

But this was in dynamic_fmt.c line 861

    #0 0x7efe908980f9 in __interceptor_free ??:?
    #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099
    #2 0x48990a in done /home/fd/git/JtR/src/dynamic_fmt.c:861 (discriminator 1)

$ cat -n dynamic_fmt.c | grep -C 1 861
   860  #ifdef SIMD_COEF_32
   861      MEM_FREE(crypt_key2);
   862      MEM_FREE(crypt_key);

...which is using MEM_FREE(), not free(). So why is our namespace clobbered by memdbg?

<!-- gh-comment-id:84462697 --> @magnumripper commented on GitHub (Mar 21, 2015): > > Hmm so what you are saying is the one that I see is not using MEM_FREE() but simply a free()? > > Yes, the simple free is a macro (in non memdbg mode). It behaves much like MEM_FREE. In that it is a macro that behaves the same . so I needed a function to use for free. That's the one you see But this was in dynamic_fmt.c line 861 ``` #0 0x7efe908980f9 in __interceptor_free ??:? #1 0x7b8415 in MEMDBG_off_free /home/fd/git/JtR/src/memdbg.c:1099 #2 0x48990a in done /home/fd/git/JtR/src/dynamic_fmt.c:861 (discriminator 1) $ cat -n dynamic_fmt.c | grep -C 1 861 860 #ifdef SIMD_COEF_32 861 MEM_FREE(crypt_key2); 862 MEM_FREE(crypt_key); ``` ...which is using MEM_FREE(), not free(). So why is our namespace clobbered by memdbg?
Author
Owner

@jfoug commented on GitHub (Mar 21, 2015):

Likely the define for free is happening prior to the define of MEMFREE. I'm not where I can look at the code (out at my camp)

<!-- gh-comment-id:84465917 --> @jfoug commented on GitHub (Mar 21, 2015): Likely the define for free is happening prior to the define of MEMFREE. I'm not where I can look at the code (out at my camp)
Author
Owner

@magnumripper commented on GitHub (Mar 21, 2015):

That is what I'm worried about. Perhaps it ends up like

if (ptr) if (ptr) free(ptr); ptr=NULL; ptr=NULL;

or something like that. That would likely be optimized to something sane though.

<!-- gh-comment-id:84467944 --> @magnumripper commented on GitHub (Mar 21, 2015): That is what I'm worried about. Perhaps it ends up like ``` if (ptr) if (ptr) free(ptr); ptr=NULL; ptr=NULL; ``` or something like that. That would likely be optimized to something sane though.
Author
Owner

@magnumripper commented on GitHub (Mar 30, 2015):

This was fixed with fc552453, right?

<!-- gh-comment-id:87508960 --> @magnumripper commented on GitHub (Mar 30, 2015): This was fixed with fc552453, right?
Author
Owner

@frank-dittrich commented on GitHub (Mar 30, 2015):

Yes, looks like it is fixed now. At least I am unable to reproduce the problem.

<!-- gh-comment-id:87585623 --> @frank-dittrich commented on GitHub (Mar 30, 2015): Yes, looks like it is fixed now. At least I am unable to reproduce the problem.
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#701
No description provided.