bpf: Add per-program recursion prevention mechanism
Since both sleepable and non-sleepable programs execute under migrate_disable add recursion prevention mechanism to both types of programs when they're executed via bpf trampoline. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210210033634.62081-5-alexei.starovoitov@gmail.com
This commit is contained in:
committed by
Daniel Borkmann
parent
f2dd3b3946
commit
ca06f55b90
@@ -2,8 +2,8 @@
|
||||
/* Copyright (c) 2019 Facebook */
|
||||
#include <test_progs.h>
|
||||
|
||||
/* x86-64 fits 55 JITed and 43 interpreted progs into half page */
|
||||
#define CNT 40
|
||||
/* that's kernel internal BPF_MAX_TRAMP_PROGS define */
|
||||
#define CNT 38
|
||||
|
||||
void test_fexit_stress(void)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <test_progs.h>
|
||||
|
||||
#define MAX_TRAMP_PROGS 40
|
||||
#define MAX_TRAMP_PROGS 38
|
||||
|
||||
struct inst {
|
||||
struct bpf_object *obj;
|
||||
@@ -52,7 +52,7 @@ void test_trampoline_count(void)
|
||||
struct bpf_link *link;
|
||||
char comm[16] = {};
|
||||
|
||||
/* attach 'allowed' 40 trampoline programs */
|
||||
/* attach 'allowed' trampoline programs */
|
||||
for (i = 0; i < MAX_TRAMP_PROGS; i++) {
|
||||
obj = bpf_object__open_file(object, NULL);
|
||||
if (CHECK(IS_ERR(obj), "obj_open_file", "err %ld\n", PTR_ERR(obj))) {
|
||||
|
||||
Reference in New Issue
Block a user