BPF backports for CVE-2021-29155
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | bpf: Move off_reg into sanitize_ptr_alukernel/ | +5 | 0 replies | |
| 2/8 | bpf: Ensure off_reg has no mixed signed bounds for all typeskernel/ | +9 | 0 replies | |
| 3/8 | bpf: Rework ptr_limit into alu_limit and add common error pathkernel/ | +13 | 0 replies | |
| 4/8 | bpf: Improve verifier error messages for userskernel/ | +62 | 0 replies | |
| 5/8 | bpf: Refactor and streamline bounds check into helperkernel/ | +37 | 0 replies | |
| 6/8 | bpf: Move sanitize_val_alu out of op switchkernel/ | +10 | 0 replies | |
| 7/8 | bpf: Tighten speculative pointer arithmetic maskkernel/ | +44 | 0 replies | |
| 8/8 | bpf: Update selftests to reflect new error statestools/ tools/ tools/ +1 more | +14 | 0 replies |
Reviews trailers per patch
All 8 patches have a Reviewed-by or Acked-by.
| Patch | John Fastabend | Alexei Starovoitov | Benedict Schlueter |
|---|---|---|---|
| 1/8 | R-b | A-b | |
| 2/8 | R-b | A-b | |
| 3/8 | R-b | A-b | |
| 4/8 | R-b | A-b | |
| 5/8 | R-b | A-b | |
| 6/8 | R-b | A-b | |
| 7/8 | R-b | A-b | T-b |
| 8/8 | R-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH 5.4 0/8] BPF backports for CVE-2021-29155
This is a backport of the BPF verifier fixes for CVE-2021-29155. Original
series was part of the pull request here: https://lore.kernel.org/bpf/[email protected]/T/
This wasn't a complicated backport, but copying bpf@ to see if there are any concerns.
5.4 verifier selftests are clean with this backport:
Summary: 1566 PASSED, 0 SKIPPED, 0 FAILED
The individual commits:
960114839252 ("bpf: Use correct permission flag for mixed signed bounds arithmetic")
* Not applicable to 5.4, as 5.4 does not have
2c78ee898d8f ("bpf: Implement CAP_BPF").6f55b2f2a117 ("bpf: Move off_reg into sanitize_ptr_alu")
* Clean cherry-pick.
24c109bb1537 ("bpf: Ensure off_reg has no mixed signed bounds for all types")
* Conflict: allow_ptr_leaks was replaced by bypass_spec_v1 in the deleted PTR_TO_MAP_VALUE switch case by
2c78ee898d8f ("bpf: Implement CAP_BPF"). Resolution is easy, the case statement gets deleted either way.
b658bbb844e2 ("bpf: Rework ptr_limit into alu_limit and add common error path")
* Clean cherry-pick.
a6aaece00a57 ("bpf: Improve verifier error messages for users")
* Resolved simple contextual conflict in adjust_scalar_min_max_vals(). because of a var declaration that was added by this post-5.4 commit:
3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking").
073815b756c5 ("bpf: Refactor and streamline bounds check into helper")
* Conflict: another allow_ptr_leaks that was replaced with bypass_spec_v1 after 2c78ee898d8f.
* Conflict: Post-5.4 commit
01f810ace9ed ("bpf: Allow variable-offset stack access") changed the call to check_stack_access to a new function, check_stack_access_for_ptr_arithmetic(), and moved/changed an error message.
* Since this commit just factors out some code from adjust_ptr_min_max_vals() in to a new function, do the same with the corresponding block in 5.4 that doesn't have the changes listed above from post-5.4 commits.
f528819334 ("bpf: Move sanitize_val_alu out of op switch")
* Contextual conflict from post-5.4 commit
3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking"), that added a comment on top of the switch referenced in the commit message.
7fedb63a8307 ("bpf: Tighten speculative pointer arithmetic mask")
* Contextual conflict post-5.4 commit:
3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking") added a call to a new function just above the switch statement in adjust_ptr_min_max_vals. This doesn't affect the lines that were actually changed.
d7a509135175 ("bpf: Update selftests to reflect new error states")
* The bounds.c tests have undergone several changes since 5.4, related to commits that were not backported (like e.g. the ALU32 changes). The error messages for those tests will remain the same on 5.4.
=====
Daniel Borkmann (8):
bpf: Move off_reg into sanitize_ptr_alu
bpf: Ensure off_reg has no mixed signed bounds for all types
bpf: Rework ptr_limit into alu_limit and add common error path
bpf: Improve verifier error messages for users
bpf: Refactor and streamline bounds check into helper
bpf: Move sanitize_val_alu out of op switch
bpf: Tighten speculative pointer arithmetic mask
bpf: Update selftests to reflect new error states
kernel/bpf/verifier.c | 233 ++++++++++++------ .../selftests/bpf/verifier/bounds_deduction.c | 21 +- .../bpf/verifier/bounds_mix_sign_unsign.c | 13 - tools/testing/selftests/bpf/verifier/unpriv.c | 2 +- .../selftests/bpf/verifier/value_ptr_arith.c | 6 +- 5 files changed, 173 insertions(+), 102 deletions(-)
Signature · 1 line
2.23.3