mbox series

[PATCHSET,0/2] Disallow ancillary data from __sys_{recv,send}msg_file()

Message ID 20191126013145.23426-1-axboe@kernel.dk
Headers show
Series Disallow ancillary data from __sys_{recv,send}msg_file() | expand

Message

Jens Axboe Nov. 26, 2019, 1:31 a.m. UTC
io_uring currently uses __sys_sendmsg_file() and __sys_recvmsg_file() to
handle sendmsg and recvmsg operations. This generally works fine, but we
don't want to allow cmsg type operations, just "normal" data transfers.

This small patchset first splits the msghdr copy from the two main
helpers in net/socket.c, then changes __sys_sendmsg_file() and
__sys_recvmsg_file() to use those helpers. With patch 2, we also add a
check to explicitly check for msghdr->msg_control and
msghdr->msg_controllen and return -EINVAL if they are set.

 net/socket.c | 184 ++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 132 insertions(+), 52 deletions(-)

Comments

David Miller Nov. 26, 2019, 10 p.m. UTC | #1
From: Jens Axboe <axboe@kernel.dk>
Date: Mon, 25 Nov 2019 18:31:43 -0700

> io_uring currently uses __sys_sendmsg_file() and __sys_recvmsg_file() to
> handle sendmsg and recvmsg operations. This generally works fine, but we
> don't want to allow cmsg type operations, just "normal" data transfers.
> 
> This small patchset first splits the msghdr copy from the two main
> helpers in net/socket.c, then changes __sys_sendmsg_file() and
> __sys_recvmsg_file() to use those helpers. With patch 2, we also add a
> check to explicitly check for msghdr->msg_control and
> msghdr->msg_controllen and return -EINVAL if they are set.

For the series:

Acked-by: David S. Miller <davem@davemloft.net>
Jens Axboe Nov. 26, 2019, 10:04 p.m. UTC | #2
On 11/26/19 3:00 PM, David Miller wrote:
> From: Jens Axboe <axboe@kernel.dk>
> Date: Mon, 25 Nov 2019 18:31:43 -0700
> 
>> io_uring currently uses __sys_sendmsg_file() and __sys_recvmsg_file() to
>> handle sendmsg and recvmsg operations. This generally works fine, but we
>> don't want to allow cmsg type operations, just "normal" data transfers.
>>
>> This small patchset first splits the msghdr copy from the two main
>> helpers in net/socket.c, then changes __sys_sendmsg_file() and
>> __sys_recvmsg_file() to use those helpers. With patch 2, we also add a
>> check to explicitly check for msghdr->msg_control and
>> msghdr->msg_controllen and return -EINVAL if they are set.
> 
> For the series:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Thanks David, added to the series.