selftests/mm: two fixes for the pfnmap test
authorDavid Hildenbrand <david@redhat.com>
Wed, 28 May 2025 19:52:44 +0000 (21:52 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 1 Jun 2025 05:46:14 +0000 (22:46 -0700)
commitbb084994d38fd36518ac50a33c8ddcea2239067e
tree850a4413251d7b8ee8c1841ef246f7fe3a793d1f
parent595cf683519ab5a277d258a2251ee8cc7b838d6d
selftests/mm: two fixes for the pfnmap test

When unregistering the signal handler, we have to pass SIG_DFL, and
blindly reading from PFN 0 and PFN 1 seems to be problematic on !x86
systems.  In particularly, on arm64 tx2 machines where noting resides at
these physical memory locations, we can generate RAS errors.

Let's fix it by scanning /proc/iomem for actual "System RAM".

Link: https://lkml.kernel.org/r/20250528195244.1182810-1-david@redhat.com
Fixes: 2616b370323a ("selftests/mm: add simple VM_PFNMAP tests based on mmap'ing /dev/mem")
Signed-off-by: David Hildenbrand <david@redhat.com>
Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Closes: https://lore.kernel.org/all/232960c2-81db-47ca-a337-38c4bce5f997@arm.com/T/#u
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Tested-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/pfnmap.c