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: Fri, 06 Mar 2020 07:25:32 -0800 From: John Fastabend <john.fastabend@...il.com> To: Lorenz Bauer <lmb@...udflare.com>, john.fastabend@...il.com, Eric Dumazet <edumazet@...gle.com>, "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Jakub Sitnicki <jakub@...udflare.com>, Lorenz Bauer <lmb@...udflare.com>, Alexey Kuznetsov <kuznet@....inr.ac.ru>, Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>, Alexei Starovoitov <ast@...nel.org> Cc: kernel-team@...udflare.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, bpf@...r.kernel.org Subject: RE: [PATCH bpf-next v3 03/12] bpf: tcp: move assertions into tcp_bpf_get_proto Lorenz Bauer wrote: > We need to ensure that sk->sk_prot uses certain callbacks, so that > code that directly calls e.g. tcp_sendmsg in certain corner cases > works. To avoid spurious asserts, we must to do this only if > sk_psock_update_proto has not yet been called. The same invariants > apply for tcp_bpf_check_v6_needs_rebuild, so move the call as well. > > Doing so allows us to merge tcp_bpf_init and tcp_bpf_reinit. > > Signed-off-by: Lorenz Bauer <lmb@...udflare.com> Small nit if you update it just carry the acks through. Acked-by: John Fastabend <john.fastabend@...il.com> > skb_verdict = READ_ONCE(progs->skb_verdict); > @@ -191,18 +191,14 @@ static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs, > ret = -ENOMEM; > goto out_progs; > } > - sk_psock_is_new = true; > } > > if (msg_parser) > psock_set_prog(&psock->progs.msg_parser, msg_parser); > - if (sk_psock_is_new) { > - ret = tcp_bpf_init(sk); > - if (ret < 0) > - goto out_drop; > - } else { > - tcp_bpf_reinit(sk); > - } > + > + ret = tcp_bpf_init(sk); > + if (ret < 0) > + goto out_drop; > > write_lock_bh(&sk->sk_callback_lock); > if (skb_progs && !psock->parser.enabled) { > @@ -239,12 +235,9 @@ static int sock_map_link_no_progs(struct bpf_map *map, struct sock *sk) > if (IS_ERR(psock)) > return PTR_ERR(psock); > > - if (psock) { > - tcp_bpf_reinit(sk); > - return 0; > - } > + if (!psock) > + psock = sk_psock_init(sk, map->numa_node); > > - psock = sk_psock_init(sk, map->numa_node); > if (!psock) > return -ENOMEM; also small nit this reads, if (!psock) psock = ... if (!psock) return -ENOMEM how about, if (!psock) { psock = ... if (!psock) return -ENOMEM; }
Powered by blists - more mailing lists