diff options
author | 2024-11-12 08:39:22 -0800 | |
---|---|---|
committer | 2024-11-12 16:26:24 -0800 | |
commit | 7d1cd70d4b16ff0216a5f6c2ae7d0fa9fa978c07 (patch) | |
tree | 772fbcbc6b3be0d76d2625399776a2e048e8e8c0 /tools/perf/scripts/python/call-graph-from-postgresql.py | |
parent | bpf, x86: Avoid repeated usage of bpf_prog->aux->stack_depth (diff) | |
download | wireguard-linux-7d1cd70d4b16ff0216a5f6c2ae7d0fa9fa978c07.tar.xz wireguard-linux-7d1cd70d4b16ff0216a5f6c2ae7d0fa9fa978c07.zip |
bpf, x86: Support private stack in jit
Private stack is allocated in function bpf_int_jit_compile() with
alignment 8. Private stack allocation size includes the stack size
determined by verifier and additional space to protect stack overflow
and underflow. See below an illustration:
---> memory address increasing
[8 bytes to protect overflow] [normal stack] [8 bytes to protect underflow]
If overflow/underflow is detected, kernel messages will be
emited in dmesg like
BPF private stack overflow/underflow detected for prog Fx
BPF Private stack overflow/underflow detected for prog bpf_prog_a41699c234a1567a_subprog1x
Those messages are generated when I made some changes to jitted code
to intentially cause overflow for some progs.
For the jited prog, The x86 register 9 (X86_REG_R9) is used to replace
bpf frame register (BPF_REG_10). The private stack is used per
subprog per cpu. The X86_REG_R9 is saved and restored around every
func call (not including tailcall) to maintain correctness of
X86_REG_R9.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20241112163922.2224385-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/call-graph-from-postgresql.py')
0 files changed, 0 insertions, 0 deletions