mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
x86_64: Suppress false positive valgrind error
When strcmp-avx2.S is used as the default, elf/tst-valgrind-smoke fails with ==1272761== Conditional jump or move depends on uninitialised value(s) ==1272761== at 0x4022C98: strcmp (strcmp-avx2.S:462) ==1272761== by 0x400B05B: _dl_name_match_p (dl-misc.c:75) ==1272761== by 0x40085F3: _dl_map_object (dl-load.c:1966) ==1272761== by 0x401AEA4: map_doit (rtld.c:644) ==1272761== by 0x4001488: _dl_catch_exception (dl-catch.c:237) ==1272761== by 0x40015AE: _dl_catch_error (dl-catch.c:256) ==1272761== by 0x401B38F: do_preload (rtld.c:816) ==1272761== by 0x401C116: handle_preload_list (rtld.c:892) ==1272761== by 0x401EDF5: dl_main (rtld.c:1842) ==1272761== by 0x401A79E: _dl_sysdep_start (dl-sysdep.c:140) ==1272761== by 0x401BEEE: _dl_start_final (rtld.c:494) ==1272761== by 0x401BEEE: _dl_start (rtld.c:581) ==1272761== by 0x401AD87: ??? (in */elf/ld.so) The assembly codes are: 0x0000000004022c80 <+144>: vmovdqu 0x20(%rdi),%ymm0 0x0000000004022c85 <+149>: vpcmpeqb 0x20(%rsi),%ymm0,%ymm1 0x0000000004022c8a <+154>: vpcmpeqb %ymm0,%ymm15,%ymm2 0x0000000004022c8e <+158>: vpandn %ymm1,%ymm2,%ymm1 0x0000000004022c92 <+162>: vpmovmskb %ymm1,%ecx 0x0000000004022c96 <+166>: inc %ecx => 0x0000000004022c98 <+168>: jne 0x4022c32 <strcmp+66> strcmp-avx2.S has 32-byte vector loads of strings which are shorter than 32 bytes: (gdb) p (char *) ($rdi + 0x20) $6 = 0x1ffeffea20 "memcheck-amd64-linux.so" (gdb) p (char *) ($rsi + 0x20) $7 = 0x4832640 "core-amd64-linux.so" (gdb) call (int) strlen ((char *) ($rsi + 0x20)) $8 = 19 (gdb) call (int) strlen ((char *) ($rdi + 0x20)) $9 = 23 (gdb) It triggers the valgrind error. The above code is safe since the loads don't cross the page boundary. Update tst-valgrind-smoke.sh to accept an optional suppression file and pass a suppression file to valgrind when strcmp-avx2.S is the default implementation of strcmp. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
This commit is contained in:
parent
8c7c188d62
commit
a1735e0aa8
4 changed files with 28 additions and 3 deletions
|
@ -617,7 +617,8 @@ tests-special += $(objpfx)tst-valgrind-smoke.out
|
||||||
endif
|
endif
|
||||||
$(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)valgrind-test
|
$(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)valgrind-test
|
||||||
$(SHELL) $< $(objpfx)ld.so $(rtlddir)/$(rtld-installed-name) '$(test-wrapper-env)' \
|
$(SHELL) $< $(objpfx)ld.so $(rtlddir)/$(rtld-installed-name) '$(test-wrapper-env)' \
|
||||||
'$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test > $@; $(evaluate-test)
|
'$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test \
|
||||||
|
'$(valgrind-suppressions-tst-valgrind-smoke)' > $@; $(evaluate-test)
|
||||||
|
|
||||||
tests += $(tests-execstack-$(have-z-execstack))
|
tests += $(tests-execstack-$(have-z-execstack))
|
||||||
ifeq ($(run-built-tests),yes)
|
ifeq ($(run-built-tests),yes)
|
||||||
|
|
|
@ -25,6 +25,7 @@ test_wrapper_env="$3"
|
||||||
run_program_env="$4"
|
run_program_env="$4"
|
||||||
library_path="$5"
|
library_path="$5"
|
||||||
test_prog="$6"
|
test_prog="$6"
|
||||||
|
valgrind_suppressions="$7"
|
||||||
|
|
||||||
# Test whether valgrind is available in the test
|
# Test whether valgrind is available in the test
|
||||||
# environment. If not, skip the test.
|
# environment. If not, skip the test.
|
||||||
|
@ -34,7 +35,7 @@ ${test_wrapper_env} ${run_program_env} \
|
||||||
# Test valgrind works with the system ld.so in the test environment
|
# Test valgrind works with the system ld.so in the test environment
|
||||||
/bin/sh -c \
|
/bin/sh -c \
|
||||||
"${test_wrapper_env} ${run_program_env} \
|
"${test_wrapper_env} ${run_program_env} \
|
||||||
valgrind -q --error-exitcode=1 \
|
valgrind -q --error-exitcode=1 ${valgrind_suppressions} \
|
||||||
${system_rtld} /bin/echo ${system_rtld}" || exit 77
|
${system_rtld} /bin/echo ${system_rtld}" || exit 77
|
||||||
|
|
||||||
# Finally the actual test inside the test environment,
|
# Finally the actual test inside the test environment,
|
||||||
|
@ -42,5 +43,5 @@ ${test_wrapper_env} ${run_program_env} \
|
||||||
# the smoke test under valgrind.
|
# the smoke test under valgrind.
|
||||||
/bin/sh -c \
|
/bin/sh -c \
|
||||||
"${test_wrapper_env} ${run_program_env} \
|
"${test_wrapper_env} ${run_program_env} \
|
||||||
valgrind -q --error-exitcode=1 \
|
valgrind -q --error-exitcode=1 ${valgrind_suppressions} \
|
||||||
${rtld} --library-path ${library_path} ${test_prog} ${rtld}"
|
${rtld} --library-path ${library_path} ${test_prog} ${rtld}"
|
||||||
|
|
|
@ -211,6 +211,12 @@ tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
|
||||||
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Check if ISA level is 3 or above.
|
||||||
|
ifneq (,$(filter $(have-x86-isa-level),$(x86-isa-level-3-or-above)))
|
||||||
|
valgrind-suppressions-tst-valgrind-smoke = \
|
||||||
|
--suppressions=$(..)sysdeps/x86_64/tst-valgrind-smoke.supp
|
||||||
|
endif
|
||||||
|
|
||||||
endif # $(subdir) == elf
|
endif # $(subdir) == elf
|
||||||
|
|
||||||
ifeq ($(subdir),csu)
|
ifeq ($(subdir),csu)
|
||||||
|
|
17
sysdeps/x86_64/tst-valgrind-smoke.supp
Normal file
17
sysdeps/x86_64/tst-valgrind-smoke.supp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
False positive at strcmp-avx2.S:462
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:strcmp
|
||||||
|
fun:_dl_name_match_p
|
||||||
|
fun:_dl_map_object
|
||||||
|
fun:map_doit
|
||||||
|
fun:_dl_catch_exception
|
||||||
|
fun:_dl_catch_error
|
||||||
|
fun:do_preload
|
||||||
|
fun:handle_preload_list
|
||||||
|
fun:dl_main
|
||||||
|
fun:_dl_sysdep_start
|
||||||
|
fun:_dl_start_final
|
||||||
|
fun:_dl_start
|
||||||
|
obj:*/elf/ld.so
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue