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: <d357bd00-6500-4332-8c46-17deee481de5@lucifer.local>
Date: Thu, 16 Jan 2025 07:44:42 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Liu Ye <liuye@...inos.cn>
Cc: akpm@...ux-foundation.org, Liam.Howlett@...cle.com, jannh@...gle.com,
        vbabka@...e.cz, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/vma: Add VM_WARN_ON for commit_merge

Thanks for the patch!

It's not possible for this scenario to happen in practice, so this check just
adds confusion.

There are two callers - the one from vma_expand() which unconditionally sets
expand true, and the one from vma_merge_existing_range() (note that
vma_merge_new_range() ultimately invokes vma_expand()).

The vma_merge_existing_range() case will nearly always set expand, should a
merge be indicated. In the one instance where it will not, adjust will always be
set to a non-NULL value.

Unfortunately this is super unclear, which is a big hint that refactoring is
required - and it's something I've already started working on - so I will take
this as a signal to increase the priority on this.

So this has to be a no unfortunately, but thank you very much highlighting this
as it clearly indicates the need to improve this, which is hugely valuable!

Thanks, Lorenzo

On Thu, Jan 16, 2025 at 10:50:05AM +0800, Liu Ye wrote:
>     Add VM_WARN_ON to prevent 'adjust' from accessing NULL pointers
>     when 'adjust' is NULL and 'expanded' is false or 'adj_start' is
>     not zero.
> Signed-off-by: Liu Ye <liuye@...inos.cn>
> ---
>  mm/vma.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/vma.c b/mm/vma.c
> index 31c9c6f51c9f..36b5ac675504 100644
> --- a/mm/vma.c
> +++ b/mm/vma.c
> @@ -641,6 +641,7 @@ static int commit_merge(struct vma_merge_struct *vmg,
>
>  	init_multi_vma_prep(&vp, vmg->vma, adjust, remove, remove2);
>
> +	VM_WARN_ON(!adjust && (!expanded || adj_start));
>  	VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma &&
>  		   vp.anon_vma != adjust->anon_vma);
>
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ