WSL2-Linux-Kernel/tools
Hou Tao 0140e079a4 libbpf: Handle size overflow for ringbuf mmap
[ Upstream commit 927cbb478a ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-08 11:28:39 +01:00
..
accounting
arch x86/cpu: Restore AMD's DE_CFG MSR after resume 2022-11-16 09:58:31 +01:00
bootconfig
bpf bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE 2022-11-16 09:58:15 +01:00
build
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio tools: iio: iio_generic_buffer: Fix read size 2022-12-02 17:41:10 +01:00
include tools/nolibc/string: Fix memcmp() implementation 2022-11-10 18:15:38 +01:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Handle size overflow for ringbuf mmap 2022-12-08 11:28:39 +01:00
memory-model
objtool
pci
pcmcia
perf perf tools: Add the include/perf/ directory to .gitignore 2022-11-16 09:58:20 +01:00
power
rcu
scripts
spi
testing selftests: mptcp: fix mibit vs mbit mix up 2022-12-02 17:41:03 +01:00
thermal/tmon
time
tracing
usb
virtio
vm
wmi
Makefile