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: <62e33e81-7857-fb5c-92be-6757623a6478@gmail.com>
Date:   Wed, 5 Feb 2020 19:50:13 +0300
From:   Pavel Begunkov <asml.silence@...il.com>
To:     Jens Axboe <axboe@...nel.dk>, io-uring@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring: fix mm use with IORING_OP_{READ,WRITE}

On 05/02/2020 19:16, Jens Axboe wrote:
> On 2/5/20 9:05 AM, Jens Axboe wrote:
>> On 2/5/20 9:02 AM, Pavel Begunkov wrote:
>>> On 05/02/2020 18:54, Jens Axboe wrote:
>>>> On 2/5/20 8:46 AM, Pavel Begunkov wrote:
>>>>> IORING_OP_{READ,WRITE} need mm to access user buffers, hence
>>>>> req->has_user check should go for them as well. Move the corresponding
>>>>> imports past the check.
>>>>
>>>> I'd need to double check, but I think the has_user check should just go.
>>>> The import checks for access anyway, so we'll -EFAULT there if we
>>>> somehow messed up and didn't acquire the right mm.
>>>>
>>> It'd be even better. I have plans to remove it, but I was thinking from a
>>> different angle.
>>
>> Let me just confirm it in practice, but it should be fine. Then we can just
>> kill it.
> 
> OK now I remember - in terms of mm it's fine, we'll do the right thing.
> But the iov_iter_init() has this gem:
> 
> 	/* It will get better.  Eventually... */
> 	if (uaccess_kernel()) {
> 		i->type = ITER_KVEC | direction;
> 		i->kvec = (struct kvec *)iov;
> 	} else {
> 		i->type = ITER_IOVEC | direction;
> 		i->iov = iov;
> 	}
> 
> which means that if we haven't set USER_DS, then iov_iter_init() will
> magically set the type to ITER_KVEC which then crashes when the iterator
> tries to copy.
> 
> Which is pretty lame. How about a patch that just checks for
> uaccess_kernel() and -EFAULTs if true for the non-fixed variants where
> we don't init the iter ourselves? Then we can still kill req->has_user
> and not have to fill it in.
> 
> 
On the other hand, we don't send requests async without @mm. So, if we fail them
whenever can't grab mm, it solves all the problems even without extra checks.
What do you think?


-- 
Pavel Begunkov



Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ