Re: [GIT PULL] x86/topology changes for v5.3

From: Xi Ruoyao
Date: Wed Jul 10 2019 - 10:46:40 EST


On 2019-07-10 16:22 +0200, Jiri Kosina wrote:
> On Wed, 10 Jul 2019, Peter Zijlstra wrote:
>
> > If we mark the key as RO after init, and then try and modify the key to
> > link module usage sites, things might go bang as described.
> >
> > Thanks!
> >
> >
> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > index 27d7864e7252..5bf7a8354da2 100644
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -366,7 +366,7 @@ static __always_inline void setup_umip(struct
> > cpuinfo_x86 *c)
> > cr4_clear_bits(X86_CR4_UMIP);
> > }
> >
> > -DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
> > +DEFINE_STATIC_KEY_FALSE(cr_pinning);
>
> Good catch, I guess that is going to fix it.

Yes it works.

> At the same time though, it sort of destroys the original intent of Kees'
> patch, right? The exploits will just have to call static_key_disable()
> prior to calling native_write_cr4() again, and the protection is gone.

I think I should do some study and try to understand the full story of Kees'
change...
--
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University