Add regression tests for vsyscall and vdso
PATCH v3 1/1 Add regression tests for vsyscall and vdso
From: Veronika Kabatova <[email protected]>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall range and permissions were fixed with kernel commit 103efcd9aac1 ("fix perms/range of vsyscall vma in /proc/*/maps"). While some newer systems run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug (fixed with b6558c4a2378 ("fix [vdso] page permissions") and e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso pages were not included in core dumps which caused incomplete backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
#2 0x0804845f in handle_alrm (signo=14) at small.c:9
#3 0x005f0420 in ?? ()
#4 0x0000000e in ?? ()
#5 0x00000033 in ?? ()
#6 0x00000000 in ?? ()--- runtest/mm | 1 + testcases/kernel/mem/.gitignore | 1 + testcases/kernel/mem/vma/Makefile | 2 + testcases/kernel/mem/vma/vma05.sh | 84 +++++++++++++++++++++++++++++++++++ testcases/kernel/mem/vma/vma05_vdso.c | 7 +++ 5 files changed, 95 insertions(+) create mode 100755 testcases/kernel/mem/vma/vma05.sh create mode 100644 testcases/kernel/mem/vma/vma05_vdso.c
runtest/mm +1 -0
@@ -89,6 +89,7 @@ vma01 vma01 vma02 vma02 vma03 vma03 vma04 vma04 +vma05 vma05.sh overcommit_memory01 overcommit_memory overcommit_memory02 overcommit_memory -R 0
testcases/kernel/mem/.gitignore +1 -0
@@ -72,5 +72,6 @@ /vma/vma02 /vma/vma03 /vma/vma04 +/vma/vma05_vdso /vmtests/data_space /vmtests/stack_space
testcases/kernel/mem/vma/Makefile +2 -0
@@ -19,6 +19,8 @@ top_srcdir ?= ../../../.. +vma05_vdso: CFLAGS+=-ggdb3 + include $(top_srcdir)/include/mk/testcases.mk include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/vma/vma05.sh new file +84 -0
84 lines not on this page · raw message
testcases/kernel/mem/vma/vma05_vdso.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <signal.h> + +int main (void ) +{ +raise (SIGSEGV ); +return 0 ; +}
Signature · 1 line
2.13.3
PATCH v3 1/1 Add regression tests for vsyscall and vdso
Hi!
I've fixed a few cases of bashism (please try to run the test with dash before submitting next time) and added TST_NEEDS_TMPDIR=1 since the test creates the core file which should be put into temporary directory.
And pushed, thanks.
The diff for what I did:
testcases/kernel/mem/vma/vma05.sh +1 -0
@@ -38,6 +38,7 @@ TST_SETUP=setup TST_CLEANUP=cleanup TST_TESTFUNC=vma_report_check TST_NEEDS_ROOT=1 +TST_NEEDS_TMPDIR=1 TST_NEEDS_CMDS="gdb"
and:
testcases/kernel/mem/vma/vma05.sh +5 -5
@@ -59,10 +59,10 @@ cleanup() vma_report_check() { - if [ $(uname -m) == "x86_64" ] ; then - if LINE=$(grep "vsyscall" /proc/self/maps) ; then + if [ $(uname -m) = "x86_64" ]; then + if LINE=$(grep "vsyscall" /proc/self/maps); then RIGHT="ffffffffff600000-ffffffffff601000[[:space:]]r-xp" - if grep -q "$RIGHT" <<< "$LINE" ; then + if echo "$LINE" | grep -q "$RIGHT"; then tst_res TPASS "[vsyscall] reported correctly" else tst_res TFAIL "[vsyscall] reporting wrong"
@@ -71,10 +71,10 @@ vma_report_check() fi rm -rf core* - { vma05_vdso; } >& /dev/null + { vma05_vdso; } > /dev/null 2>&1 TRACE=$(gdb -silent -ex="thread apply all backtrace" -ex="quit"\ vma05_vdso ./core* 2> /dev/null) - if grep -qF "??" <<< "$TRACE" ; then + if echo "$TRACE" | grep -qF "??"; then tst_res TFAIL "[vdso] bug not patched" else tst_res TPASS "[vdso] backtrace complete"
Signature · 2 lines
Cyril Hrubis [email protected]