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] [thread-next>] [day] [month] [year] [list]
Message-ID: <202504290954.C391C2B@keescook>
Date: Tue, 29 Apr 2025 09:55:19 -0700
From: Kees Cook <kees@...nel.org>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Vlastimil Babka <vbabka@...e.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Liam R . Howlett" <Liam.Howlett@...cle.com>,
	Jann Horn <jannh@...gle.com>, Pedro Falcato <pfalcato@...e.de>,
	David Hildenbrand <david@...hat.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
	Suren Baghdasaryan <surenb@...gle.com>, linux-mm@...ck.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 0/4] move all VMA allocation, freeing and duplication
 logic to mm

On Tue, Apr 29, 2025 at 11:23:25AM +0100, Lorenzo Stoakes wrote:
> On Tue, Apr 29, 2025 at 09:28:05AM +0200, Vlastimil Babka wrote:
> > On 4/28/25 17:28, Lorenzo Stoakes wrote:
> > > Currently VMA allocation, freeing and duplication exist in kernel/fork.c,
> > > which is a violation of separation of concerns, and leaves these functions
> > > exposed to the rest of the kernel when they are in fact internal
> > > implementation details.
> > >
> > > Resolve this by moving this logic to mm, and making it internal to vma.c,
> > > vma.h.
> > >
> > > This also allows us, in future, to provide userland testing around this
> > > functionality.
> > >
> > > We additionally abstract dup_mmap() to mm, being careful to ensure
> > > kernel/fork.c acceses this via the mm internal header so it is not exposed
> > > elsewhere in the kernel.
> > >
> > > As part of this change, also abstract initial stack allocation performed in
> > > __bprm_mm_init() out of fs code into mm via the create_init_stack_vma(), as
> > > this code uses vm_area_alloc() and vm_area_free().
> > >
> > > In order to do so sensibly, we introduce a new mm/vma_exec.c file, which
> > > contains the code that is shared by mm and exec. This file is added to both
> > > memory mapping and exec sections in MAINTAINERS so both sets of maintainers
> > > can maintain oversight.
> >
> > Note that kernel/fork.c itself belongs to no section. Maybe we could put it
> > somewhere too, maybe also multiple subsystems? I'm thinking something
> > between MM, SCHEDULER, EXEC, perhaps PIDFD?
> 
> Thanks, indeed I was wondering about where this should be, and the fact we can
> put stuff in multiple places is actually pretty powerful!
> 
> This is on my todo, will take a look at this.

Yeah, I'd be interested in having fork.c multi-maintainer-sectioned with
EXEC/BINFMT too, when the time comes.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ