selftests: prctl: Add new prctl test for PR_SET_VMA action
PATCH v2 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.
In version 2 of this patch I consider the selftest Makefile rule about TARGETS entries order - I moved the 'prctl' entry in the Makefile to follow the lexicographic order. In version 1 it was placed at the end of the list.
--- 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
@@ -58,6 +58,7 @@ TARGETS += nsfs TARGETS += pidfd TARGETS += pid_namespace TARGETS += powerpc +TARGETS += prctl TARGETS += proc TARGETS += pstore TARGETS += ptrace
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 · 6 lines
2.34.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Shuah Khan
maintainerQuoted 11 lines · Ivan Orlov
This patch will add the new test, which covers the prctl call with
PR_SET_VMAcommand. 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_VMAcommand 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.
Quoted 7 lines
In version 2 of this patch I consider the selftest
Makefilerule about TARGETS entries order - I moved the 'prctl' entry in theMakefileto follow the lexicographic order. In version 1 it was placed at the end of the list.Signed-off-by Ivan Orlov <[email protected]>---
Thank you. Applied to linux-kselftest next for Linux 6.4-rc1.
thanks,
-- Shuah
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees