Commit a1aca22
Alexei Starovoitov
Merge branch 'bpf-fix-verifier-crash-on-bpf_neg-with-pointer-register'
Brahmajit Das says:
====================
bpf: Fix verifier crash on BPF_NEG with pointer register
This patch fixes a crash in the BPF verifier triggered when the BPF_NEG
operation is applied to a pointer-typed register. The verifier now
checks that the destination register is not a pointer before performing
the operation.
Tested with syzkaller reproducer and new BPF sefltest.
Closes: https://syzkaller.appspot.com/bug?extid=d36d5ae81e1b0a53ef58
Changes v4:
Cleaning up, instead of using __is_pointer_value it's further
simplified by checking if regs[insn->dst_reg].type of SCALAR_VALUE
Link:
Changes in v3:
using __is_pointer_value to check if register if of pointer type
Link: https://lore.kernel.org/all/20251001095613.267475-1-listout@listout.xyz/
Changes in v2:
Checking if reg->map_ptr is NULL in bpf/log.c but with cleaner approach
(wrong approach)
Link: https://lore.kernel.org/all/20250923174738.1713751-1-listout@listout.xyz/
Changes in v1:
Checking if reg->map_ptr is NULL in bpf/log.c (wrong approach)
Link: https://lore.kernel.org/all/20250923164144.1573636-1-listout@listout.xyz/
====================
Link: https://patch.msgid.link/20251001191739.2323644-1-listout@listout.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>File tree
2 files changed
+20
-1
lines changed- kernel/bpf
- tools/testing/selftests/bpf/progs
2 files changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15645 | 15645 | | |
15646 | 15646 | | |
15647 | 15647 | | |
15648 | | - | |
| 15648 | + | |
| 15649 | + | |
15649 | 15650 | | |
15650 | 15651 | | |
15651 | 15652 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
149 | 167 | | |
150 | 168 | | |
151 | 169 | | |
| |||
0 commit comments