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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250304151556.635d9041a7ca36f1960fe664@linux-foundation.org>
Date: Tue, 4 Mar 2025 15:15:56 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, "Liam R . Howlett"
 <Liam.Howlett@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, Jann Horn
 <jannh@...gle.com>, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/7] mm/mremap: initial refactor of move_vma()

On Tue, 4 Mar 2025 21:45:27 +0000 Yosry Ahmed <yosry.ahmed@...ux.dev> wrote:

> On Mon, Mar 03, 2025 at 11:08:34AM +0000, Lorenzo Stoakes wrote:
> > Update move_vma() to use the threaded VRM object, de-duplicate code and
> > separate into smaller functions to aid readability and debug-ability.
> > 
> > This in turn allows further simplification of expand_vma() as we can simply
> > thread VRM through the function.
> > 
> > We also take the opportunity to abstract the account charging page count
> > into the VRM in order that we can correctly thread this through the
> > operation.
> > 
> > We additionally do the same for tracking mm statistics - exec_vm, stack_vm,
> > data_vm, and locked_vm.
> > 
> > As part of this change, we slightly modify when locked pages statistics are
> > counted for in mm_struct statistics. However this should cause no issues,
> > as there is no chance of underflow, nor will any rlimit failures occur as a
> > result.
> > 
> > This is an intermediate step before a further refactoring of move_vma() in
> > order to aid review.
> > 
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> > ---
> [..]
> > +/*
> > + * Perform checks  before attempting to write a VMA prior to it being
> > + * moved.
> > + */
> > +static unsigned long prep_move_vma(struct vma_remap_struct *vrm,
> > +				   unsigned long *vm_flags_ptr)
> > +{
> > +	unsigned long err;
> 
> I am getting a warning on mm-unstable because 'err' is sometimes used
> uninitialized, I think here:
> 
>         if (vma->vm_ops && vma->vm_ops->may_split) {
>                 if (vma->vm_start != old_addr)
>                         err = vma->vm_ops->may_split(vma, old_addr);
>                 if (!err && vma->vm_end != old_addr + old_len)
>                         err = vma->vm_ops->may_split(vma, old_addr + old_len);
>                 if (err)
>                         return err;
>         }

yep, thanks.  I added this:

--- a/mm/mremap.c~mm-mremap-initial-refactor-of-move_vma-fix
+++ a/mm/mremap.c
@@ -892,7 +892,7 @@ static void vrm_stat_account(struct vma_
 static unsigned long prep_move_vma(struct vma_remap_struct *vrm,
 				   unsigned long *vm_flags_ptr)
 {
-	unsigned long err;
+	unsigned long err = 0;
 	struct vm_area_struct *vma = vrm->vma;
 	unsigned long old_addr = vrm->addr;
 	unsigned long old_len = vrm->old_len;
_


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ