]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bpf: Enforce BPF ringbuf size to be the power of 2
authorAndrii Nakryiko <andriin@fb.com>
Tue, 30 Jun 2020 06:15:00 +0000 (23:15 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 30 Jun 2020 14:31:55 +0000 (16:31 +0200)
commit517bbe1994a3cee29a35c730662277bb5daff582
treee1c863b9b31b8101e280f2c8b8a5b1443f274c74
parent7e0245753f1794f17de472dcf4694fa5ed527384
bpf: Enforce BPF ringbuf size to be the power of 2

BPF ringbuf assumes the size to be a multiple of page size and the power of
2 value. The latter is important to avoid division while calculating position
inside the ring buffer and using (N-1) mask instead. This patch fixes omission
to enforce power-of-2 size rule.

Fixes: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200630061500.1804799-1-andriin@fb.com
kernel/bpf/ringbuf.c