Re: [RFC/RFT PATCH 2/5] memblock: introduce generic memblock_setup_resources()

From: Mike Rapoport
Date: Thu Jun 03 2021 - 06:32:22 EST


On Wed, Jun 02, 2021 at 09:15:02PM +0100, Russell King (Oracle) wrote:
> On Wed, Jun 02, 2021 at 09:43:32PM +0300, Mike Rapoport wrote:
> > Back then when __ex_table was moved from .data section, _sdata and _edata
> > were part of the .data section. Today they are not. So something like the
> > patch below will ensure for instance that __ex_table would be a part of
> > "Kernel data" in /proc/iomem without moving it to the .data section:
> >
> This example has undesirable security implications. It moves the
> exception table out of the read-only mappings into the read-write
> mappings, thereby providing a way for an attacker to bypass the
> read-only protection on the kernel and manipulate code pointers at
> potentially known addresses for distro built kernels.

My point was that __ex_table can be in "Kernel data" or "Kernel rodata"
without loosing the ability to sort it.

> You seem to be missing the point I've tried to make. The areas in
> memblock that are marked "reserved" are the areas of reserved memory
> from the firmware _plus_ the areas that the kernel has made during
> boot which are of no consequence to userspace.

I know what areas are marked "reserved" in memblock.
I never suggested to report "ficticious" reserved areas in /proc/iomem
unless an architecture already reports them there, like arm64 for example.

You are right I should have described better the overall objective, but
sill I feel that we keep missing each other points.

I'll update the descriptions for the next repost, hopefully it'll help.

--
Sincerely yours,
Mike.