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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Apr 2020 12:19:54 -0700
From:   John Fastabend <john.fastabend@...il.com>
To:     Jakub Sitnicki <jakub@...udflare.com>, bpf@...r.kernel.org
Cc:     netdev@...r.kernel.org, kernel-team@...udflare.com,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Joe Stringer <joe@...d.net.nz>,
        John Fastabend <john.fastabend@...il.com>,
        Lorenz Bauer <lmb@...udflare.com>,
        Martin KaFai Lau <kafai@...com>
Subject: RE: [PATCH bpf-next 1/3] bpf: Allow bpf_map_lookup_elem for SOCKMAP
 and SOCKHASH

Jakub Sitnicki wrote:
> White-list map lookup for SOCKMAP/SOCKHASH from BPF. Lookup returns a
> pointer to a full socket and acquires a reference if necessary.
> 
> To support it we need to extend the verifier to know that:
> 
>  (1) register storing the lookup result holds a pointer to socket, if
>      lookup was done on SOCKMAP/SOCKHASH, and that
> 
>  (2) map lookup on SOCKMAP/SOCKHASH is a reference acquiring operation,
>      which needs a corresponding reference release with bpf_sk_release.
> 
> On sock_map side, lookup handlers exposed via bpf_map_ops now bump
> sk_refcnt if socket is reference counted. In turn, bpf_sk_select_reuseport,
> the only in-kernel user of SOCKMAP/SOCKHASH ops->map_lookup_elem, was
> updated to release the reference.
> 
> Sockets fetched from a map can be used in the same way as ones returned by
> BPF socket lookup helpers, such as bpf_sk_lookup_tcp. In particular, they
> can be used with bpf_sk_assign to direct packets toward a socket on TC
> ingress path.
> 
> Suggested-by: Lorenz Bauer <lmb@...udflare.com>
> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
> ---

LGTM thanks!

Acked-by: John Fastabend <john.fastabend@...il.com>

Powered by blists - more mailing lists