[PATCH v14 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

Jordan Niethe jniethe5 at gmail.com
Thu May 20 13:50:39 AEST 2021


On Mon, May 17, 2021 at 4:49 PM Christophe Leroy
<christophe.leroy at csgroup.eu> wrote:
>
>
>
> Le 17/05/2021 à 05:28, Jordan Niethe a écrit :
> > From: Russell Currey <ruscur at russell.cc>
> >
> > To enable strict module RWX on powerpc, set:
> >
> >      CONFIG_STRICT_MODULE_RWX=y
> >
> > You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real
> > security benefit.
> >
> > ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX.
> > This is due to a quirk in arch/Kconfig and arch/powerpc/Kconfig that
> > makes STRICT_MODULE_RWX *on by default* in configurations where
> > STRICT_KERNEL_RWX is *unavailable*.
> >
> > Since this doesn't make much sense, and module RWX without kernel RWX
> > doesn't make much sense, having the same dependencies as kernel RWX
> > works around this problem.
> >
> > Book32s/32 processors with a hash mmu (i.e. 604 core) can not set memory
>    ^^^^^^
>
> Book32s ==> Book3s
Thanks.
>
> > protection on a page by page basis so do not enable.
>
> It is not exactly that. The problem on 604 is for _exec_ protection.
Right.
>
> Note that on book3s/32, on both 603 and 604 core, it is not possible to write protect kernel pages.
> So maybe it would make sense to disable ARCH_HAS_STRICT_MODULE_RWX on CONFIG_PPC_BOOK3S_32
> completely, I'm not sure.
Yeah, that does seem like it would make sense to disable it.
>
>
> >
> > Signed-off-by: Russell Currey <ruscur at russell.cc>
> > [jpn: - predicate on !PPC_BOOK3S_604
> >        - make module_alloc() use PAGE_KERNEL protection]
> > Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
>
> Reviewed-by: Christophe Leroy <christophe.leroy at csgroup.eu>
>
> > ---
> > v10: - Predicate on !PPC_BOOK3S_604
> >       - Make module_alloc() use PAGE_KERNEL protection
> > v11: - Neaten up
> > v13: Use strict_kernel_rwx_enabled()
> > v14: Make changes to module_alloc() its own commit
> > ---
> >   arch/powerpc/Kconfig | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index cce0a137b046..cb5d9d862c35 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -140,6 +140,7 @@ config PPC
> >       select ARCH_HAS_SCALED_CPUTIME          if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
> >       select ARCH_HAS_SET_MEMORY
> >       select ARCH_HAS_STRICT_KERNEL_RWX       if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
> > +     select ARCH_HAS_STRICT_MODULE_RWX       if ARCH_HAS_STRICT_KERNEL_RWX && !PPC_BOOK3S_604
> >       select ARCH_HAS_TICK_BROADCAST          if GENERIC_CLOCKEVENTS_BROADCAST
> >       select ARCH_HAS_UACCESS_FLUSHCACHE
> >       select ARCH_HAS_COPY_MC                 if PPC64
> >


More information about the Linuxppc-dev mailing list