john icon indicating copy to clipboard operation
john copied to clipboard

Runtime warnings with ASAN and UBSAN

Open frank-dittrich opened this issue 4 years ago • 3 comments

Might be false-positive

$ ./john --test=0 --format=-opencl
Will run 8 OpenMP threads
Testing: descrypt, traditional crypt(3) [DES 256/256 AVX2]... (8xOMP) DES_bs.c:552:2: runtime error: load of misaligned address 0x7f8e635072c1 for type 'long int', which requires 8 byte alignment
0x7f8e635072c1: note: pointer points here
 00 00 00  1f 02 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^ 
DES_bs.c:553:2: runtime error: load of misaligned address 0x7f8e635072e1 for type 'long int', which requires 8 byte alignment
0x7f8e635072e1: note: pointer points here
 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^ 
DES_bs.c:555:2: runtime error: load of misaligned address 0x7f8e63507261 for type 'long int', which requires 8 byte alignment
0x7f8e63507261: note: pointer points here
 00 00 00  e0 ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff
              ^ 
DES_bs.c:556:2: runtime error: load of misaligned address 0x7f8e63507281 for type 'long int', which requires 8 byte alignment
0x7f8e63507281: note: pointer points here
 ff ff ff  bf ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff
              ^ 
DES_bs.c:557:2: runtime error: load of misaligned address 0x7f8e635072a1 for type 'long int', which requires 8 byte alignment
0x7f8e635072a1: note: pointer points here
 ff ff ff  1f 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^ 
DES_bs.c:562:4: runtime error: load of misaligned address 0x7f8e63507241 for type 'long int', which requires 8 byte alignment
0x7f8e63507241: note: pointer points here
 ff ff ff  5f 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^ 
DES_bs.c:567:9: runtime error: load of misaligned address 0x7f8e63507301 for type 'long int', which requires 8 byte alignment
0x7f8e63507301: note: pointer points here
 00 00 00  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff
              ^ 
PASS

And for some reason, mscash2 format as a CPU format and as mscash2-opencl format on the Intel "GPU" (but not POCL) fail with --enable-ubsan, while they pass self-test in a regular build:

$ ./john --test --format=mscash2
Will run 8 OpenMP threads
NOTE: This is a debug build, speed will be lower than normal
Benchmarking: mscash2, MS Cache Hash 2 (DCC2) [PBKDF2-SHA1 256/256 AVX2 8x]... (8xOMP) FAILED (cmp_all(10))
$ ./john --test=0 --format=mscash2-opencl --device=1
Testing: mscash2-opencl, MS Cache Hash 2 (DCC2) [PBKDF2-SHA1 OpenCL]... Device 1: Intel(R) UHD Graphics 620 [0x5917]
FAILED (cmp_all(1))

(And, IMHO, the Device info sholdn't be intermangled with the --test output.)

frank-dittrich avatar Apr 23 '21 20:04 frank-dittrich

And for some reason, mscash2 format as a CPU format and as mscash2-opencl format on the Intel "GPU" (but not POCL) fail with --enable-ubsan, while they pass self-test in a regular build:

Maybe you can reproduce this without --enable-ubsan by disabling only ARCH_ALLOWS_UNALIGNED?

solardiz avatar Apr 23 '21 20:04 solardiz

With just CFLAGS_EXTRA="-DARCH_ALLOWS_UNALIGNED=0" instead of --enable-ubsan, -format=mscash2 passes self test, but --format=mscash2-opencl --device=1 still fails:

$ ./john --test --format=mscash2-opencl --device=1
Benchmarking: mscash2-opencl, MS Cache Hash 2 (DCC2) [PBKDF2-SHA1 OpenCL]... Device 1: Intel(R) UHD Graphics 620 [0x5917]
FAILED (cmp_all(1))

frank-dittrich avatar Apr 23 '21 20:04 frank-dittrich

I think this mscash2 CPU format failure in UbSan build is the same one I fixed in 9738d30775bf6f7072a66435b01ef619d77f0dd0:

$ ./john --test --format=mscash2 Will run 8 OpenMP threads NOTE: This is a debug build, speed will be lower than normal Benchmarking: mscash2, MS Cache Hash 2 (DCC2) [PBKDF2-SHA1 256/256 AVX2 8x]... (8xOMP) FAILED (cmp_all(10))

I don't know why mscash2-opencl was (maybe still is?) also failing in UbSan builds. It doesn't look like the same issue to me.

solardiz avatar Jul 06 '24 19:07 solardiz