summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorTianyi Chen <hi@tychen.cc>2026-09-10 20:56:45 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-09-30 16:56:26 -0700
commit2481e4ab3c800ce2f19df0815984a7e2540c060e (patch)
tree46ae6d2131a6daf877b0237907ae96886d822897 /tools/testing/selftests
parent9d19adf70551cb51b812a4cab951cec162908e25 (diff)
downloadlinux-next-2481e4ab3c800ce2f19df0815984a7e2540c060e.tar.gz
linux-next-2481e4ab3c800ce2f19df0815984a7e2540c060e.zip
selftests/mm: only prepare ptrace_scope when memfd_secret is selected
The memfd_secret setup clears ptrace_scope whenever its test binary is executable, even when a different category was selected. run_test() filters the test invocation, but it does not protect the preceding setup. Check the category selection before entering the memfd_secret block so running unrelated categories does not change ptrace_scope. Keep the existing executable check and the behavior when memfd_secret is selected. Link: https://lore.kernel.org/20260910125645.285866-3-diannaaav@gmail.com Signed-off-by: Tianyi Chen <hi@tychen.cc> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Assisted-by: LLM Cc: Joel Savitz <jsavitz@redhat.com> Cc: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rwxr-xr-xtools/testing/selftests/mm/run_vmtests.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 9e62ab4c6775..9bbef9410ccc 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -370,7 +370,7 @@ CATEGORY="process_madv" run_test ./process_madv
CATEGORY="vma_merge" run_test ./merge
-if [ -x ./memfd_secret ]
+if test_selected "memfd_secret" && [ -x ./memfd_secret ]
then
if [ -f /proc/sys/kernel/yama/ptrace_scope ]; then
(echo 0 > /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix