lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250719162930.f5ad0d97c880e9e1f569f9e7@linux-foundation.org>
Date: Sat, 19 Jul 2025 16:29:30 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Dev Jain <dev.jain@....com>
Cc: david@...hat.com, catalin.marinas@....com, will@...nel.org,
 lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com, vbabka@...e.cz,
 rppt@...nel.org, surenb@...gle.com, mhocko@...e.com, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, suzuki.poulose@....com, steven.price@....com,
 gshan@...hat.com, linux-arm-kernel@...ts.infradead.org,
 yang@...amperecomputing.com, ryan.roberts@....com,
 anshuman.khandual@....com
Subject: Re: [PATCH v4] arm64: Enable permission change on arm64 kernel
 block mappings

On Sat, 19 Jul 2025 19:22:20 +0530 Dev Jain <dev.jain@....com> wrote:

> Gentle ping
> 
> On 03/07/25 8:44 pm, Dev Jain wrote:
> > This patch paves the path to enable huge mappings in vmalloc space and
> > linear map space by default on arm64. For this we must ensure that we can
> > handle any permission games on the kernel (init_mm) pagetable. Currently,
> > __change_memory_common() uses apply_to_page_range() which does not support
> > changing permissions for block mappings. We attempt to move away from this
> > by using the pagewalk API, similar to what riscv does right now; however,
> > it is the responsibility of the caller to ensure that we do not pass a
> > range overlapping a partial block mapping or cont mapping; in such a case,
> > the system must be able to support range splitting.
> >
>
> ...
>
> >   arch/arm64/mm/pageattr.c | 155 +++++++++++++++++++++++++++++++--------
> >   include/linux/pagewalk.h |   3 +
> >   mm/pagewalk.c            |  24 ++++++
> >   3 files changed, 150 insertions(+), 32 deletions(-)

I'm assuming this is an arm patch - the pagewalk.c bits are simple.

However, I have nits!

> > --- a/mm/pagewalk.c
> > +++ b/mm/pagewalk.c
> > @@ -633,6 +633,30 @@ int walk_kernel_page_table_range(unsigned long start, unsigned long end,
> >   	return walk_pgd_range(start, end, &walk);
> >   }
> >   
> > +/*
> > + * Use this function to walk the kernel page tables locklessly. It should be
> > + * guaranteed that the caller has exclusive access over the range they are
> > + * operating on - that there should be no concurrent access, for example,
> > + * changing permissions for vmalloc objects.
> > + */

All the other function documenation in there is in kerneldoc form.

> > +int walk_kernel_page_table_range_lockless(unsigned long start, unsigned long end,
> > +		const struct mm_walk_ops *ops, void *private)
> > +{
> > +	struct mm_walk walk = {
> > +		.ops		= ops,
> > +		.mm		= &init_mm,
> > +		.private	= private,
> > +		.no_vma		= true
> > +	};
> > +
> > +	if (start >= end)
> > +		return -EINVAL;
> > +	if (!check_ops_valid(ops))
> > +		return -EINVAL;
> > +
> > +	return walk_pgd_range(start, end, &walk);
> > +}
> > +

If we were being stingy with the bytes we could wrap this in some
`#ifdef CONFIG_ARM' thing,

This is awfully similar to walk_page_range_novma().  We could combine
them in some fashion but the results would be a bit messy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ