]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - net/socket.c
net: cleanly handle kernel vs user buffers for ->msg_control
authorChristoph Hellwig <hch@lst.de>
Mon, 11 May 2020 11:59:13 +0000 (13:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 May 2020 23:59:16 +0000 (16:59 -0700)
commit1f466e1f15cf1dac7c86798d694649fc42cd868a
tree1f8ca24224e9aa0dbaf924bec224deb08d1ab505
parent2618d530dd8b7ac0fdcb83f4c95b88f7b0d37ce6
net: cleanly handle kernel vs user buffers for ->msg_control

The msg_control field in struct msghdr can either contain a user
pointer when used with the recvmsg system call, or a kernel pointer
when used with sendmsg.  To complicate things further kernel_recvmsg
can stuff a kernel pointer in and then use set_fs to make the uaccess
helpers accept it.

Replace it with a union of a kernel pointer msg_control field, and
a user pointer msg_control_user one, and allow kernel_recvmsg operate
on a proper kernel pointer using a bitfield to override the normal
choice of a user pointer for recvmsg.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/socket.h
net/compat.c
net/core/scm.c
net/ipv4/ip_sockglue.c
net/socket.c