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]
Message-ID: <87pncqnuum.fsf@nanos.tec.linutronix.de>
Date:   Thu, 02 Apr 2020 10:40:49 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Peter Xu <peterx@...hat.com>
Cc:     linux-kernel@...r.kernel.org, Ming Lei <ming.lei@...hat.com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Luiz Capitulino <lcapitulino@...hat.com>
Subject: Re: [PATCH] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters

Peter Xu <peterx@...hat.com> writes:
> On Thu, Apr 02, 2020 at 01:29:14AM +0200, Thomas Gleixner wrote:
>> Peter Xu <peterx@...hat.com> writes:
>> >> +		/*
>> >> +		 * Skip unknown sub-parameter and validate that it is not
>> >> +		 * containing an invalid character.
>> >> +		 */
>> >> +		for (par = str, len = 0; isalpha(*str); str++, len++);
>> >> +		if (*str != ',') {
>> >> +			pr_warn("isolcpus: Invalid flag %*s\n", len, par);
>> >
>> > ... this will dump "isolcpus: Invalid flag domain1,3,5", is this what
>> > we wanted?  Maybe only dumps "domain1"?
>> 
>> No, it will dump: "domain1" at least if my understanding of is_alpha()
>> and the '%*s' format option is halfways correct
>
> It will dump "isolcpus: Invalid flag domain1,3,5". Do you mean "%.*s"
> instead?

Obviously.

> Another issue is even if to use "%.*s" it'll only dump "domain".  How
> about something like (declare "illegal" as bool):
>
> 		/*
> 		 * Skip unknown sub-parameter and validate that it is not
> 		 * containing an invalid character.
> 		 */
> 		for (par = str, len = 0; *str && *str != ','; str++, len++)
> 			if (!isalpha(*str))
> 				illegal = true;
>
> 		if (illegal) {
> 			pr_warn("isolcpus: Invalid flag %.*s\n", len, par);

You can achieve the same thing without the illegal indirection with

	pr_warn("....", len + 1, par);

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ