From: Andi Kleen <ak@linux.intel.com>
To: John Haxby <john.haxby@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Jonathan Corbet <corbet@lwn.net>,
x86@kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/1] x86/fpu: Allow clearcpuid= to clear several bits
Date: Wed, 22 Apr 2020 07:35:54 -0700 [thread overview]
Message-ID: <20200422143554.GI608746@tassilo.jf.intel.com> (raw)
In-Reply-To: <03a3a4d135b17115db9ad91413e21af73e244500.1587555769.git.john.haxby@oracle.com>
Thanks good catch.
> if (cmdline_find_option(boot_command_line, "clearcpuid", arg,
> - sizeof(arg)) &&
> - get_option(&argptr, &bit) &&
> - bit >= 0 &&
> - bit < NCAPINTS * 32)
> - setup_clear_cpu_cap(bit);
> + sizeof(arg))) {
> + /* cpuid bit numbers are mostly three digits */
> + enum { nints = sizeof(arg)/(3+1) + 1 };
Not sure what the digits have to do with the stack space of an int array.
We should have enough stack to afford some more than 8.
Would be good to have a warning if the arguments are longer.
Maybe it would be simpler to fix the early arg parser
to allow multiple instances again? That would also avoid the limit,
and keep everything compatible.
-Andi
> + int i, bits[nints];
> +
> + get_options(arg, nints, bits);
> + for (i = 1; i <= bits[0]; i++) {
> + if (bits[i] >= 0 && bits[i] < NCAPINTS * 32)
> + setup_clear_cpu_cap(bits[i]);
> + }
> + }
> }
>
> /*
> --
> 2.25.3
>
next prev parent reply other threads:[~2020-04-22 14:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 12:03 [PATCH 0/1] x86/fpu: Allow clearcpuid= to clear several bits John Haxby
2020-04-22 12:03 ` [PATCH 1/1] " John Haxby
2020-04-22 14:35 ` Andi Kleen [this message]
2020-04-22 15:21 ` John Haxby
2020-04-23 1:41 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422143554.GI608746@tassilo.jf.intel.com \
--to=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=hpa@zytor.com \
--cc=john.haxby@oracle.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).