Revert "selftests/bpf: validate that tail call invalidates packet pointers"
This reverts commit b7c0d2d4ef
which is
commit d9706b56e13b7916461ca6b4b731e169ed44ed09 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: Idc87be361a116e8167341bce65c022dfddea3dd3
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -50,13 +50,6 @@ struct {
|
||||
__uint(map_flags, BPF_F_NO_PREALLOC);
|
||||
} sk_storage_map SEC(".maps");
|
||||
|
||||
struct {
|
||||
__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
|
||||
__uint(max_entries, 1);
|
||||
__uint(key_size, sizeof(__u32));
|
||||
__uint(value_size, sizeof(__u32));
|
||||
} jmp_table SEC(".maps");
|
||||
|
||||
SEC("cgroup/skb")
|
||||
__description("skb->sk: no NULL check")
|
||||
__failure __msg("invalid mem access 'sock_common_or_null'")
|
||||
@@ -1012,25 +1005,4 @@ int invalidate_pkt_pointers_from_global_func(struct __sk_buff *sk)
|
||||
return TCX_PASS;
|
||||
}
|
||||
|
||||
__noinline
|
||||
int tail_call(struct __sk_buff *sk)
|
||||
{
|
||||
bpf_tail_call_static(sk, &jmp_table, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Tail calls invalidate packet pointers. */
|
||||
SEC("tc")
|
||||
__failure __msg("invalid mem access")
|
||||
int invalidate_pkt_pointers_by_tail_call(struct __sk_buff *sk)
|
||||
{
|
||||
int *p = (void *)(long)sk->data;
|
||||
|
||||
if ((void *)(p + 1) > (void *)(long)sk->data_end)
|
||||
return TCX_DROP;
|
||||
tail_call(sk);
|
||||
*p = 42; /* this is unsafe */
|
||||
return TCX_PASS;
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
Reference in New Issue
Block a user