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: <YrYxOC5dgCKBHwVE@ZenIV>
Date:   Fri, 24 Jun 2022 22:48:40 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 2/6] fs: do not set no_llseek in fops

On Fri, Jun 24, 2022 at 06:56:27PM +0200, Jason A. Donenfeld wrote:
> vfs_llseek already does something with this, and it makes it difficult
> to distinguish between llseek being supported and not.

How about something along the lines of

===
struct file_operations ->llseek() method gets called only in two places:
vfs_llseek() and dump_skip().  Both treat NULL and no_llseek as
equivalent.

The value of ->llseek is also examined in __full_proxy_fops_init() and
ovl_copy_up_data().  For the former we could as well treat no_llseek
as NULL; no need to do a proxy wrapper around the function that fails
with -ESPIPE without so much as looking at its arguments.
Same for the latter - there no_llseek would end up with skip_hole
set true until the first time we look at it.  At that point we
call vfs_llseek(), observe that it has failed (-ESPIPE), shrug and
set skip_hole false.  Might as well have done that from the very
beginning.

	In other words, any place where .llseek is set to no_llseek
could just as well set it to NULL.
===

for commit message?

Next commit would remove the checks for no_llseek and have vfs_llseek()
just do
        if (file->f_mode & FMODE_LSEEK) {
		if (file->f_op->llseek)
			return file->f_op->llseek(file, offset, whence);
	}
	return -ESPIPE;
and kill no_llseek() off.  And once you have guaranteed that FMODE_LSEEK
is never set with NULL ->llseek, vfs_llseek() gets trimmed in obvious
way and tests in dump_skip() and ovl_copy_up_data() would become simply
file->f_mode & FMODE_LSEEK - no need to check ->f_op->llseek there
after that.  At the same time dump_skip() could switch to calling
vfs_llseek() instead of direct method call...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ