Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1430206
| From | Martin KaFai Lau <kafai@fb.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto |
| Date | 2016-06-23 23:50 +0200 |
| Message-ID | <rNkFA-7yS-25@gated-at.bofh.it> (permalink) |
| References | <rMXIZ-iE-3@gated-at.bofh.it> <rMXIZ-iE-9@gated-at.bofh.it> <rN9At-86a-21@gated-at.bofh.it> <rNg8V-4lU-7@gated-at.bofh.it> <rNj6N-6Ez-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 23, 2016 at 10:07:27PM +0200, Daniel Borkmann wrote: > On 06/23/2016 06:54 PM, Martin KaFai Lau wrote: > >On Thu, Jun 23, 2016 at 11:53:50AM +0200, Daniel Borkmann wrote: > >>>diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > >>>index 668e079..68753e0 100644 > >>>--- a/kernel/bpf/verifier.c > >>>+++ b/kernel/bpf/verifier.c > >>>@@ -1062,6 +1062,10 @@ static int check_map_func_compatibility(struct bpf_map *map, int func_id) > >>> if (func_id != BPF_FUNC_get_stackid) > >>> goto error; > >>> break; > >>>+ case BPF_MAP_TYPE_CGROUP_ARRAY: > >>>+ if (func_id != BPF_FUNC_skb_in_cgroup) > >>>+ goto error; > >>>+ break; > >> > >>I think the BPF_MAP_TYPE_CGROUP_ARRAY case should have been fist here in > >>patch 2/4, but with unconditional goto error. And this one only adds the > >>'func_id != BPF_FUNC_skb_in_cgroup' test. > >I am not sure I understand. Can you elaborate? I am probably missing > >something here. > > If someone backports patch 2/4 as-is, but for some reason not 3/4, then you > could craft a program that calls f.e. bpf_map_update_elem() on a cgroup array > and would thus cause a NULL pointer deref, since verifier doesn't prevent it. > I'm just trying to say that it would probably make sense to add the above 'case > BPF_MAP_TYPE_CGROUP_ARRAY:' with an unconditional 'goto error' in patch 2/4 > and extend upon it in patch 3/4 so result looks like here, so that the patches > are fine/complete each as stand-alone. I failed to connect some points in your last comment. Thanks for explaining. Make sense. I will spin v3.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next v2 0/4] cgroup: bpf: cgroup2 membership test on skb Martin KaFai Lau <kafai@fb.com> - 2016-06-22 23:20 +0200
[PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto Martin KaFai Lau <kafai@fb.com> - 2016-06-22 23:20 +0200
Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto Daniel Borkmann <daniel@iogearbox.net> - 2016-06-23 12:00 +0200
Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto Martin KaFai Lau <kafai@fb.com> - 2016-06-23 19:00 +0200
Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto Daniel Borkmann <daniel@iogearbox.net> - 2016-06-23 22:10 +0200
Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto Martin KaFai Lau <kafai@fb.com> - 2016-06-23 23:50 +0200
Re: [PATCH net-next v2 3/4] cgroup: bpf: Add bpf_skb_in_cgroup_proto kbuild test robot <lkp@intel.com> - 2016-06-29 16:40 +0200
[PATCH net-next v2 4/4] cgroup: bpf: Add an example to do cgroup checking in BPF Martin KaFai Lau <kafai@fb.com> - 2016-06-22 23:20 +0200
Re: [PATCH net-next v2 4/4] cgroup: bpf: Add an example to do cgroup checking in BPF Daniel Borkmann <daniel@iogearbox.net> - 2016-06-23 12:00 +0200
csiph-web