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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFw+xsZYME=L6pwfTQGX20ZNmMiqn5P-W90Y62quqa_qpA@mail.gmail.com>
Date:	Sat, 29 Mar 2014 10:17:35 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Miklos Szeredi <miklos@...redi.hu>
Cc:	Al Viro <viro@...iv.linux.org.uk>,
	Michael Kerrisk-manpages <mtk.manpages@...il.com>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Christoph Hellwig <hch@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"zab@...hat.com" <zab@...hat.com>
Subject: Re: splicing pages to the same file

On Tue, Mar 25, 2014 at 8:00 AM, Miklos Szeredi <miklos@...redi.hu> wrote:
> In pipe_to_file() I noticed the "if (buf->page != page)" and started thinking
> about this.  What should be the correct behavior?

I don't think we can have "correct" behavior, because no such behavior exists.

It's very much like memcpy() with the destination and source
overlapping. And as you noticed, doing it as a "memmove()" in
pipe_to_file() wouldn't help, because since we block this up by pages,
there will still be a potential overlap across subsequent page
fragments.

So I think the only reasonable option is to document the fact that
splicing from a file to itself falls under the "you're insane, it may
or may not do what you want". And since it depends on page size and on
which order we move pages around in etc, the rule should simply be
that you cannot sanely expect a splice from a file to itself to work.
Regardless of any actual byte range overlap details. "Don't do it".

Now, we *could* make it work when there isn't any overlap. Right now,
if you splice from a file to itself within the same page, we'll always
just say "screw you", but we could look at the offset too. That
wouldn't make a true overlap work (you could still have overlap that
we'd miss because within one part of a page it wouldn't look like
overlap to us since we only see this one page fragment at a time), but
we could try to make the case where there is no true overlap always
work reliably.

But would that be it worth it, since older kernels would still not
give those guarantees? Why did you even notice?

                   Linus
--
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