mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
bpf: Compare iterator types during state pruning
An iterator stack slot can be MEM_RCU or PTR_UNTRUSTED. These states
must not be equal, or the verifier can prune an unsafe path.
Compare the pointer type for STACK_ITER slots.
Fixes: dfab99df14 ("bpf: teach the verifier to enforce css_iter and task_iter in RCU CS")
Signed-off-by: Ning Ding <dingning04@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://patch.msgid.link/20260811035955.132989-2-dingning04@gmail.com
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
This commit is contained in:
parent
d114bb9893
commit
83608e303b
|
|
@ -812,7 +812,8 @@ static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old,
|
|||
* infinite loop check triggering, see
|
||||
* iter_active_depths_differ()
|
||||
*/
|
||||
if (old_reg->iter.btf != cur_reg->iter.btf ||
|
||||
if (old_reg->type != cur_reg->type ||
|
||||
old_reg->iter.btf != cur_reg->iter.btf ||
|
||||
old_reg->iter.btf_id != cur_reg->iter.btf_id ||
|
||||
old_reg->iter.state != cur_reg->iter.state ||
|
||||
/* ignore {old_reg,cur_reg}->iter.depth, see above */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user