OSDN Git Service

bpf: make direct packet write unclone more robust
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 24 Oct 2018 20:05:49 +0000 (22:05 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Oct 2018 00:02:06 +0000 (17:02 -0700)
commitb09928b976280d64060d7bee146d7df5c5a29bef
tree56255e6f507f2685a1ff991502711cdbe5de20e9
parentd3f66e4116aff8dd0d5bd4067295b9ddb5e2c29c
bpf: make direct packet write unclone more robust

Given this seems to be quite fragile and can easily slip through the
cracks, lets make direct packet write more robust by requiring that
future program types which allow for such write must provide a prologue
callback. In case of XDP and sk_msg it's noop, thus add a generic noop
handler there. The latter starts out with NULL data/data_end unconditionally
when sg pages are shared.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
net/core/filter.c