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: <20130904191104.GK13318@ZenIV.linux.org.uk>
Date:	Wed, 4 Sep 2013 20:11:04 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Waiman Long <Waiman.Long@...com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Chandramouleeswaran, Aswin" <aswin@...com>,
	"Norton, Scott J" <scott.norton@...com>
Subject: Re: [PATCH] dcache: Translating dentry into pathname without taking
 rename_lock

On Wed, Sep 04, 2013 at 03:05:23PM -0400, Waiman Long wrote:
>  
>  static int prepend_name(char **buffer, int *buflen, struct qstr *name)
>  {
> -	return prepend(buffer, buflen, name->name, name->len);
> +	/*
> +	 * With RCU path tracing, it may race with rename. Use
> +	 * ACCESS_ONCE() to make sure that it is either the old or
> +	 * the new name pointer. The length does not really matter as
> +	 * the sequence number check will eventually catch any ongoing
> +	 * rename operation.
> +	 */
> +	const char *dname = ACCESS_ONCE(name->name);
> +	int   dlen = name->len;
> +
> +	if (unlikely(!dname || !dlen))
> +		return -EINVAL;
> +	return prepend(buffer, buflen, dname, dlen);

NAK.  A race with d_move() can very well leave you with dname pointing into
an object of length smaller than dlen.  You *can* copy it byte-by-byte
and rely on NUL-termination, but you can't rely on length being accurate -
not without having excluded d_move().
--
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