Skip to content

Commit 0c69bd2

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: pac: Fix skipping of tests on systems without PAC
The PAC tests check to see if the system supports the relevant PAC features but instead of skipping the tests if they can't be executed they fail the tests which makes things look like they're not working when they are. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 83e5dcb commit 0c69bd2

File tree

1 file changed

+6
-4
lines changed
  • tools/testing/selftests/arm64/pauth

1 file changed

+6
-4
lines changed

tools/testing/selftests/arm64/pauth/pac.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
do { \
2626
unsigned long hwcaps = getauxval(AT_HWCAP); \
2727
/* data key instructions are not in NOP space. This prevents a SIGILL */ \
28-
ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled"); \
28+
if (!(hwcaps & HWCAP_PACA)) \
29+
SKIP(return, "PAUTH not enabled"); \
2930
} while (0)
3031
#define ASSERT_GENERIC_PAUTH_ENABLED() \
3132
do { \
3233
unsigned long hwcaps = getauxval(AT_HWCAP); \
3334
/* generic key instructions are not in NOP space. This prevents a SIGILL */ \
34-
ASSERT_NE(0, hwcaps & HWCAP_PACG) TH_LOG("Generic PAUTH not enabled"); \
35+
if (!(hwcaps & HWCAP_PACG)) \
36+
SKIP(return, "Generic PAUTH not enabled"); \
3537
} while (0)
3638

3739
void sign_specific(struct signatures *sign, size_t val)
@@ -256,7 +258,7 @@ TEST(single_thread_different_keys)
256258
unsigned long hwcaps = getauxval(AT_HWCAP);
257259

258260
/* generic and data key instructions are not in NOP space. This prevents a SIGILL */
259-
ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled");
261+
ASSERT_PAUTH_ENABLED();
260262
if (!(hwcaps & HWCAP_PACG)) {
261263
TH_LOG("WARNING: Generic PAUTH not enabled. Skipping generic key checks");
262264
nkeys = NKEYS - 1;
@@ -299,7 +301,7 @@ TEST(exec_changed_keys)
299301
unsigned long hwcaps = getauxval(AT_HWCAP);
300302

301303
/* generic and data key instructions are not in NOP space. This prevents a SIGILL */
302-
ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled");
304+
ASSERT_PAUTH_ENABLED();
303305
if (!(hwcaps & HWCAP_PACG)) {
304306
TH_LOG("WARNING: Generic PAUTH not enabled. Skipping generic key checks");
305307
nkeys = NKEYS - 1;

0 commit comments

Comments
 (0)