Thread (46 messages) 46 messages, 7 authors, 2021-09-13

Re: [git pull] iov_iter fixes

From: Jens Axboe <axboe@kernel.dk>
Date: 2021-09-10 03:23:12
Also in: linux-fsdevel

On 9/9/21 9:15 PM, Al Viro wrote:
On Thu, Sep 09, 2021 at 09:06:58PM -0600, Jens Axboe wrote:
quoted
On 9/9/21 8:48 PM, Al Viro wrote:
quoted
On Thu, Sep 09, 2021 at 07:35:13PM -0600, Jens Axboe wrote:
quoted
Yep ok I follow you now. And yes, if we get a partial one but one that
has more consumed than what was returned, that would not work well. I'm
guessing that a) we've never seen that, or b) we always end up with
either correctly advanced OR fully advanced, and the fully advanced case
would then just return 0 next time and we'd just get a short IO back to
userspace.

The safer way here would likely be to import the iovec again. We're
still in the context of the original submission, and the sqe hasn't been
consumed in the ring yet, so that can be done safely.
... until you end up with something assuming that you've got the same
iovec from userland the second time around.

IOW, generally it's a bad idea to do that kind of re-imports.
That's really no different than having one thread do the issue, and
another modify the iovec while it happens. It's only an issue if you
don't validate it, just like you did the first time you imported. No
assumptions need to be made here.
	It's not "need to be made", it's "will be mistakenly made by
somebody several years down the road"...
If the application changes the iovec passed in while it hasn't been
consumed yet, it's buggy. Period. We obviously need to ensure that we
only do this re-import IFF we're in the same original submit context
still.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help