Commit 34904582 authored by Brahmajit Das's avatar Brahmajit Das Committed by Alexei Starovoitov
Browse files

bpf: Skip scalar adjustment for BPF_NEG if dst is a pointer



In check_alu_op(), the verifier currently calls check_reg_arg() and
adjust_scalar_min_max_vals() unconditionally for BPF_NEG operations.
However, if the destination register holds a pointer, these scalar
adjustments are unnecessary and potentially incorrect.

This patch adds a check to skip the adjustment logic when the destination
register contains a pointer.

Reported-by: default avatar <syzbot+d36d5ae81e1b0a53ef58@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=d36d5ae81e1b0a53ef58


Fixes: aced1325 ("bpf: Add range tracking for BPF_NEG")
Suggested-by: default avatarKaFai Wan <kafai.wan@linux.dev>
Suggested-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Signed-off-by: default avatarBrahmajit Das <listout@listout.xyz>
Acked-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20251001191739.2323644-2-listout@listout.xyz


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 0c342bfc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment