-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel…
…/git/bpf/bpf-next Alexei Starovoitov says: ==================== pull-request: bpf-next 2023-04-24 We've added 5 non-merge commits during the last 3 day(s) which contain a total of 7 files changed, 87 insertions(+), 44 deletions(-). The main changes are: 1) Workaround for bpf iter selftest due to lack of subprog support in precision tracking, from Andrii. 2) Disable bpf_refcount_acquire kfunc until races are fixed, from Dave. 3) One more test_verifier test converted from asm macro to asm in C, from Eduard. 4) Fix build with NETFILTER=y INET=n config, from Florian. 5) Add __rcu_read_{lock,unlock} into deny list, from Yafang. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: selftests/bpf: avoid mark_all_scalars_precise() trigger in one of iter tests bpf: Add __rcu_read_{lock,unlock} into btf id deny list bpf: Disable bpf_refcount_acquire kfunc calls until race conditions are fixed selftests/bpf: verifier/prevent_map_lookup converted to inline assembly bpf: fix link failure with NETFILTER=y INET=n ==================== Link: https://lore.kernel.org/r/20230425005648.86714-1-alexei.starovoitov@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Showing
7 changed files
with
87 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
tools/testing/selftests/bpf/progs/verifier_prevent_map_lookup.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Converted from tools/testing/selftests/bpf/verifier/prevent_map_lookup.c */ | ||
|
||
#include <linux/bpf.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include "bpf_misc.h" | ||
|
||
struct { | ||
__uint(type, BPF_MAP_TYPE_STACK_TRACE); | ||
__uint(max_entries, 1); | ||
__type(key, __u32); | ||
__type(value, __u64); | ||
} map_stacktrace SEC(".maps"); | ||
|
||
struct { | ||
__uint(type, BPF_MAP_TYPE_PROG_ARRAY); | ||
__uint(max_entries, 8); | ||
__uint(key_size, sizeof(int)); | ||
__array(values, void (void)); | ||
} map_prog2_socket SEC(".maps"); | ||
|
||
SEC("perf_event") | ||
__description("prevent map lookup in stack trace") | ||
__failure __msg("cannot pass map_type 7 into func bpf_map_lookup_elem") | ||
__naked void map_lookup_in_stack_trace(void) | ||
{ | ||
asm volatile (" \ | ||
r1 = 0; \ | ||
*(u64*)(r10 - 8) = r1; \ | ||
r2 = r10; \ | ||
r2 += -8; \ | ||
r1 = %[map_stacktrace] ll; \ | ||
call %[bpf_map_lookup_elem]; \ | ||
exit; \ | ||
" : | ||
: __imm(bpf_map_lookup_elem), | ||
__imm_addr(map_stacktrace) | ||
: __clobber_all); | ||
} | ||
|
||
SEC("socket") | ||
__description("prevent map lookup in prog array") | ||
__failure __msg("cannot pass map_type 3 into func bpf_map_lookup_elem") | ||
__failure_unpriv | ||
__naked void map_lookup_in_prog_array(void) | ||
{ | ||
asm volatile (" \ | ||
r1 = 0; \ | ||
*(u64*)(r10 - 8) = r1; \ | ||
r2 = r10; \ | ||
r2 += -8; \ | ||
r1 = %[map_prog2_socket] ll; \ | ||
call %[bpf_map_lookup_elem]; \ | ||
exit; \ | ||
" : | ||
: __imm(bpf_map_lookup_elem), | ||
__imm_addr(map_prog2_socket) | ||
: __clobber_all); | ||
} | ||
|
||
char _license[] SEC("license") = "GPL"; |
This file was deleted.
Oops, something went wrong.