Skip to contentSkip to conversation

selftests: prctl: Add new prctl test for PR_SET_VMA action

PATCH Superseded Ivan Orlov 1 participant 1 message Mar 25, 2023 Kselftest

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ivan Orlov

author
#0 lore raw

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.

---
 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
index 13a6837a0c6b..dc2bfeaf4da7 100644
@@ -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
index 91af2b631bc9..7a657b25f686 100644
@@ -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
index c7923b205222..c058b81eeb41 100644
@@ -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
new file mode 100644
index 000000000000..c6ed03c544e5
@@ -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