[PATCH bpf-next v10 2/7] bpf: Enable private stack for eligible subprogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If private stack is requested by any subprog, set that subprog
prog->aux->priv_stack_requested to be true so later jit can allocate
private stack for that subprog properly.

Also set env->prog->aux->priv_stack_requested to be true if
subprog[0] requests private stack. This is a use case for a
single main prog (no subprogs) to use private stack.

Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx>
---
 kernel/bpf/verifier.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 2284b909b499..09bb9dc939d6 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -6278,6 +6278,10 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)
 				return ret;
 		}
 	}
+
+	if (si[0].priv_stack_mode == PRIV_STACK_ADAPTIVE)
+		env->prog->aux->priv_stack_requested = true;
+
 	return 0;
 }
 
@@ -20211,6 +20215,9 @@ static int jit_subprogs(struct bpf_verifier_env *env)
 
 		func[i]->aux->name[0] = 'F';
 		func[i]->aux->stack_depth = env->subprog_info[i].stack_depth;
+		if (env->subprog_info[i].priv_stack_mode == PRIV_STACK_ADAPTIVE)
+			func[i]->aux->priv_stack_requested = true;
+
 		func[i]->jit_requested = 1;
 		func[i]->blinding_requested = prog->blinding_requested;
 		func[i]->aux->kfunc_tab = prog->aux->kfunc_tab;
-- 
2.43.5





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux