libbpf: Use page size as max_entries when probing ring buffer map
authorHou Tao <houtao1@huawei.com>
Wed, 16 Nov 2022 07:23:48 +0000 (15:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Dec 2022 11:27:31 +0000 (12:27 +0100)
commit5cb4abb0caa586859e56c71a6c44882e451a980a
tree131756bfa92ec3a887f8f3a4c691d59b54a57128
parent50b5f6d4d9d2d69a7498c44fd8b26e13d73d3d98
libbpf: Use page size as max_entries when probing ring buffer map

[ Upstream commit 689eb2f1ba46b4b02195ac2a71c55b96d619ebf8 ]

Using page size as max_entries when probing ring buffer map, else the
probe may fail on host with 64KB page size (e.g., an ARM64 host).

After the fix, the output of "bpftool feature" on above host will be
correct.

Before :
    eBPF map_type ringbuf is NOT available
    eBPF map_type user_ringbuf is NOT available

After :
    eBPF map_type ringbuf is available
    eBPF map_type user_ringbuf is available

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221116072351.1168938-2-houtao@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf_probes.c