Re: [PATCH v2 2/2] selftests/mm: Only prepare ptrace_scope when memfd_secret is selected
From: David Hildenbrand (Arm)
Date: Tue Sep 08 2026 - 07:03:33 EST
On 9/8/26 11:55, Tianyi Chen wrote:
> 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.
>
> Assisted-by: Codex:GPT-6
We prefer
Assisted-by: LLM
now
> Signed-off-by: Tianyi Chen <hi@xxxxxxxxx>
> ---
> tools/testing/selftests/mm/run_vmtests.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
> index 836c7454cba..9932df252f4 100755
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -371,7 +371,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
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David