[PATCH 2/2] arm64: mm: use XN table mapping attributes for the linear region

Catalin Marinas catalin.marinas at arm.com
Fri Mar 5 20:37:27 GMT 2021


On Fri, Mar 05, 2021 at 08:17:07PM +0100, Ard Biesheuvel wrote:
> On Fri, 5 Mar 2021 at 20:06, Catalin Marinas <catalin.marinas at arm.com> wrote:
> > On Thu, Mar 04, 2021 at 06:11:45PM +0100, Ard Biesheuvel wrote:
> > > The way the arm64 kernel virtual address space is constructed guarantees
> > > that swapper PGD entries are never shared between the linear region on
> > > the one hand, and the vmalloc region on the other, which is where all
> > > kernel text, module text and BPF text mappings reside.
> > >
> > > This means that mappings in the linear region (which never require
> > > executable permissions) never share any table entries at any level with
> > > mappings that do require executable permissions, and so we can set the
> > > table-level PXN/UXN attributes for all table entries that are created
> > > while setting up mappings in the linear region. Since swapper's PGD
> > > level page table is mapped r/o itself, this adds another layer of
> > > robustness to the way the kernel manages its own page tables.
> >
> > In ARMv8.1 the architecture added the possibility of disabling the
> > hierarchical page table permissions (FEAT_HPDS) so that we can use these
> > bits for software.
> 
> Sure, but I don't think there is a shortage of software bits in table
> descriptors, right? And we don't enable the feature in the first
> place.

We are short of software bits but in the *pte*, so disabling the
hierarchical permissions doesn't anyway help. So, ignore me, the patches
are fine ;).

-- 
Catalin



More information about the linux-arm-kernel mailing list