[PATCH v6 5/9] kselftest/arm64/mte: check MTE_FAR feature is supported
Mark Brown
broonie at kernel.org
Wed Jun 11 04:52:04 PDT 2025
On Wed, Jun 11, 2025 at 10:41:03AM +0100, Yeoreum Yun wrote:
> --- a/tools/testing/selftests/arm64/mte/mte_common_util.c
> +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c
> @@ -6,6 +6,7 @@
> #include <signal.h>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <time.h>
> #include <unistd.h>
Not sure why we'd be including time.h here?
>
> #include <linux/auxvec.h>
> @@ -26,6 +27,7 @@
> #define INIT_BUFFER_SIZE 256
>
> struct mte_fault_cxt cur_mte_cxt;
> +bool mtefar_support;
This is a non-static variable so won't have a defined default value...
> @@ -273,6 +275,7 @@ void mte_initialize_current_context(int mode, uintptr_t ptr, ssize_t range)
> cur_mte_cxt.fault_valid = false;
> cur_mte_cxt.trig_addr = ptr;
> cur_mte_cxt.trig_range = range;
> +
> if (mode == MTE_SYNC_ERR)
> cur_mte_cxt.trig_si_code = SEGV_MTESERR;
> else if (mode == MTE_ASYNC_ERR)
Unrelated whitespace change.
> if (!(hwcaps2 & HWCAP2_MTE))
> ksft_exit_skip("MTE features unavailable\n");
>
> + if (hwcaps3 & HWCAP3_MTE_FAR)
> + mtefar_support = true;
> +
...this will only set mtefar_support if the hwcap is present, leaving it
undefined if not. If you just make this
mtefar_support = hwcap3 & HWCAP3_MTE_FAR
that should avoid the issue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250611/0a251147/attachment.sig>
More information about the linux-arm-kernel
mailing list