io_uring: allow tcp ancillary data for __sys_recvmsg_sock()
Luke Hsiao authored
For TCP tx zero-copy, the kernel notifies the process of completions by
queuing completion notifications on the socket error queue. This patch
allows reading these notifications via recvmsg to support TCP tx
zero-copy.

Ancillary data was originally disallowed due to privilege escalation
via io_uring's offloading of sendmsg() onto a kernel thread with kernel
credentials (https://crbug.com/project-zero/1975

). So, we must ensure
that the socket type is one where the ancillary data types that are
delivered on recvmsg are plain data (no file descriptors or values that
are translated based on the identity of the calling process).

This was tested by using io_uring to call recvmsg on the MSG_ERRQUEUE
with tx zero-copy enabled. Before this patch, we received -EINVALID from
this specific code path. After this patch, we could read tcp tx
zero-copy completion notifications from the MSG_ERRQUEUE.
Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: default avatarArjun Roy <arjunroy@google.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarJann Horn <jannh@google.com>
Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarLuke Hsiao <lukehsiao@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
583bbf06
Name Last commit Last update
..
6lowpan treewide: replace '---help---' in Kconfig files with 'help'
802 net: 802: psnap.c: Use built-in RCU list checking
8021q net: get rid of lockdep_set_class_and_subclass()
9p Merge tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux
appletalk appletalk: Fix atalk_proc_init() return path
atm mm, treewide: rename kzfree() to kfree_sensitive()
ax25 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
batman-adv batman-adv: Introduce a configurable per interface hop penalty
bluetooth mm, treewide: rename kzfree() to kfree_sensitive()
bpf bpf: Allow to specify ifindex for skb in bpf_prog_test_run_skb
bpfilter Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
bridge netlink: consistently use NLA_POLICY_EXACT_LEN()
caif net: pass a sockptr_t into ->setsockopt
can can: j1939: add rxtimer for multipacket broadcast session
ceph libceph: replace HTTP links with HTTPS ones
core devlink: Protect devlink port list traversal
dcb dcb_doit: remove redundant skb check
dccp net: dccp: Convert to use the preferred fallthrough macro
decnet Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
dns_resolver docs: networking: convert dns_resolver.txt to ReST
dsa net: dsa: stop overriding master's ndo_get_phys_port_name
ethernet net: move devres helpers into a separate source file
ethtool Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
hsr hsr: Use %pM format specifier for MAC addresses
ieee802154 net: pass a sockptr_t into ->setsockopt
ife
ipv4
ipv6
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mpls
mptcp
ncsi
netfilter
netlabel
netlink
netrom
nfc
nsh
openvswitch
packet
phonet
psample
qrtr
rds
rfkill
rose
rxrpc
sched
sctp
smc
strparser
sunrpc
switchdev
tipc
tls
unix
vmw_vsock
wimax
wireless
x25
xdp
xfrm
Kconfig
Makefile
compat.c
devres.c
socket.c
sysctl_net.c