diff options
author | John Fastabend <john.fastabend@gmail.com> | 2017-10-18 10:10:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-20 08:01:29 -0400 |
commit | f7e9cb1ecb6d922584abff16db07930162c57155 (patch) | |
tree | 3686d4b38db981a9289725f9c9aed66ed59b7607 /tools | |
parent | 34f79502bbcfab659b8729da68b5e387f96eb4c1 (diff) |
bpf: remove mark access for SK_SKB program types
The skb->mark field is a union with reserved_tailroom which is used
in the TCP code paths from stream memory allocation. Allowing SK_SKB
programs to set this field creates a conflict with future code
optimizations, such as "gifting" the skb to the egress path instead
of creating a new skb and doing a memcpy.
Because we do not have a released version of SK_SKB yet lets just
remove it for now. A more appropriate scratch pad to use at the
socket layer is dev_scratch, but lets add that in future kernels
when needed.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/bpf/test_verifier.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 3c7d3a45a3c5..50e15cedbb7f 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
@@ -1130,15 +1130,27 @@ static struct bpf_test tests[] = { | |||
1130 | .errstr = "invalid bpf_context access", | 1130 | .errstr = "invalid bpf_context access", |
1131 | }, | 1131 | }, |
1132 | { | 1132 | { |
1133 | "check skb->mark is writeable by SK_SKB", | 1133 | "invalid access of skb->mark for SK_SKB", |
1134 | .insns = { | ||
1135 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, | ||
1136 | offsetof(struct __sk_buff, mark)), | ||
1137 | BPF_EXIT_INSN(), | ||
1138 | }, | ||
1139 | .result = REJECT, | ||
1140 | .prog_type = BPF_PROG_TYPE_SK_SKB, | ||
1141 | .errstr = "invalid bpf_context access", | ||
1142 | }, | ||
1143 | { | ||
1144 | "check skb->mark is not writeable by SK_SKB", | ||
1134 | .insns = { | 1145 | .insns = { |
1135 | BPF_MOV64_IMM(BPF_REG_0, 0), | 1146 | BPF_MOV64_IMM(BPF_REG_0, 0), |
1136 | BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, | 1147 | BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, |
1137 | offsetof(struct __sk_buff, mark)), | 1148 | offsetof(struct __sk_buff, mark)), |
1138 | BPF_EXIT_INSN(), | 1149 | BPF_EXIT_INSN(), |
1139 | }, | 1150 | }, |
1140 | .result = ACCEPT, | 1151 | .result = REJECT, |
1141 | .prog_type = BPF_PROG_TYPE_SK_SKB, | 1152 | .prog_type = BPF_PROG_TYPE_SK_SKB, |
1153 | .errstr = "invalid bpf_context access", | ||
1142 | }, | 1154 | }, |
1143 | { | 1155 | { |
1144 | "check skb->tc_index is writeable by SK_SKB", | 1156 | "check skb->tc_index is writeable by SK_SKB", |