[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241209095019.1732120-1-kevin.brodsky@arm.com>
Date: Mon, 9 Dec 2024 09:50:05 +0000
From: Kevin Brodsky <kevin.brodsky@....com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
Kevin Brodsky <kevin.brodsky@....com>,
akpm@...ux-foundation.org,
aruna.ramakrishna@...cle.com,
catalin.marinas@....com,
dave.hansen@...ux.intel.com,
joey.gouly@....com,
keith.lucas@...cle.com,
ryan.roberts@....com,
shuah@...nel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kselftest@...r.kernel.org,
x86@...nel.org
Subject: [PATCH 00/14] pkeys kselftests improvements
This series brings various cleanups and fixes for the mm (mostly
pkeys) kselftests. The original goal was to make the pkeys tests work
out of the box and without build warning - it turned out to be more
involved than expected.
The most important change is enabling -O2 when building all mm
kselftests (patch 5). This is actually needed for the pkeys tests to run
successfully (see gcc command line at the top of protection_keys.c and
pkey_sighandler_tests.c), and seems to have no negative impact on the
other tests. It certainly can't hurt performance!
The following patches address a few obvious issues in the pkeys tests
(unused code, bad scope for functions/variables, etc.) and finally make
a couple of small improvements.
There is one ugliness that this series does not fix: some functions in
pkey-<arch>.h call functions that are actually defined in
protection_keys.c. For instance, expect_fault_on_read_execonly_key() in
pkey-x86.h calls expected_pkey_fault(). This means that other test
programs that use pkey-helpers.h (namely pkey_sighandler_tests) would
fail to link if they called such functions defined in pkey-<arch>.h.
Fixing this would require a more comprehensive reorganisation of the
pkey-* headers, which doesn't seem worth it (patch 9 adds a comment to
pkey-helpers.h to clarify the situation).
Some more details on the patches:
- Patch 1 is an unrelated fix that was revealed by inspecting a warning.
It seems fairly harmless though, so I thought I'd just post it as part
of this series.
- Patch 2-5 fix various warnings that come up by building the mm tests
at -O2 and finally enable -O2.
- Patch 6-12 are various cleanups for the pkeys tests. Patch 11 in
particular enables is_pkeys_supported() to be called from outside
protection_keys.c (patch 13 relies on this).
- Patch 13-14 are small improvements to pkey_sighandler_tests.c.
Many thanks to Ryan Roberts for checking that the mm tests still run
fine on arm64 with those patches applied. I've also checked that the
pkeys tests run fine on arm64 and x86.
- Kevin
---
Cc: akpm@...ux-foundation.org
Cc: aruna.ramakrishna@...cle.com
Cc: catalin.marinas@....com
Cc: dave.hansen@...ux.intel.com
Cc: joey.gouly@....com
Cc: keith.lucas@...cle.com
Cc: ryan.roberts@....com
Cc: shuah@...nel.org
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linux-kselftest@...r.kernel.org
Cc: x86@...nel.org
---
Kevin Brodsky (14):
selftests/mm: Fix condition in uffd_move_test_common()
selftests/mm: Fix -Wmaybe-uninitialized warnings
selftests/mm: Fix strncpy() length
selftests/mm: Fix -Warray-bounds warnings in pkey_sighandler_tests
selftests/mm: Build with -O2
selftests/mm: Remove unused pkey helpers
selftests/mm: Define types using typedef in pkey-helpers.h
selftests/mm: Ensure pkey-*.h define inline functions only
selftests/mm: Remove empty pkey helper definition
selftests/mm: Ensure non-global pkey symbols are marked static
selftests/mm: Use sys_pkey helpers consistently
selftests/mm: Rename pkey register macro
selftests/mm: Skip pkey_sighandler_tests if support is missing
selftests/mm: Remove X permission from sigaltstack mapping
tools/testing/selftests/mm/Makefile | 6 +-
tools/testing/selftests/mm/ksm_tests.c | 2 +-
tools/testing/selftests/mm/mremap_test.c | 2 +-
tools/testing/selftests/mm/pkey-arm64.h | 6 +-
tools/testing/selftests/mm/pkey-helpers.h | 61 ++---
tools/testing/selftests/mm/pkey-powerpc.h | 4 +-
tools/testing/selftests/mm/pkey-x86.h | 6 +-
.../selftests/mm/pkey_sighandler_tests.c | 32 +--
tools/testing/selftests/mm/pkey_util.c | 40 ++++
tools/testing/selftests/mm/protection_keys.c | 212 +++++++-----------
tools/testing/selftests/mm/soft-dirty.c | 2 +-
tools/testing/selftests/mm/uffd-unit-tests.c | 4 +-
.../testing/selftests/mm/write_to_hugetlbfs.c | 2 +-
13 files changed, 163 insertions(+), 216 deletions(-)
create mode 100644 tools/testing/selftests/mm/pkey_util.c
--
2.47.0
Powered by blists - more mailing lists