[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180205181601.6770.76316.stgit@john-Precision-Tower-5810>
Date: Mon, 05 Feb 2018 10:17:38 -0800
From: John Fastabend <john.fastabend@...il.com>
To: ast@...nel.org, daniel@...earbox.net, davejwatson@...com
Cc: netdev@...r.kernel.org
Subject: [bpf PATCH v4 0/3] bpf: sockmap fixes
A set of fixes for sockmap to resolve programs referencing sockmaps
and closing without deleting all entries in the map and/or not detaching
BPF programs attached to the map. Both leaving entries in the map and
not detaching programs may result in the map failing to be removed by
BPF infrastructure due to reference counts never reaching zero.
For this we pull in the ULP infrastructure to hook into the close()
hook of the sock layer. This seemed natural because we have additional
sockmap features (to add support for TX hooks) that will also use the
ULP infrastructure. This allows us to cleanup entries in the map when
socks are closed() and avoid trying to get the sk_state_change() hook
to fire in all cases.
The second issue resolved here occurs when users don't detach
programs. The gist is a refcnt issue resolved by implementing the
release callback. See patch for details.
For testing I ran both sample/sockmap and selftests bpf/test_maps.c.
Dave Watson ran TLS test suite on v1 version of the patches without
the put_module error path change.
v4 fix missing rcu_unlock()
v3 wrap psock reference in RCU
v2 changes rebased onto bpf-next with small update adding module_put
---
John Fastabend (3):
net: add a UID to use for ULP socket assignment
bpf: sockmap, add sock close() hook to remove socks
bpf: sockmap, fix leaking maps with attached but not detached progs
include/net/tcp.h | 8 ++
kernel/bpf/sockmap.c | 187 +++++++++++++++++++++++++++++++-------------------
net/ipv4/tcp_ulp.c | 59 ++++++++++++++--
net/tls/tls_main.c | 2 +
4 files changed, 179 insertions(+), 77 deletions(-)
--
Signature
Powered by blists - more mailing lists