linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Xuanye Liu <liuqiye2025@163.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
	Pedro Falcato <pfalcato@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: simplify min_brk handling in brk()
Date: Thu, 10 Jul 2025 09:24:30 +0100	[thread overview]
Message-ID: <6fe9455e-0411-4c4b-b070-b8be2da76b3d@lucifer.local> (raw)
In-Reply-To: <20250710025859.926355-1-liuqiye2025@163.com>

On Thu, Jul 10, 2025 at 10:58:58AM +0800, Xuanye Liu wrote:
> Set min_brk to mm->start_brk by default, and override it with
> mm->end_data only when CONFIG_COMPAT_BRK is enabled and
> brk_randomized is false.
>
> This makes the logic clearer with no functional change.
>
> Signed-off-by: Xuanye Liu <liuqiye2025@163.com>

LGTM thanks, nice cleanup:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  mm/mmap.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d8fa373e4ac1..7306253cc3b5 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -127,18 +127,15 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
>
>  	origbrk = mm->brk;
>
> +	min_brk = mm->start_brk;
>  #ifdef CONFIG_COMPAT_BRK
>  	/*
>  	 * CONFIG_COMPAT_BRK can still be overridden by setting
>  	 * randomize_va_space to 2, which will still cause mm->start_brk
>  	 * to be arbitrarily shifted
>  	 */
> -	if (current->brk_randomized)
> -		min_brk = mm->start_brk;
> -	else
> +	if (!current->brk_randomized)
>  		min_brk = mm->end_data;
> -#else
> -	min_brk = mm->start_brk;
>  #endif
>  	if (brk < min_brk)
>  		goto out;
> --
> 2.43.0
>


      parent reply	other threads:[~2025-07-10  8:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10  2:58 Xuanye Liu
2025-07-10  7:56 ` Pedro Falcato
2025-07-10  8:24 ` Lorenzo Stoakes [this message]

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=6fe9455e-0411-4c4b-b070-b8be2da76b3d@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuqiye2025@163.com \
    --cc=pfalcato@suse.de \
    --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