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: <20130201193402.GQ4503@ZenIV.linux.org.uk>
Date:	Fri, 1 Feb 2013 19:34:02 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	chenggang.qin@...il.com
Cc:	linux-kernel@...r.kernel.org,
	chenggang <chenggang.qcg@...baba-inc.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] Tracepoint: Add 'file name' as a parameter of tracepoint
 events ext4:ext4_direct_IO_enter&ext4:ext4_direct_IO_exit

On Fri, Feb 01, 2013 at 11:37:38PM +0800, chenggang.qin@...il.com wrote:
> @@ -3213,13 +3214,15 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
>  	if (ext4_has_inline_data(inode))
>  		return 0;
>  
> -	trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
> +	fname = file->f_path.dentry->d_name.name;
> +	trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw,
> +				   fname);

Oh, wonderful...  "your patch is racy; there's no warranty that fname will
not be freed right under you" -- "OK, we shouldn't do it in VFS... let's
try to do exact same thing in ext4, then"

Let me spell it out for you: opened files *can* be renamed while they are
in the middle of IO.  If both old and new names are short, the contents
of ->d_name.name will be overwritten, so dereferencing your fname can yield
a mix of old and new name, or something that isn't NUL-terminated.  If they
are long enough, they will be allocated separately from struct dentry and
your fname can bloody well end up pointing to freed memory by the time you
get around to dereferencing it.

Again, there is no exclusion between ext4_direct_IO() (or its callers) and
rename().  The NAK still stands.
--
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