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]
Date:   Wed, 25 Mar 2020 14:02:07 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Qian Cai <cai@....pw>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: Null-ptr-deref due to "sanitized pathwalk machinery (v4)"

On Wed, Mar 25, 2020 at 05:58:30AM +0000, Al Viro wrote:
> On Wed, Mar 25, 2020 at 04:03:59AM +0000, Al Viro wrote:
> 
> > Lovely.  So
> > 	* we really do get NULL nd->path.dentry there; I've not misread the
> > trace.
> > 	* on the entry into link_path_walk() nd->path.dentry is non-NULL.
> > 	* *ALL* components should've been LAST_NORM ones
> > 	* not a single symlink in sight, unless the setup is rather unusual
> > 	* possibly not even a single mountpoint along the way (depending
> > upon the userland used)
> 
> OK, I see one place where that could occur, but I really don't see how that
> could be triggered on this pathname, short of very odd symlink layout in
> the filesystem on the testbox.

... which, apparently, is what you've got there (/var/run -> ../run), so
stepping into that braino is not implausible.  Could you check if the
fix below fixes what you've observed?  I am folding it in anyway (into
"lift all calls of step_into() out of follow_dotdot/follow_dotdot_rcu") -
it's an obvious braino introduced in the commit in question, but I'd
like a confirmation that this _is_ what you've caught.


>  Does the following fix your reproducer?
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 311e33dbac63..4082b70f32ff 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1805,6 +1805,8 @@ static const char *handle_dots(struct nameidata *nd, int type)
>  			error = step_into(nd, WALK_NOFOLLOW,
>  					 parent, inode, seq);
>  		}
> +		if (unlikely(error))
> +			return ERR_PTR(error);
>  
>  		if (unlikely(nd->flags & LOOKUP_IS_SCOPED)) {
>  			/*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ