Skip to content

Commit 9a56817

Browse files
brooniectmarinas
authored andcommitted
selftests/arm64: Log errors in verify_mte_pointer_validity()
When we detect a problem in verify_mte_pointer_validity() while checking tags we don't log what the problem was which makes debugging harder. Add some diagnostics. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent ae60e07 commit 9a56817

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tools/testing/selftests/arm64/mte/check_tags_inclusion.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,25 @@ static int verify_mte_pointer_validity(char *ptr, int mode)
2525
/* Check the validity of the tagged pointer */
2626
memset((void *)ptr, '1', BUFFER_SIZE);
2727
mte_wait_after_trig();
28-
if (cur_mte_cxt.fault_valid)
28+
if (cur_mte_cxt.fault_valid) {
29+
ksft_print_msg("Unexpected fault recorded for %p-%p in mode %x\n",
30+
ptr, ptr + BUFFER_SIZE, mode);
2931
return KSFT_FAIL;
32+
}
3033
/* Proceed further for nonzero tags */
3134
if (!MT_FETCH_TAG((uintptr_t)ptr))
3235
return KSFT_PASS;
3336
mte_initialize_current_context(mode, (uintptr_t)ptr, BUFFER_SIZE + 1);
3437
/* Check the validity outside the range */
3538
ptr[BUFFER_SIZE] = '2';
3639
mte_wait_after_trig();
37-
if (!cur_mte_cxt.fault_valid)
40+
if (!cur_mte_cxt.fault_valid) {
41+
ksft_print_msg("No valid fault recorded for %p in mode %x\n",
42+
ptr, mode);
3843
return KSFT_FAIL;
39-
else
44+
} else {
4045
return KSFT_PASS;
46+
}
4147
}
4248

4349
static int check_single_included_tags(int mem_type, int mode)

0 commit comments

Comments
 (0)