[QUERY]: Block region to mmap

Matthew Wilcox willy at infradead.org
Mon Jan 30 07:24:40 PST 2023


On Mon, Jan 30, 2023 at 10:53:28AM +0000, Lad, Prabhakar wrote:
> > > To avoid this the ILM/DLM memory regions are now added to the root
> > > domain region of the PMPU with permissions set to 0x0 for S/U modes so
> > > that any access to these regions gets blocked and for M-mode we grant
> > > full access (R/W/X). This prevents any users from accessing these
> > > regions by triggering an unhandled signal 11 in S/U modes.
> >
> > I have no idea what any of this means.
> >
> Basically we are making use of the memory protection unit (MPU) so
> that only M-mode is allowed to access this region and S/U modes are
> blocked.

This sounds like RISC-V terminology.  I have no idea what M, S or U
modes are (Supervisor and User, I'd guess for the last two?)

> > > This works as expected but for applications say for example when doing
> > > mmap to this region would still succeed and later down the path when
> > > doing a read/write to this location would cause unhandled signal 11.
> > > To handle this case gracefully we might want mmap() itself to fail if
> > > the addr/offset falls in this local memory region.
> >
> > No, that's not what you want.  You want mmap to avoid allocating address
> > space in that virtual address range.  I don't know if we have a good
> > way to do that at the moment; like I said I've never seen such broken
> > hardware before.
> >
> > I'd say the right way to solve this is to add a new special kind of VMA
> > to the address space that covers this range.
> Do you have any pointers where I can look further into this?

Before we go too deeply into it, how much would it cost to buy all of
these parts and feed them into a shredder?  I'm not entirely joking;
if it's less than the software engineering time it'd take to develop
and support this feature, we should do it.




More information about the linux-riscv mailing list