Commit 8299559
bpf: Fix verifier log for async callback return values
The verifier, as part of check_return_code(), verifies that async
callbacks such as from e.g. timers, will return 0. It does this by
correctly checking that R0->var_off is in tnum_const(0), which
effectively checks that it's in a range of 0. If this condition fails,
however, it prints an error message which says that the value should
have been in (0x0; 0x1). This results in possibly confusing output such
as the following in which an async callback returns 1:
At async callback the register R0 has value (0x1; 0x0) should have been in (0x0; 0x1)
The fix is easy -- we should just pass the tnum_const(0) as the correct
range to verbose_invalid_scalar(), which will then print the following:
At async callback the register R0 has value (0x1; 0x0) should have been in (0x0; 0x0)
Fixes: bfc6bb7 ("bpf: Implement verifier support for validation of async callbacks.")
Signed-off-by: David Vernet <void@manifault.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20231009161414.235829-1-void@manifault.com1 parent a12bbb3 commit 8299559
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14479 | 14479 | | |
14480 | 14480 | | |
14481 | 14481 | | |
14482 | | - | |
| 14482 | + | |
14483 | 14483 | | |
14484 | 14484 | | |
14485 | 14485 | | |
| |||
14527 | 14527 | | |
14528 | 14528 | | |
14529 | 14529 | | |
14530 | | - | |
14531 | | - | |
| 14530 | + | |
| 14531 | + | |
14532 | 14532 | | |
14533 | 14533 | | |
14534 | 14534 | | |
| |||
0 commit comments