linux-stable/tools
Hou Tao 927cbb478a libbpf: Handle size overflow for ringbuf mmap
The maximum size of ringbuf is 2GB on x86-64 host, so 2 * max_entries
will overflow u32 when mapping producer page and data pages. Only
casting max_entries to size_t is not enough, because for 32-bits
application on 64-bits kernel the size of read-only mmap region
also could overflow size_t.

So fixing it by casting the size of read-only mmap region into a __u64
and checking whether or not there will be overflow during mmap.

Fixes: bf99c936f9 ("libbpf: Add BPF ring buffer support")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221116072351.1168938-3-houtao@huaweicloud.com
2022-11-17 15:48:50 -08:00
..
accounting
arch tools headers cpufeatures: Sync with the kernel sources 2022-10-25 17:40:48 -03:00
bootconfig
bpf bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE 2022-11-02 12:05:42 +01:00
build perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available 2022-10-25 17:40:48 -03:00
certs
cgroup
counter
debugging
edid
firewire
firmware
gpio
hv
iio tools: iio: iio_utils: fix digit calculation 2022-10-17 08:51:26 +01:00
include bpf-for-netdev 2022-11-03 19:51:02 -07:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Handle size overflow for ringbuf mmap 2022-11-17 15:48:50 -08:00
memory-model
objtool - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
pci
pcmcia
perf perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics 2022-10-26 11:01:56 -03:00
power pm-graph v5.10 2022-10-25 17:46:15 +02:00
rcu
scripts
spi
testing Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2022-11-11 18:27:40 -08:00
thermal
time
tracing
usb
verification rv/dot2c: Make automaton definition static 2022-10-20 16:02:45 -04:00
virtio
vm
wmi
Makefile