diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2023-12-05 10:42:42 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-12-05 13:40:20 -0800 |
commit | eaf18febd6ebc381aeb61543705148b3e28c7c47 (patch) | |
tree | b3f296260d280b9473b456c33da8c9f0af649fd2 /tools/testing/selftests/bpf/progs | |
parent | ab125ed3ec1c10ccc36bc98c7a4256ad114a3dae (diff) |
bpf: preserve STACK_ZERO slots on partial reg spills
Instead of always forcing STACK_ZERO slots to STACK_MISC, preserve it in
situations where this is possible. E.g., when spilling register as
1/2/4-byte subslots on the stack, all the remaining bytes in the stack
slot do not automatically become unknown. If we knew they contained
zeroes, we can preserve those STACK_ZERO markers.
Add a helper mark_stack_slot_misc(), similar to scrub_spilled_slot(),
but that doesn't overwrite either STACK_INVALID nor STACK_ZERO. Note
that we need to take into account possibility of being in unprivileged
mode, in which case STACK_INVALID is forced to STACK_MISC for correctness,
as treating STACK_INVALID as equivalent STACK_MISC is only enabled in
privileged mode.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231205184248.1502704-5-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
0 files changed, 0 insertions, 0 deletions