Commit f7fbedc
bpf: Ensure off_reg has no mixed signed bounds for all types
commit 24c109b upstream.
The mixed signed bounds check really belongs into retrieve_ptr_limit()
instead of outside of it in adjust_ptr_min_max_vals(). The reason is
that this check is not tied to PTR_TO_MAP_VALUE only, but to all pointer
types that we handle in retrieve_ptr_limit() and given errors from the latter
propagate back to adjust_ptr_min_max_vals() and lead to rejection of the
program, it's a better place to reside to avoid anything slipping through
for future types. The reason why we must reject such off_reg is that we
otherwise would not be able to derive a mask, see details in 9d7ecee
("bpf: restrict unknown scalars of mixed signed bounds for unprivileged").
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[fllinden@amazon.com: backport to 5.4]
Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 4a163b1 commit f7fbedc
1 file changed
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4264 | 4264 | | |
4265 | 4265 | | |
4266 | 4266 | | |
4267 | | - | |
| 4267 | + | |
| 4268 | + | |
4268 | 4269 | | |
| 4270 | + | |
4269 | 4271 | | |
4270 | 4272 | | |
4271 | 4273 | | |
4272 | 4274 | | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
4273 | 4279 | | |
4274 | 4280 | | |
4275 | 4281 | | |
| |||
4363 | 4369 | | |
4364 | 4370 | | |
4365 | 4371 | | |
4366 | | - | |
| 4372 | + | |
4367 | 4373 | | |
4368 | 4374 | | |
4369 | 4375 | | |
| |||
4408 | 4414 | | |
4409 | 4415 | | |
4410 | 4416 | | |
4411 | | - | |
4412 | 4417 | | |
| 4418 | + | |
4413 | 4419 | | |
4414 | 4420 | | |
4415 | 4421 | | |
| |||
4452 | 4458 | | |
4453 | 4459 | | |
4454 | 4460 | | |
4455 | | - | |
4456 | | - | |
4457 | | - | |
4458 | | - | |
4459 | | - | |
4460 | | - | |
4461 | | - | |
4462 | 4461 | | |
4463 | 4462 | | |
4464 | 4463 | | |
| |||
0 commit comments