Skip to contentSkip to conversation

selftests: prctl: Add new prctl test for PR_SET_VMA action

PATCH In review Ivan Orlov 2 participants 2 messages Mar 25, 2023 – Mar 28, 2023 Kselftest

lore
Share & tools
lore

Ivan Orlov

author
#0 lore raw

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
index 13a6837a0c6b..97dcdaa656f6 100644
@@ -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
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 · 6 lines
2.34.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
maintainer
#1 lore raw
Quoted 11 lines · Ivan Orlov

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.

Quoted 7 lines

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.

---

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