lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aElNuX+ddy0xcBUj@e129823.arm.com>
Date: Wed, 11 Jun 2025 10:34:49 +0100
From: Yeoreum Yun <yeoreum.yun@....com>
To: Mark Brown <broonie@...nel.org>
Cc: catalin.marinas@....com, pcc@...gle.com, will@...nel.org,
	anshuman.khandual@....com, joey.gouly@....com,
	yury.khrustalev@....com, maz@...nel.org, oliver.upton@...ux.dev,
	frederic@...nel.org, shmeerali.kolothum.thodi@...wei.com,
	akpm@...ux-foundation.org, surenb@...gle.com,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org
Subject: Re: [PATCH v5 5/6] kselftest/arm64/mte: refactor check_mmap_option
 test

Hi Mark,

>
> > Before add mtefar testcase on check_mmap_option.c,
> > refactor check_mmap_option.
>
> Please describe the intended refactoring here.
>
> > +#define CHECK_ANON_MEM		0
> > +#define CHECK_FILE_MEM		1
> > +#define CHECK_CLEAR_PROT_MTE	2
> > +
>
> Perhaps use enums for this sort of thing?

Thank. I'll changed to enum.

>
> > +{
> > +	static char test_name[TEST_NAME_MAX];
> > +	const char* check_type_str;
>
> Coding style would usually be
>
> 	const char *check_type_str;
>

Sorry for my typo... :(

> > +	snprintf(test_name, TEST_NAME_MAX,
> > +	         "Check %s with %s mapping, %s mode, %s memory and %s\n",
> > +	         check_type_str, mapping_str, sync_str, mem_type_str, tag_check_str);
>
> sizeof(test_name).

Okay.

>
> >  	evaluate_test(check_anonymous_memory_mapping(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF),
> > -	"Check anonymous memory with private mapping, sync error mode, mmap memory and tag check off\n");
> > +		      format_test_name(CHECK_ANON_MEM, USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF));
>
> Looking at this I can't help but think that the more common pattern for
> test programs where we have an array of test parameters that we loop
> through might make sense:
>
> 	for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
> 		format_test_name(test_cases[i]);
>
> 		switch (test_cases[i].test_type) {
> 		case CHECK_ANON_MEM:
> 			check_anonymous_memory_mapping(USE_MMAP, ...);
>
> That seems a bit more legible and maintainable.
>
> >  	mte_disable_pstate_tco();
>
> The management of this could be added as a parameter in the test struct.

I see, I'll repsin and send it again.

Thanks!

--
Sincerely,
Yeoreum Yun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ