Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7b81641 authored by David S. Miller's avatar David S. Miller
Browse files


Alexei Starovoitov says:

====================
pull-request: bpf 2019-01-31

The following pull-request contains BPF updates for your *net* tree.

The main changes are:

1) disable preemption in sender side of socket filters, from Alexei.

2) fix two potential deadlocks in syscall bpf lookup and prog_register,
   from Martin and Alexei.

3) fix BTF to allow typedef on func_proto, from Yonghong.

4) two bpftool fixes, from Jiri and Paolo.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9b1f19d8 f01c2803
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -2848,6 +2848,9 @@ F: include/uapi/linux/if_bonding.h
BPF (Safe dynamic programs and tools)
BPF (Safe dynamic programs and tools)
M:	Alexei Starovoitov <ast@kernel.org>
M:	Alexei Starovoitov <ast@kernel.org>
M:	Daniel Borkmann <daniel@iogearbox.net>
M:	Daniel Borkmann <daniel@iogearbox.net>
R:	Martin KaFai Lau <kafai@fb.com>
R:	Song Liu <songliubraving@fb.com>
R:	Yonghong Song <yhs@fb.com>
L:	netdev@vger.kernel.org
L:	netdev@vger.kernel.org
L:	linux-kernel@vger.kernel.org
L:	linux-kernel@vger.kernel.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
@@ -2873,6 +2876,8 @@ F: samples/bpf/
F:	tools/bpf/
F:	tools/bpf/
F:	tools/lib/bpf/
F:	tools/lib/bpf/
F:	tools/testing/selftests/bpf/
F:	tools/testing/selftests/bpf/
K:	bpf
N:	bpf


BPF JIT for ARM
BPF JIT for ARM
M:	Shubham Bansal <illusionist.neo@gmail.com>
M:	Shubham Bansal <illusionist.neo@gmail.com>
+18 −3
Original line number Original line Diff line number Diff line
@@ -591,7 +591,7 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb)
	return qdisc_skb_cb(skb)->data;
	return qdisc_skb_cb(skb)->data;
}
}


static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog,
static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog,
					 struct sk_buff *skb)
					 struct sk_buff *skb)
{
{
	u8 *cb_data = bpf_skb_cb(skb);
	u8 *cb_data = bpf_skb_cb(skb);
@@ -611,15 +611,30 @@ static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog,
	return res;
	return res;
}
}


static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog,
				       struct sk_buff *skb)
{
	u32 res;

	preempt_disable();
	res = __bpf_prog_run_save_cb(prog, skb);
	preempt_enable();
	return res;
}

static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog,
static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog,
					struct sk_buff *skb)
					struct sk_buff *skb)
{
{
	u8 *cb_data = bpf_skb_cb(skb);
	u8 *cb_data = bpf_skb_cb(skb);
	u32 res;


	if (unlikely(prog->cb_access))
	if (unlikely(prog->cb_access))
		memset(cb_data, 0, BPF_SKB_CB_LEN);
		memset(cb_data, 0, BPF_SKB_CB_LEN);


	return BPF_PROG_RUN(prog, skb);
	preempt_disable();
	res = BPF_PROG_RUN(prog, skb);
	preempt_enable();
	return res;
}
}


static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog,
static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog,
+2 −1
Original line number Original line Diff line number Diff line
@@ -1459,7 +1459,8 @@ static int btf_modifier_resolve(struct btf_verifier_env *env,


		/* "typedef void new_void", "const void"...etc */
		/* "typedef void new_void", "const void"...etc */
		if (!btf_type_is_void(next_type) &&
		if (!btf_type_is_void(next_type) &&
		    !btf_type_is_fwd(next_type)) {
		    !btf_type_is_fwd(next_type) &&
		    !btf_type_is_func_proto(next_type)) {
			btf_verifier_log_type(env, v->t, "Invalid type_id");
			btf_verifier_log_type(env, v->t, "Invalid type_id");
			return -EINVAL;
			return -EINVAL;
		}
		}
+1 −1
Original line number Original line Diff line number Diff line
@@ -572,7 +572,7 @@ int __cgroup_bpf_run_filter_skb(struct sock *sk,
	bpf_compute_and_save_data_end(skb, &saved_data_end);
	bpf_compute_and_save_data_end(skb, &saved_data_end);


	ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], skb,
	ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], skb,
				 bpf_prog_run_save_cb);
				 __bpf_prog_run_save_cb);
	bpf_restore_data_end(skb, saved_data_end);
	bpf_restore_data_end(skb, saved_data_end);
	__skb_pull(skb, offset);
	__skb_pull(skb, offset);
	skb->sk = save_sk;
	skb->sk = save_sk;
+2 −2
Original line number Original line Diff line number Diff line
@@ -686,7 +686,7 @@ static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l)
	}
	}


	if (htab_is_prealloc(htab)) {
	if (htab_is_prealloc(htab)) {
		pcpu_freelist_push(&htab->freelist, &l->fnode);
		__pcpu_freelist_push(&htab->freelist, &l->fnode);
	} else {
	} else {
		atomic_dec(&htab->count);
		atomic_dec(&htab->count);
		l->htab = htab;
		l->htab = htab;
@@ -748,7 +748,7 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
		} else {
		} else {
			struct pcpu_freelist_node *l;
			struct pcpu_freelist_node *l;


			l = pcpu_freelist_pop(&htab->freelist);
			l = __pcpu_freelist_pop(&htab->freelist);
			if (!l)
			if (!l)
				return ERR_PTR(-E2BIG);
				return ERR_PTR(-E2BIG);
			l_new = container_of(l, struct htab_elem, fnode);
			l_new = container_of(l, struct htab_elem, fnode);
Loading