[PATCH v6 9/9] kselftest/arm64/mte: add mtefar tests on check_mmap_options

Yeoreum Yun yeoreum.yun at arm.com
Wed Jun 11 06:34:28 PDT 2025


Hi Mark,
> On Wed, Jun 11, 2025 at 10:41:07AM +0100, Yeoreum Yun wrote:
>
> > +static int check_anonymous_memory_mapping(int mem_type, int mode, int mapping, int tag_check, int atag_check)
> >  {
> >  	char *ptr, *map_ptr;
> >  	int run, result, map_size;
> > @@ -97,16 +106,16 @@ static int check_anonymous_memory_mapping(int mem_type, int mode, int mapping, i
> >  			munmap((void *)map_ptr, map_size);
> >  			return KSFT_FAIL;
> >  		}
> > -		result = check_mte_memory(ptr, sizes[run], mode, tag_check);
> > +		result = check_mte_memory(ptr, sizes[run], mode, tag_check, atag_check);
> >  		mte_clear_tags((void *)ptr, sizes[run]);
> >  		mte_free_memory((void *)map_ptr, map_size, mem_type, false);
> > -		if (result == KSFT_FAIL)
> > -			return KSFT_FAIL;
> > +		if (result != KSFT_SKIP)
> > +			return result;
> >  	}
>
> This changes the logic to exit the loop immediately if the check passes
> which doesn't seem like what we want, should we instead change the test
> to be:
>
> 	if (result != KSFT_PASS)
>
> which I think is more the intent?

Well, at the time of write, when the check_mte_memory return the "SKIP"
intent is to iterating the next item. But, yes this is meandingless.
I'll change with your suggestion.

>
> > +		result = check_mte_memory(ptr, sizes[run], mode, TAG_CHECK_ON, atag_check);
> >  		mte_free_memory_tag_range((void *)ptr, sizes[run], mem_type, UNDERFLOW, OVERFLOW);
> >  		if (result != KSFT_PASS)
> >  			return KSFT_FAIL;
> > @@ -192,7 +201,7 @@ static int check_clear_prot_mte_flag(int mem_type, int mode, int mapping)
> >  			close(fd);
> >  			return KSFT_FAIL;
> >  		}
>
> Won't this upgrade any skips to fails?

Right. I'll change this.

Thanks!


--
Sincerely,
Yeoreum Yun



More information about the linux-arm-kernel mailing list