Page MenuHome GnuPG

Memory errors when running `make check` under Clang sanitizers
Closed, ResolvedPublic


Memory errors make me nervous.

Attached is the script I am using to build and run GnuPG suite under Clang and
its sanitizers. This is dynamic testing on real data. I'm told there are no
false positives.

export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++
export CPPFLAGS="-fsanitize=address -fsanitize=undefined"
export CFLAGS="-fsanitize=address -fsanitize=undefined"
export CFLAGS="-fsanitize=address -fsanitize=undefined -fno-sanitize=vptr"

export PREFIX=~/gpg-sanitize

./configure --enable-static --disable-shared --disable-random-daemon
--with-libgpg-error-prefix="$PREFIX" --with-pth-prefix="$PREFIX" --prefix="$PREFIX"

make check | /usr/local/bin/


30092==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc

0x00000051d8c7 sp 0x7fffc5990c00 bp 0x7fffc5990cd0 T0)

#0 0x51d8c6 in get_xgetbv


#1 0x51c22a in detect_x86_gnuc


#2 0x51b748 in _gcry_hwf_detect_x86


#3 0x4fe73d in _gcry_detect_hw_features


#4 0x4a95f8 in global_init


#5 0x4ab627 in _gcry_vcontrol


#6 0x481759 in gcry_control


#7 0x47fcdd in main


#8 0x2b3b12713ec4 in __libc_start_main


#9 0x47fa0c in _start


AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ??:0 get_xgetbv


FAIL: version



Event Timeline

JW set Version to 1.6.3.

Attached is the recipe I am using to build Clang 3.5.


$ addr2line -e libgcrypt-1.6.3/tests/version 0x51d8c6


$ gdb
(gdb) file libgcrypt-1.6.3/tests/version
Reading symbols from libgcrypt-1.6.3/tests/version...done.
(gdb) info symbol 0x51d8c6
get_xgetbv + 294 in section .text
(gdb) info *0x51d8c6
Undefined info command: "*0x51d8c6". Try "help info".
(gdb) info line *0x51d8c6
No line number information available for address 0x51d8c6 <get_xgetbv+294>

Related bug: "Test suite built without symbols",

Attached is the script I am using to acceptance test the suite. It requires
Clang 3.5 (Clang 3.5 recipe was provided with Bug 1872).

werner claimed this task.
werner added a project: Mistaken.

"makes me nervous" is not a bug report. Please take it to gnupg-devel and use
master for fuzzing.