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: <Pine.LNX.4.64.0806301942220.22984@blonde.site>
Date:	Mon, 30 Jun 2008 20:00:04 +0100 (BST)
From:	Hugh Dickins <hugh@...itas.com>
To:	Benny Halevy <bhalevy@...asas.com>
cc:	Andrea Arcangeli <andrea@...ranet.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: fix uninitialized variables for find_vma_prepare
 callers

On Mon, 30 Jun 2008, Benny Halevy wrote:
> gcc 4.3.0 correctly emits the following warnings.
> When a vma covering addr is found, find_vma_prepare indeed returns without
> setting pprev, rb_link, and rb_parent.

That's amusing, thank you.

You may wonder how the vma rb_tree has been working all these years
despite that.  The answer is that we only use find_vma_prepare when
about to insert a new vma: if there's anything already there, it's
either an error condition, or we go off and unmap the overlap without
taking any interest in those uninitialized values for linking.

It would be nicer to initialize them, and your patch is certainly
nice and simple.  Would it have the effect, that it returns with
vma == *pprev when addr falls within an existing vma?
That would be a sensible outcome, I think.

Hugh

> [warnings snipped]
> 
> Signed-off-by: Benny Halevy <bhalevy@...asas.com>
> ---
>  mm/mmap.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3354fdd..81b9873 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -366,7 +366,7 @@ find_vma_prepare(struct mm_struct *mm, unsigned long addr,
>  		if (vma_tmp->vm_end > addr) {
>  			vma = vma_tmp;
>  			if (vma_tmp->vm_start <= addr)
> -				return vma;
> +				break;
>  			__rb_link = &__rb_parent->rb_left;
>  		} else {
>  			rb_prev = __rb_parent;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ