Commit 65633ed
bpf: Support private stack for struct_ops progs
For struct_ops progs, whether a particular prog uses private stack
depends on prog->aux->priv_stack_requested setting before actual
insn-level verification for that prog. One particular implementation
is to piggyback on struct_ops->check_member(). The next patch has
an example for this. The struct_ops->check_member() sets
prog->aux->priv_stack_requested to be true which enables private stack
usage.
The struct_ops prog follows the same rule as kprobe/tracing progs after
function bpf_enable_priv_stack(). For example, even a struct_ops prog
requests private stack, it could still use normal kernel stack if
the stack size is small (< 64 bytes).
The prog->aux->priv_stack_requested is also used for recursion checking
for struct_ops progs. Similar to tracing progs, nested same cpu same
prog run will be skipped. A field (recursion_detected()) is added to
bpf_prog_aux structure. If bpf_prog->aux->recursion_detected
is implemented by the struct_ops subsystem and nested same cpu/prog
happens, the function will be triggered to report an error, collect
related info, etc.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>1 parent a502b69 commit 65633ed
File tree
4 files changed
+12
-0
lines changed- include/linux
- kernel/bpf
4 files changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1528 | 1528 | | |
1529 | 1529 | | |
1530 | 1530 | | |
| 1531 | + | |
1531 | 1532 | | |
1532 | 1533 | | |
1533 | 1534 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
898 | 899 | | |
899 | 900 | | |
900 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
902 | 904 | | |
903 | 905 | | |
904 | 906 | | |
| |||
975 | 977 | | |
976 | 978 | | |
977 | 979 | | |
| 980 | + | |
| 981 | + | |
978 | 982 | | |
979 | 983 | | |
980 | 984 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6279 | 6279 | | |
6280 | 6280 | | |
6281 | 6281 | | |
| 6282 | + | |
6282 | 6283 | | |
6283 | 6284 | | |
6284 | 6285 | | |
| |||
21986 | 21987 | | |
21987 | 21988 | | |
21988 | 21989 | | |
| 21990 | + | |
| 21991 | + | |
| 21992 | + | |
| 21993 | + | |
| 21994 | + | |
21989 | 21995 | | |
21990 | 21996 | | |
21991 | 21997 | | |
| |||
0 commit comments