mbox series

[v1,0/5] selftests/arm64: MTE check_tags_inclusion cleanups

Message ID 20220510164520.768783-1-broonie@kernel.org
Headers show
Series selftests/arm64: MTE check_tags_inclusion cleanups | expand

Message

Mark Brown May 10, 2022, 4:45 p.m. UTC
This series contains some random cleanups and improvements that I came
up with while looking at the check_tags_inclusion test.  There's nothing
too exciting in here but the changes did seem like they might help the
next person to look at this.

Mark Brown (5):
  selftests/arm64: Log errors in verify_mte_pointer_validity()
  selftests/arm64: Allow zero tags in mte_switch_mode()
  selftests/arm64: Check failures to set tags in check_tags_inclusion
  selftests/arm64: Remove casts to/from void in check_tags_inclusion
  selftests/arm64: Use switch statements in mte_common_util.c

 .../arm64/mte/check_tags_inclusion.c          | 54 +++++++++++--------
 .../selftests/arm64/mte/mte_common_util.c     | 25 ++++++---
 2 files changed, 50 insertions(+), 29 deletions(-)


base-commit: ae60e0763e97e977b03af1ac6ba782a4a86c3a5a

Comments

Shuah Khan May 10, 2022, 5:17 p.m. UTC | #1
On 5/10/22 10:45 AM, Mark Brown wrote:
> mte_switch_mode() currently rejects attempts to set a zero tag however
> there are tests such as check_tags_inclusion which attempt to cover cases
> with zero tags using mte_switch_mode(). Since it is not clear why we are
> rejecting zero tags change the test to accept them.
> 
> The issue has not previously been as apparent as it should be since the
> return value of mte_switch_mode() was not always checked in the callers
> and the tests weren't otherwise failing.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>   tools/testing/selftests/arm64/mte/mte_common_util.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c
> index 260206f4dce0..6ff4c4bcbff1 100644
> --- a/tools/testing/selftests/arm64/mte/mte_common_util.c
> +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c
> @@ -283,7 +283,7 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask)
>   		return -EINVAL;
>   	}
>   
> -	if (!(incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) {
> +	if (incl_mask & ~MT_INCLUDE_TAG_MASK) {
>   		ksft_print_msg("FAIL: Invalid incl_mask %lx\n", incl_mask);
>   		return -EINVAL;
>   	}
> 

Looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
Catalin Marinas May 15, 2022, 10:45 a.m. UTC | #2
On Tue, 10 May 2022 17:45:15 +0100, Mark Brown wrote:
> This series contains some random cleanups and improvements that I came
> up with while looking at the check_tags_inclusion test.  There's nothing
> too exciting in here but the changes did seem like they might help the
> next person to look at this.
> 
> Mark Brown (5):
>   selftests/arm64: Log errors in verify_mte_pointer_validity()
>   selftests/arm64: Allow zero tags in mte_switch_mode()
>   selftests/arm64: Check failures to set tags in check_tags_inclusion
>   selftests/arm64: Remove casts to/from void in check_tags_inclusion
>   selftests/arm64: Use switch statements in mte_common_util.c
> 
> [...]

Applied to arm64 (for-next/kselftest), thanks!

[1/5] selftests/arm64: Log errors in verify_mte_pointer_validity()
      https://git.kernel.org/arm64/c/9a5681710740
[2/5] selftests/arm64: Allow zero tags in mte_switch_mode()
      https://git.kernel.org/arm64/c/ffc8274c2193
[3/5] selftests/arm64: Check failures to set tags in check_tags_inclusion
      https://git.kernel.org/arm64/c/72d6771cb173
[4/5] selftests/arm64: Remove casts to/from void in check_tags_inclusion
      https://git.kernel.org/arm64/c/541235dee011
[5/5] selftests/arm64: Use switch statements in mte_common_util.c
      https://git.kernel.org/arm64/c/0639e02254e6