arm32 insecure W+X mapping

Russell King (Oracle) linux at armlinux.org.uk
Tue Sep 21 08:13:46 PDT 2021


On Mon, Sep 20, 2021 at 09:21:53PM -0300, Fabio Estevam wrote:
> Hi Russell,
> 
> On Mon, Sep 20, 2021 at 8:19 PM Russell King (Oracle)
> <linux at armlinux.org.uk> wrote:
> 
> > I think what I'd like to see is a wrapper around set_memory_ro() that
> > gets passed the __iomem pointer and size. change_memory_common()
> > should accept it as the ioremap() will be located in the vmalloc
> > area which change_memory_common() accepts.
> >
> > Probably something like:
> >
> > void __arm_iomem_set_ro(void __iomem *ptr, size_t size)
> > {
> >         set_memory_ro((unsigned long)ptr, PAGE_ALIGN(size) / PAGE_SIZE);
> > }
> >
> > in arch/arm/mm/ioremap.c would be nice, just after __arm_ioremap_exec().
> > I've probably just written the patch in wordy words. :) Something like
> > this (untested):
> 
> Just tested your patch and DEBUG_WX is happy now:
> 
> [    5.610346] Checked W+X mappings: passed, no W+X pages found
> 
> Thanks a lot, appreciate it!
> 
> Tested-by: Fabio Estevam <festevam at gmail.com>

Thanks, I've split the patch into two parts - one for generic ARM bits
and the other touching imx6 bits. They'll probably be in linux-next
this evening. I would like an Ack from Shawn on the imx6 part of the
patch before I sent it to Linus at the next merge window.

At some point, I will be rebuilding my "misc" branch - I've just thrown
a bunch of commits on top of the 5.14-rc based branch from the last
cycle as a temporary measure.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list