On 10/30/24 01:24, David Sterba wrote:
On Wed, Oct 30, 2024 at 12:59:33AM +0000, Pavel Begunkov wrote:
On 10/22/24 15:50, Mark Harmstone wrote:
...
It seems we're saving iov in the priv structure, who can access the iovec
after the request is submitted? -EIOCBQUEUED in general means that the
request is submitted and will get completed async, e.g. via callback, and
if the bio callback can use the iov maybe via the iter, this goto will be
a use after free.
Also, you're returning -EFAULT back to io_uring, which will kill the
io_uring request / cmd while there might still be in flight bios that
can try to access it.
Can you inject errors into the copy and test please?
Thanks for the comments. I get the impression that there are known
problems on the io_uring side, so until that is resolved the btrfs part
may be insecure or with known runtime bugs, but in the end it does not
need any change. We just need to wait until it's resoved on the
interface level.
There is nothing wrong with io_uring, it's jumping from synchronous
to asynchronous that concerns me, or more specifically how this series
handles it and all races. Basic stuff like not freeing / changing
without protection memory that the async part might still be using.
That's up to this series to do it right.
The patches you point to are from FUSE trying to wire up io_uring so
this looks like an interface problem. We recently have gained a config
That's the easiest part of all, it can only happen when the
task dies and mm becomes unavaliable, sane userspace shouldn't
have problems like that. Mark just needs to include the referred
patch into the series and handle the request as mentioned.
option level gurard for experimental and unstable features so we can add
the code but don't have to expose users to the functionality unless they
konw there are risks or known problems. The io_uring and encoded read
has a performance benefit and
Good to hear that
I'd like to get the patches in for 6.13
but if there's something serious, one option is not add the code or at
least guard it (behind a config option).
Let's see what Mark replies, I might be missing some things, and
you and other btrfs folks can help to answer the unlock question.
I'm open to both and we have at least one -rc kernel to decide.
--
Pavel Begunkov