selftests: prctl: Add new prctl test for PR_SET_VMA action
PATCH 1/1 selftests: prctl: Add new prctl test for PR_SET_VMA action
This patch will add the new test, which covers the prctl call with PR_SET_VMA command. The test tries to give a name to the anonymous VMA within the process memory map, and then checks the result of the operation by parsing 'maps' virtual file.
Additionally, the test tries to call the prctl PR_SET_VMA command with invalid arguments, and checks the error codes for correctness.
At the moment anonymous VMA naming through prctl call functionality is not covered with any tests, so I think implementing it makes sense.
Signed-off-by Ivan Orlov <[email protected]>
--- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/prctl/.gitignore | 1 + tools/testing/selftests/prctl/Makefile | 2 +- tools/testing/selftests/prctl/config | 1 + .../selftests/prctl/set-anon-vma-name-test.c | 104 ++++++++++++++++++ 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/prctl/config create mode 100644 tools/testing/selftests/prctl/set-anon-vma-name-test.c
tools/testing/selftests/Makefile +1 -0
@@ -89,6 +89,7 @@ TARGETS += vDSO TARGETS += mm TARGETS += x86 TARGETS += zram +TARGETS += prctl #Please keep the TARGETS list alphabetically sorted # Run "make quicktest=1 run_tests" or # "make quicktest=1 kselftest" from top level Makefile
tools/testing/selftests/prctl/.gitignore +1 -0
@@ -2,3 +2,4 @@ disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test +set-anon-vma-name-test
tools/testing/selftests/prctl/Makefile +1 -1
@@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) ifeq ($(ARCH),x86) TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \ - disable-tsc-test + disable-tsc-test set-anon-vma-name-test all: $(TEST_PROGS) include ../lib.mk
tools/testing/selftests/prctl/config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_ANON_VMA_NAME=y
tools/testing/selftests/prctl/set-anon-vma-name-test.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.34.1