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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Nov 2023 15:50:49 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC:     <linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
        Shaopeng Tan <tan.shaopeng@...fujitsu.com>,
        Maciej Wieczór-Retman 
        <maciej.wieczor-retman@...el.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 18/24] selftests/resctrl: Introduce generalized test
 framework

Hi Ilpo,

On 11/3/2023 2:54 AM, Ilpo Järvinen wrote:
> On Thu, 2 Nov 2023, Reinette Chatre wrote:
>> On 10/24/2023 2:26 AM, Ilpo Järvinen wrote:
>> ...
>>> diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
>>> index ec6efd36f60a..e017adf1390d 100644
>>
>>> @@ -233,25 +183,26 @@ int main(int argc, char **argv)
>>>  		case 't':
>>>  			token = strtok(optarg, ",");
>>>  
>>> -			mbm_test = false;
>>> -			mba_test = false;
>>> -			cmt_test = false;
>>> -			cat_test = false;
>>> +			if (!test_param_seen) {
>>> +				for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++)
>>> +					resctrl_tests[i]->disabled = true;
>>> +				tests = 0;
>>> +				test_param_seen = true;
>>> +			}
>>>  			while (token) {
>>> -				if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) {
>>> -					mbm_test = true;
>>> -					tests++;
>>> -				} else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) {
>>> -					mba_test = true;
>>> -					tests++;
>>> -				} else if (!strncmp(token, CMT_STR, sizeof(CMT_STR))) {
>>> -					cmt_test = true;
>>> -					tests++;
>>> -				} else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) {
>>> -					cat_test = true;
>>> -					tests++;
>>> -				} else {
>>> -					printf("invalid argument\n");
>>> +				bool found = false;
>>> +
>>> +				for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) {
>>> +					if (!strcasecmp(token, resctrl_tests[i]->name)) {
>>> +						if (resctrl_tests[i]->disabled)
>>> +							tests++;
>>> +						resctrl_tests[i]->disabled = false;
>>> +						found = true;
>>> +					}
>>> +				}
>>
>> Could providing multiple "-t" result in the test count not
>> matching the number of tests run?
> 
> bool test_param_seen covers the case with more than one -t parameter.
> Because of it, the code above resets tests and ->disabled only when the 
> first -t is encountered. tests++ is only done when ->disabled is set from 
> true to false.
> 
> I don't see how they could get out of sync but if you had a more specific 
> case in mind, just let me know.
> 

Thank you for your detailed explanation. I can now see how this is safeguarded.

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ