run_vmtests.sh can reach test setup after invalid options or category selections. Its memfd_secret preparation can also change ptrace_scope when that category was not selected.
Patch 1 rejects invalid selections before setup, using the category list in usage(). Patch 2 gates memfd_secret preparation on category selection and executable presence. I am resending from my Gmail address after delivery problems with my previous address. I could not confirm delivery of the earlier v3 posting. This series is rebased onto current mm-unstable; both patches are unchanged from v3 according to range-diff. Neither fix is present in current mm-unstable, mm-stable or mainline. Changes in v3: - Initialize VM_SELFTEST_ITEMS to "default" before getopts, as David suggested. Only -t changes the selection. - Use Assisted-by: LLM in both patches. - Add David's Acked-by to patch 2, whose code is unchanged from v2. Validation after rebasing: - Bash syntax, whitespace and checkpatch checks passed. - Ten invalid option/category invocations and help passed before setup. - Rebuilt the four focused test binaries and ran the rebased script in an x86-64 KVM guest. mmap, memfd_secret, combined selections, tab/newline separators and repeated -t with the final selection taking effect all passed. - The guest lacks Yama. The ptrace_scope write condition was checked with a disposable file at the expected path, not Yama policy enforcement. This is focused validation, not a run of the complete MM selftest suite. v2: https://lore.kernel.org/r/[email protected] Tianyi Chen (2): selftests/mm: Reject invalid test selections before running tests selftests/mm: Only prepare ptrace_scope when memfd_secret is selected

