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: <6fe9455e-0411-4c4b-b070-b8be2da76b3d@lucifer.local>
Date: Thu, 10 Jul 2025 09:24:30 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Xuanye Liu <liuqiye2025@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
        Pedro Falcato <pfalcato@...e.de>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: simplify min_brk handling in brk()

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@....com>

LGTM thanks, nice cleanup:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ