Fix hash bucket overflow checks for 32-bit arches
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 4 repliesIn review 2 of 3 applied
- v22 patches 10 repliesSuperseded
- v11 patch 5 repliesSuperseded
Changes in v3 from the cover letter
- Keep the htab->n_buckets > U32_MAX / sizeof(struct bucket) check
- Use 1UL << 31 instead of U32_MAX / 2 + 1 as the constant to check against
- Add patch to fix stackmap.c
Patches in v3 2 of 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | bpf: Fix DEVMAP_HASH overflow check on 32-bit archeskernel/ | +6 | 0 replies | Applied |
| 2/3 | bpf: Fix hashtab overflow check on 32-bit archeskernel/ | +9 | 2 replies | |
| 3/3 | bpf: Fix stackmap overflow check on 32-bit archeskernel/ | +6 | 2 replies | Applied |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by.
| Patch | [email protected] | Bui Quang Minh |
|---|---|---|
| 1/3 | Reported-and-tested-by | |
| 2/3 | ||
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf v3 0/3] Fix hash bucket overflow checks for 32-bit arches
Syzbot managed to trigger a crash by creating a DEVMAP_HASH map with a large number of buckets because the overflow check relies on well-defined behaviour that is only correct on 64-bit arches.
Fix the overflow checks to happen before values are rounded up in all the affected map types.
v3:
- Keep the htab->n_buckets > U32_MAX / sizeof(struct bucket) check
- Use 1UL << 31 instead of U32_MAX / 2 + 1 as the constant to check against
- Add patch to fix stackmap.c
v2:
- Fix off-by-one error in overflow check
- Apply the same fix to hashtab, where the devmap_hash code was copied from (John)
Toke Høiland-Jørgensen (3):
bpf: Fix DEVMAP_HASH overflow check on 32-bit arches
bpf: Fix hashtab overflow check on 32-bit arches
bpf: Fix stackmap overflow check on 32-bit arches
kernel/bpf/devmap.c | 11 ++++++----- kernel/bpf/hashtab.c | 14 +++++++++----- kernel/bpf/stackmap.c | 9 ++++++--- 3 files changed, 21 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.2