Skip to contentSkip to conversation

selftests-mm-fix-ptrace-peekdata-check-in-memfd_secret-test.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 9

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/mm: fix ptrace PEEKDATA check in memfd_secret test
has been removed from the -mm tree. Its filename was
selftests-mm-fix-ptrace-peekdata-check-in-memfd_secret-test.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Hongfu Li <[email protected]>
Subject: selftests/mm: fix ptrace PEEKDATA check in memfd_secret test
Date: Thu, 10 Sep 2026 14:44:15 +0800

try_ptrace() treats PTRACE_PEEKDATA return value as a boolean check. A successful read returns non-zero data (memory filled with 0x55), causing the test to incorrectly report PASS when secret memory protection is broken.

Check the return value against -1 instead. The test should only pass when PTRACE_PEEKDATA fails, which means secret memory protection works.

Fixes 76fe17ef588a ("secretmem: test: add basic selftest for memfd_secret(2)")
Cc David Hildenbrand <[email protected]>
Cc James Bottomley <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 tools/testing/selftests/mm/memfd_secret.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/memfd_secret.c renamed from tools/testing/selftests/mm/memfd_secret.c~selftests-mm-fix-ptrace-peekdata-check-in-memfd_secret-test +2 -1
@@ -145,7 +145,8 @@ static void try_ptrace(int fd, int pipef
 		exit(KSFT_FAIL);
 	}
 
-	if (ptrace(PTRACE_PEEKDATA, ppid, mem, 0))
+	/* PEEKDATA on secret memory must fail, else protection is broken. */
+	if (ptrace(PTRACE_PEEKDATA, ppid, mem, 0) == -1)
 		exit(KSFT_PASS);
 
 	exit(KSFT_FAIL);

_

Patches currently in -mm which might be from [email protected] are

mm-hugetlb_cgroup-move-per-node-usage-on-cross-node-migration.patch mm-hugetlb_cgroup-move-per-node-usage-on-cgroup-reparenting.patch mm-hugetlb-account-migration-target-folio-in-per-node-nr_hugetlb-vmstat.patch mm-memcg-migrate-per-node-hugetlb-lruvec-stat-together-with-hugetlb-folio.patch mm-memfd-fix-hugetlb-reservation-accounting-in-error-paths.patch