arm32 insecure W+X mapping

Fabio Estevam festevam at gmail.com
Mon Sep 20 17:21:53 PDT 2021


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>



More information about the linux-arm-kernel mailing list