[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8658375-db8c-4fc1-9401-5e59b61c76a1@suse.cz>
Date: Tue, 9 Jul 2024 12:40:12 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
Matthew Wilcox <willy@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Eric Biederman <ebiederm@...ssion.com>, Kees Cook <kees@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>, SeongJae Park <sj@...nel.org>,
Shuah Khan <shuah@...nel.org>, Brendan Higgins <brendanhiggins@...gle.com>,
David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>
Subject: Re: [PATCH v2 1/7] userfaultfd: move core VMA manipulation logic to
mm/userfaultfd.c
On 7/4/24 9:27 PM, Lorenzo Stoakes wrote:
> This patch forms part of a patch series intending to separate out VMA logic
> and render it testable from userspace, which requires that core
> manipulation functions be exposed in an mm/-internal header file.
>
> In order to do this, we must abstract APIs we wish to test, in this
> instance functions which ultimately invoke vma_modify().
>
> This patch therefore moves all logic which ultimately invokes vma_modify()
> to mm/userfaultfd.c, trying to transfer code at a functional granularity
> where possible.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
> --- a/include/linux/userfaultfd_k.h
> +++ b/include/linux/userfaultfd_k.h
> @@ -264,6 +264,25 @@ extern void userfaultfd_unmap_complete(struct mm_struct *mm,
> extern bool userfaultfd_wp_unpopulated(struct vm_area_struct *vma);
> extern bool userfaultfd_wp_async(struct vm_area_struct *vma);
>
> +extern void userfaultfd_reset_ctx(struct vm_area_struct *vma);
> +
> +extern struct vm_area_struct *userfaultfd_clear_vma(struct vma_iterator *vmi,
> + struct vm_area_struct *prev,
> + struct vm_area_struct *vma,
> + unsigned long start,
> + unsigned long end);
> +
> +int userfaultfd_register_range(struct userfaultfd_ctx *ctx,
> + struct vm_area_struct *vma,
> + unsigned long vm_flags,
> + unsigned long start, unsigned long end,
> + bool wp_async);
> +
> +extern void userfaultfd_release_new(struct userfaultfd_ctx *ctx);
> +
> +extern void userfaultfd_release_all(struct mm_struct *mm,
> + struct userfaultfd_ctx *ctx);
> +
Nit: the externs are superfluous. AFAIU the tribal knowledge (or is it
documented?), we don't add them even if other declarations around have them,
but we don't also actively remove them unless the lines are touched for
other reasons. So the declarations are inconsistent but slowly move towards
no externs.
> #else /* CONFIG_USERFAULTFD */
>
> /* mm helpers */
Powered by blists - more mailing lists