Thread (44 messages) 44 messages, 15 authors, 2020-06-05

Re: [PATCH 09/14] fs: don't change the address limit for ->write_iter in __kernel_write

From: Christoph Hellwig <hch@lst.de>
Date: 2020-05-29 13:37:52
Also in: linux-fsdevel, lkml, netfilter-devel

On Fri, May 29, 2020 at 07:57:36AM +0200, Christoph Hellwig wrote:
On Thu, May 28, 2020 at 08:00:52PM +0100, Al Viro wrote:
quoted
On Thu, May 28, 2020 at 07:40:38AM +0200, Christoph Hellwig wrote:
quoted
If we write to a file that implements ->write_iter there is no need
to change the address limit if we send a kvec down.  Implement that
case, and prefer it over using plain ->write with a changed address
limit if available.
Umm...  It needs a comment along the lines of "weird shits like
/dev/sg that currently check for uaccess_kernel() will just
have to make sure they never switch to ->write_iter()"
sg and hid has the uaccess_kernel because it accesses userspace memory not
in the range passed to it.  Something using write_iter/read_iter should
never access any memory outside the iter passed to.  rdma has it because
it uses write as a bidirectional interface, which obviously can't work at
all with an iter.  So I'm not sure what we should comment on, but if
you have a desire and a proposal for a comment I'll happily add it.
And looking over all three again they actually comment why they
check uaccess_kernel.  More importantly if someone switched them to
the ->write_iter carelessly that means the uaccess outside of the range
would actually aways fail now as we didn't allow access to userspace
memory, so this should show up when testing instantly.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help