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:	Sun, 10 Jun 2012 12:10:56 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Miklos Szeredi <miklos@...redi.hu>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	hch@...radead.org, torvalds@...ux-foundation.org,
	dhowells@...hat.com, mszeredi@...e.cz
Subject: Re: [PATCH 00/21] vfs: atomic open v6 (part 2)

On Sun, Jun 10, 2012 at 04:49:21AM +0100, Al Viro wrote:

> So the only remaining reason for having that thing is this: what if we
> call ->atomic_open(), but it doesn't call finish_open()?  Then we need
> to free that unused struct file.  If finish_open() failed, we wouldn't.
> Same if it succeeded and something *after* it in ->atomic_open() failed
> (then we need to fput() that file - your code in ceph leaks it, BTW).
> Fair enough.  So we need to add one more helper that would discard that
> half-set-up struct file as we want it to be discarded.  That's all.

Actually, I take that back - that code in ceph is unreachable when
finish_open() succeeds.

Anyway, see vfs.git#atomic_open; it's a port of your queue + COMPLETELY
UNTESTED followups massaging it along the following lines:
	* ->atomic_open() takes struct file * instead of struct opendata *
	* it return int instead of struct file * - 0 for succeess, -E...
for error, 1 for "here's your sodding dentry, do it yourself".  Said
dentry is returned via file->f_path.dentry.
	* the same had been done to atomic_open()/lookup_open()/do_last()
	* finish_open() takes struct file and returns an int
	* it *also* takes int * - used to keep track of whether we'd done
successful do_dentry_open(), instead of "has opendata->filp been cleared?"
as in your variant.  Said int * is what your bool *created of ->atomic_open()
and friends has been turned into.  So the check in path_openat() is
	if (!(opened & FILE_OPENED)) {
		BUG_ON(!error);
		put_filp(file);
	}
which is as explicit as it gets, IMO.

The forest of failure exits in do_last() got cleaned up a bit, BTW.  Probably
can be cleaned up some more...

WARNING: I haven't even tried to boot it.  It builds, but this is all I can
promise at the moment.  I'm about to fall down (it's 7am here already ;-/),
will give it some beating when I get up.  It almost certainly has bugs, so
consider that as call for review and not much more.
--
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