lkml.org 
[lkml]   [2022]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 04/37] x86/cpufeatures: Enable CET CR4 bit for shadow stack
Date
On Mon, 2022-11-07 at 19:37 +0100, Borislav Petkov wrote:
> On Mon, Nov 07, 2022 at 06:19:48PM +0000, Edgecombe, Rick P wrote:
> > It was to catch if the software user shadow stack feature gets
> > disabled
> > at boot with the "clearcpuid" command.
>
> I don't understand. clearcpuid does setup_clear_cpu_cap() too. It
> would
> eventually clear the bit in boot_cpu_data.x86_capability's AFAICT.
>
> cpu_feature_enabled() looks at boot_cpu_data too.
>
> So what's the problem?

You are right, there actually is no problem. I thought the
apply_forced_caps() was happening too late, but it is not. So this
check you highlighted would not be needed if we kept the clearcpuid
method.

Thanks.

>
> Oh, and also, you've added that clearcpuid thing to the help docs.
> Please remove it. clearcpuid= taints the kernel and we've left it in
> because some of your colleagues really wanted it for testing or
> whatnot.
> But it is crap and it was on its way out at some point so we better
> not
> proliferate its use any more.
>
> > Is there a better way to do this?
>
> Yeah, cpu_feature_enabled() should be enough and if it isn't, then we
> need to fix it to be.
>
> Which reminds me, I'd need to take Maxim's patch too:
>
> https://lore.kernel.org/r/20220718141123.136106-3-mlevitsk@redhat.com
>
> as it is a simplification.
>
> > > Here you need to do
> > >
> > > setup_clear_cpu_cap(X86_FEATURE_IBT);
> > > setup_clear_cpu_cap(X86_FEATURE_SHSTK);
> >
> > This only gets called by kexec way after boot, as kexec is prepping
> > to
> > transition to the new kernel. Do we want to be clearing feature
> > bits at
> > that time?
>
> Hmm, I was under the impression you'll have the usual chicken bit
> "noshstk" which gets added with every big feature. So it'll call that
> thing here.

There was at one point, but there was a suggestion to remove in favor
of clearcpuid. I can add it back.
\
 
 \ /
  Last update: 2022-11-07 20:20    [W:0.122 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site