Re: [PATCH] x86/asm: Pin sensitive CR4 bits

From: Kees Cook
Date: Wed Feb 20 2019 - 12:01:44 EST


On Wed, Feb 20, 2019 at 12:15 AM Dominik Brodowski
<linux@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Feb 19, 2019 at 04:54:49PM -0800, Kees Cook wrote:
> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > index cb28e98a0659..7e0ea4470f8e 100644
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -312,10 +312,16 @@ static __init int setup_disable_smep(char *arg)
> > }
> > __setup("nosmep", setup_disable_smep);
> >
> > +volatile unsigned long cr4_pin __ro_after_init;
> > +EXPORT_SYMBOL_GPL(cr4_pin);
>
> Where is this export needed?

I use it in lkdtm (which I was going to land through the drivers tree,
but I haven't sent to Greg):

https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=kspp/x86/cr4

--
Kees Cook