linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: jeffxu@chromium.org
Cc: akpm@linux-foundation.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org, linux-hardening@vger.kernel.org,
	pedro.falcato@gmail.com, rientjes@google.com,
	keescook@chromium.org, Liam Howlett <liam.howlett@oracle.com>,
	vbabka@suse.cz
Subject: Re: [PATCH v1 1/2] mseal: fix mmap(FIXED) error code.
Date: Thu, 29 Aug 2024 13:09:41 +0100	[thread overview]
Message-ID: <58e47a2e-6556-4a41-9fe5-1378f5257534@lucifer.local> (raw)
In-Reply-To: <20240828225522.684774-1-jeffxu@chromium.org>

Jeff... come on now.

Please cc- the reviewers of mm/mmap.c on these patches - that's me,
Vlastimil and Liam. Same for mm/vma.c, mm/vma.h, mm/vma_internal.h.

And it seems like it should be pretty obvious you should cc- Liam when it's
quite literally his code you're changing!

Relevant section from MAINTAINERS:

MEMORY MAPPING
M:	Andrew Morton <akpm@linux-foundation.org>
R:	Liam R. Howlett <Liam.Howlett@oracle.com>
R:	Vlastimil Babka <vbabka@suse.cz>
R:	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
L:	linux-mm@kvack.org
S:	Maintained
W:	http://www.linux-mm.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
F:	mm/mmap.c

On Wed, Aug 28, 2024 at 10:55:21PM GMT, jeffxu@chromium.org wrote:
> From: Jeff Xu <jeffxu@chromium.org>
>
> mmap(MAP_FIXED) should return EPERM when memory is sealed.
>
> Fixes: 4205a39e06da ("mm/munmap: replace can_modify_mm with can_modify_vma")
> Signed-off-by: Jeff Xu <jeffxu@chromium.org>
> ---
>  mm/mmap.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 80d70ed099cf..0cd0c0ef03c7 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1386,7 +1386,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
>  		mt_on_stack(mt_detach);
>  		mas_init(&mas_detach, &mt_detach, /* addr = */ 0);
>  		/* Prepare to unmap any existing mapping in the area */
> -		if (vms_gather_munmap_vmas(&vms, &mas_detach))
> +		error = vms_gather_munmap_vmas(&vms, &mas_detach);
> +		if (error == -EPERM)
> +			return -EPERM;
> +		if (error)
>  			return -ENOMEM;

Can't we just return the error here?

This is one for Liam, but I'm ostensibly in favour, this does seem valid!

>
>  		vmg.next = vms.next;
> --
> 2.46.0.295.g3b9ea8a38a-goog
>


  parent reply	other threads:[~2024-08-29 12:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 22:55 jeffxu
2024-08-28 22:55 ` [PATCH v1 2/2] selftests/mm: mseal_test add more tests jeffxu
2024-08-29 14:45   ` Jeff Xu
2024-08-29 15:14     ` Lorenzo Stoakes
2024-08-29 15:30       ` Jeff Xu
2024-08-29 15:44         ` Lorenzo Stoakes
2024-08-29 19:54           ` Jeff Xu
2024-08-29 19:58             ` Matthew Wilcox
2024-08-29 21:34               ` Jeff Xu
2024-08-29 16:16   ` Mark Brown
2024-08-29 16:32     ` Lorenzo Stoakes
2024-08-29 19:40     ` Jeff Xu
2024-08-28 23:38 ` [PATCH v1 1/2] mseal: fix mmap(FIXED) error code Pedro Falcato
2024-08-29 14:03   ` Liam R. Howlett
2024-08-29 14:36     ` Jeff Xu
2024-08-29 14:32   ` Jeff Xu
2024-08-29 12:09 ` Lorenzo Stoakes [this message]
2024-08-29 14:34   ` Jeff Xu
2024-08-31  1:15   ` Andrew Morton
2024-08-31 10:14     ` Lorenzo Stoakes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58e47a2e-6556-4a41-9fe5-1378f5257534@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeffxu@chromium.org \
    --cc=keescook@chromium.org \
    --cc=liam.howlett@oracle.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pedro.falcato@gmail.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox