Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2020-02-21 The following pull-request contains BPF updates for your *net-next* tree. We've added 25 non-merge commits during the last 4 day(s) which contain a total of 33 files changed, 2433 insertions(+), 161 deletions(-). The main changes are: 1) Allow for adding TCP listen sockets into sock_map/hash so they can be used with reuseport BPF programs, from Jakub Sitnicki. 2) Add a new bpf_program__set_attach_target() helper for adding libbpf support to specify the tracepoint/function dynamically, from Eelco Chaudron. 3) Add bpf_read_branch_records() BPF helper which helps use cases like profile guided optimizations, from Daniel Xu. 4) Enable bpf_perf_event_read_value() in all tracing programs, from Song Liu. 5) Relax BTF mandatory check if only used for libbpf itself e.g. to process BTF defined maps, from Andrii Nakryiko. 6) Move BPF selftests -mcpu compilation attribute from 'probe' to 'v3' as it has been observed that former fails in envs with low memlock, from Yonghong Song. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -527,10 +527,43 @@ enum sk_pacing {
|
||||
SK_PACING_FQ = 2,
|
||||
};
|
||||
|
||||
/* Pointer stored in sk_user_data might not be suitable for copying
|
||||
* when cloning the socket. For instance, it can point to a reference
|
||||
* counted object. sk_user_data bottom bit is set if pointer must not
|
||||
* be copied.
|
||||
*/
|
||||
#define SK_USER_DATA_NOCOPY 1UL
|
||||
#define SK_USER_DATA_PTRMASK ~(SK_USER_DATA_NOCOPY)
|
||||
|
||||
/**
|
||||
* sk_user_data_is_nocopy - Test if sk_user_data pointer must not be copied
|
||||
* @sk: socket
|
||||
*/
|
||||
static inline bool sk_user_data_is_nocopy(const struct sock *sk)
|
||||
{
|
||||
return ((uintptr_t)sk->sk_user_data & SK_USER_DATA_NOCOPY);
|
||||
}
|
||||
|
||||
#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data)))
|
||||
|
||||
#define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk)))
|
||||
#define rcu_assign_sk_user_data(sk, ptr) rcu_assign_pointer(__sk_user_data((sk)), ptr)
|
||||
#define rcu_dereference_sk_user_data(sk) \
|
||||
({ \
|
||||
void *__tmp = rcu_dereference(__sk_user_data((sk))); \
|
||||
(void *)((uintptr_t)__tmp & SK_USER_DATA_PTRMASK); \
|
||||
})
|
||||
#define rcu_assign_sk_user_data(sk, ptr) \
|
||||
({ \
|
||||
uintptr_t __tmp = (uintptr_t)(ptr); \
|
||||
WARN_ON_ONCE(__tmp & ~SK_USER_DATA_PTRMASK); \
|
||||
rcu_assign_pointer(__sk_user_data((sk)), __tmp); \
|
||||
})
|
||||
#define rcu_assign_sk_user_data_nocopy(sk, ptr) \
|
||||
({ \
|
||||
uintptr_t __tmp = (uintptr_t)(ptr); \
|
||||
WARN_ON_ONCE(__tmp & ~SK_USER_DATA_PTRMASK); \
|
||||
rcu_assign_pointer(__sk_user_data((sk)), \
|
||||
__tmp | SK_USER_DATA_NOCOPY); \
|
||||
})
|
||||
|
||||
/*
|
||||
* SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK
|
||||
|
||||
Reference in New Issue
Block a user