Skip to content

selftests: powerpc: Fixes and execute-disable test for pkeys

Sandipan Das linux-kselftest linux-mm linuxppc-dev 1 version Applied

Status from this message: Applied to powerpc/next.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest3 patches 1 replyApplied

Changes in v3 from the cover letter

- Fixed AMR writes for existing pkey tests (new patch).
- Moved Hash MMU check under utilities (new patch) and removed duplicate code.
- Fixed comments on why the pkey permission bits were redefined.
- Switched to existing mfspr() macro for reading AMR.
- Switched to sig_atomic_t as data type for variables updated in the signal handlers.
- Switched to exit()-ing if the signal handlers come across an unexpected condition instead of trying to reset page and pkey permissions.
- Switched to write() from printf() for printing error messages from the signal handlers.
- Switched to getpagesize().
- Renamed fault counter to denote remaining faults.
- Dropped unnecessary randomization for choosing an address to fault at.
- Added additional information on change in permissions due to AMR and IAMR bits in comments.
- Switched the first instruction word of the executable region to a trap to test if it is actually overwritten by a no-op later.
- Added an new test scenario where the pkey imposes no restrictions and an attempt is made to jump to the executable region again.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3selftests: powerpc: Fix pkey access right updatestools/testing/selftests/powerpc/include/reg.h tools/testing/selftests/powerpc/ptrace/core-pkey.c tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c+8 -20 replies
2/3selftests: powerpc: Move Hash MMU check to utilitiestools/testing/selftests/powerpc/include/utils.h tools/testing/selftests/powerpc/mm/Makefile tools/testing/selftests/powerpc/mm/bad_accesses.c +1 more+30 -290 replies
3/3selftests: powerpc: Add test for execute-disabled pkeystools/testing/selftests/powerpc/mm/.gitignore tools/testing/selftests/powerpc/mm/Makefile tools/testing/selftests/powerpc/mm/pkey_exec_prot.c+391 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] selftests: powerpc: Fixes and execute-disable test for pkeys

This fixes the way the Authority Mask Register (AMR) is updated by the existing pkey tests and adds a new test to verify the functionality of execute-disabled pkeys.

Previous versions can be found at:
v2: https://lore.kernel.org/linuxppc-dev/[email protected]/
v1: https://lore.kernel.org/linuxppc-dev/[email protected]/

Changes in v3:
- Fixed AMR writes for existing pkey tests (new patch).
- Moved Hash MMU check under utilities (new patch) and removed duplicate code.
- Fixed comments on why the pkey permission bits were redefined.
- Switched to existing mfspr() macro for reading AMR.
- Switched to sig_atomic_t as data type for variables updated in the signal handlers.
- Switched to exit()-ing if the signal handlers come across an unexpected condition instead of trying to reset page and pkey permissions.
- Switched to write() from printf() for printing error messages from the signal handlers.
- Switched to getpagesize().
- Renamed fault counter to denote remaining faults.
- Dropped unnecessary randomization for choosing an address to fault at.
- Added additional information on change in permissions due to AMR and IAMR bits in comments.
- Switched the first instruction word of the executable region to a trap to test if it is actually overwritten by a no-op later.
- Added an new test scenario where the pkey imposes no restrictions and an attempt is made to jump to the executable region again.

Changes in v2:
- Added .gitignore entry for test binary.
- Fixed builds for older distros where siginfo_t might not have si_pkey as a formal member based on discussion with Michael.

Sandipan Das (3):
selftests: powerpc: Fix pkey access right updates
selftests: powerpc: Move Hash MMU check to utilities
selftests: powerpc: Add test for execute-disabled pkeys

 tools/testing/selftests/powerpc/include/reg.h |   6 +
 .../testing/selftests/powerpc/include/utils.h |   1 +
 tools/testing/selftests/powerpc/mm/.gitignore |   1 +
 tools/testing/selftests/powerpc/mm/Makefile   |   5 +-
 .../selftests/powerpc/mm/bad_accesses.c       |  28 --
 .../selftests/powerpc/mm/pkey_exec_prot.c     | 388 ++++++++++++++++++
 .../selftests/powerpc/ptrace/core-pkey.c      |   2 +-
 .../selftests/powerpc/ptrace/ptrace-pkey.c    |   2 +-
 tools/testing/selftests/powerpc/utils.c       |  28 ++
 9 files changed, 429 insertions(+), 32 deletions(-)
 create mode 100644 tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
Signature · 1 line
2.25.1