]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix direct packet access for flow dissector progs
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 24 Oct 2018 20:05:45 +0000 (22:05 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Oct 2018 00:02:06 +0000 (17:02 -0700)
commitd94153a6b5b4763409fe35a067c2a44babc3f56f
treeda484f108d8b91eb463623140b1e9a497da3a94f
parentbdcf064f43ced02b1600c10bd69fad98f8051a1f
bpf: fix direct packet access for flow dissector progs

Commit 23513a901445 ("flow_dissector: implements flow dissector BPF
hook") added direct packet access for skbs in may_access_direct_pkt_data()
function where this enables read and write access to the skb->data. This
is buggy because without a prologue generator such as bpf_unclone_prologue()
we would allow for writing into cloned skbs. Original intention might have
been to only allow read access where this is not needed (similar as the
flow_dissector_func_proto() indicates which enables only bpf_skb_load_bytes()
as well), therefore this patch fixes it to restrict to read-only.

Fixes: 23513a901445 ("flow_dissector: implements flow dissector BPF hook")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Petar Penkov <ppenkov@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c