Commit 9a568171 authored by Mark Brown's avatar Mark Brown Committed by Catalin Marinas
Browse files

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: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220510164520.768783-2-broonie@kernel.org


Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent ae60e076
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -25,8 +25,11 @@ static int verify_mte_pointer_validity(char *ptr, int mode)
	/* Check the validity of the tagged pointer */
	memset((void *)ptr, '1', BUFFER_SIZE);
	mte_wait_after_trig();
	if (cur_mte_cxt.fault_valid)
	if (cur_mte_cxt.fault_valid) {
		ksft_print_msg("Unexpected fault recorded for %p-%p in mode %x\n",
			       ptr, ptr + BUFFER_SIZE, mode);
		return KSFT_FAIL;
	}
	/* Proceed further for nonzero tags */
	if (!MT_FETCH_TAG((uintptr_t)ptr))
		return KSFT_PASS;
@@ -34,11 +37,14 @@ static int verify_mte_pointer_validity(char *ptr, int mode)
	/* Check the validity outside the range */
	ptr[BUFFER_SIZE] = '2';
	mte_wait_after_trig();
	if (!cur_mte_cxt.fault_valid)
	if (!cur_mte_cxt.fault_valid) {
		ksft_print_msg("No valid fault recorded for %p in mode %x\n",
			       ptr, mode);
		return KSFT_FAIL;
	else
	} else {
		return KSFT_PASS;
	}
}

static int check_single_included_tags(int mem_type, int mode)
{