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
| ||
|
Date: Sat, 14 Aug 2021 04:27:46 +0000 From: Jiang Wang <jiang.wang@...edance.com> To: netdev@...r.kernel.org Cc: cong.wang@...edance.com, duanxiongchun@...edance.com, xieyongji@...edance.com, chaiwen.cc@...edance.com, "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, John Fastabend <john.fastabend@...il.com>, Daniel Borkmann <daniel@...earbox.net>, Jakub Sitnicki <jakub@...udflare.com>, Lorenz Bauer <lmb@...udflare.com>, Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>, KP Singh <kpsingh@...nel.org>, Shuah Khan <shuah@...nel.org>, Al Viro <viro@...iv.linux.org.uk>, Christian Brauner <christian.brauner@...ntu.com>, Rao Shoaib <rao.shoaib@...cle.com>, Johan Almbladh <johan.almbladh@...finetworks.com>, linux-kernel@...r.kernel.org, bpf@...r.kernel.org, linux-kselftest@...r.kernel.org Subject: [PATCH bpf-next v6 1/5] af_unix: add read_sock for stream socket types To support sockmap for af_unix stream type, implement read_sock, which is similar to the read_sock for unix dgram sockets. Signed-off-by: Jiang Wang <jiang.wang@...edance.com> Reviewed-by: Cong Wang <cong.wang@...edance.com> --- net/unix/af_unix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 1c2224f05b51..31061304ccf2 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -678,6 +678,8 @@ static int unix_dgram_sendmsg(struct socket *, struct msghdr *, size_t); static int unix_dgram_recvmsg(struct socket *, struct msghdr *, size_t, int); static int unix_read_sock(struct sock *sk, read_descriptor_t *desc, sk_read_actor_t recv_actor); +static int unix_stream_read_sock(struct sock *sk, read_descriptor_t *desc, + sk_read_actor_t recv_actor); static int unix_dgram_connect(struct socket *, struct sockaddr *, int, int); static int unix_seqpacket_sendmsg(struct socket *, struct msghdr *, size_t); @@ -731,6 +733,7 @@ static const struct proto_ops unix_stream_ops = { .shutdown = unix_shutdown, .sendmsg = unix_stream_sendmsg, .recvmsg = unix_stream_recvmsg, + .read_sock = unix_stream_read_sock, .mmap = sock_no_mmap, .sendpage = unix_stream_sendpage, .splice_read = unix_stream_splice_read, @@ -2490,6 +2493,15 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, } #endif +static int unix_stream_read_sock(struct sock *sk, read_descriptor_t *desc, + sk_read_actor_t recv_actor) +{ + if (unlikely(sk->sk_state != TCP_ESTABLISHED)) + return -ENOTCONN; + + return unix_read_sock(sk, desc, recv_actor); +} + static int unix_stream_read_generic(struct unix_stream_read_state *state, bool freezable) { -- 2.20.1
Powered by blists - more mailing lists