BPF List
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/2] Fix hashmap overflow checks for 32-bit arches
@ 2024-02-29 11:22 Toke Høiland-Jørgensen
  2024-02-29 11:22 ` [PATCH bpf v2 1/2] bpf: Fix DEVMAP_HASH overflow check on " Toke Høiland-Jørgensen
  2024-02-29 11:22 ` [PATCH bpf v2 2/2] bpf: Fix hashtab " Toke Høiland-Jørgensen
  0 siblings, 2 replies; 13+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-02-29 11:22 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Toke Høiland-Jørgensen
  Cc: Jesper Dangaard Brouer, netdev, bpf

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.

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 (2):
  bpf: Fix DEVMAP_HASH overflow check on 32-bit arches
  bpf: Fix hashtab overflow check on 32-bit arches

 kernel/bpf/devmap.c  |  8 +++-----
 kernel/bpf/hashtab.c | 10 +++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

-- 
2.43.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-03-07 12:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 11:22 [PATCH bpf v2 0/2] Fix hashmap overflow checks for 32-bit arches Toke Høiland-Jørgensen
2024-02-29 11:22 ` [PATCH bpf v2 1/2] bpf: Fix DEVMAP_HASH overflow check on " Toke Høiland-Jørgensen
2024-02-29 11:22 ` [PATCH bpf v2 2/2] bpf: Fix hashtab " Toke Høiland-Jørgensen
2024-02-29 17:07   ` Alexei Starovoitov
2024-02-29 22:21     ` John Fastabend
2024-03-01 12:35       ` Toke Høiland-Jørgensen
2024-03-01 17:15         ` Alexei Starovoitov
2024-03-04 13:02           ` Toke Høiland-Jørgensen
2024-03-06  5:29             ` Alexei Starovoitov
2024-03-06 10:32               ` Toke Høiland-Jørgensen
2024-03-06 16:53                 ` Alexei Starovoitov
2024-03-07 12:00                   ` Toke Høiland-Jørgensen
2024-03-01 17:21         ` John Fastabend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox