Commit 7968c65
bpf: verifier: Disambiguate get_constant_map_key() errors
Refactor get_constant_map_key() to disambiguate the constant key
value from potential error values. In the case that the key is
negative, it could be confused for an error.
It's not currently an issue, as the verifier seems to track s32 spills
as u32. So even if the program wrongly uses a negative value for an
arraymap key, the verifier just thinks it's an impossibly high value
which gets correctly discarded.
Refactor anyways to make things cleaner and prevent potential future
issues.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/dfe144259ae7cfc98aa63e1b388a14869a10632a.1738689872.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent 973cb13 commit 7968c65
1 file changed
Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9149 | 9149 | | |
9150 | 9150 | | |
9151 | 9151 | | |
9152 | | - | |
9153 | | - | |
| 9152 | + | |
| 9153 | + | |
9154 | 9154 | | |
9155 | | - | |
| 9155 | + | |
| 9156 | + | |
9156 | 9157 | | |
9157 | 9158 | | |
9158 | 9159 | | |
| |||
9179 | 9180 | | |
9180 | 9181 | | |
9181 | 9182 | | |
9182 | | - | |
| 9183 | + | |
| 9184 | + | |
9183 | 9185 | | |
| 9186 | + | |
9184 | 9187 | | |
9185 | 9188 | | |
9186 | 9189 | | |
| |||
9203 | 9206 | | |
9204 | 9207 | | |
9205 | 9208 | | |
9206 | | - | |
| 9209 | + | |
| 9210 | + | |
9207 | 9211 | | |
9208 | 9212 | | |
9209 | 9213 | | |
| |||
9357 | 9361 | | |
9358 | 9362 | | |
9359 | 9363 | | |
9360 | | - | |
9361 | | - | |
9362 | | - | |
| 9364 | + | |
| 9365 | + | |
| 9366 | + | |
| 9367 | + | |
| 9368 | + | |
| 9369 | + | |
| 9370 | + | |
| 9371 | + | |
9363 | 9372 | | |
9364 | 9373 | | |
9365 | 9374 | | |
| |||
0 commit comments