]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix bpf_prog_pack for multi-node setup
authorSong Liu <song@kernel.org>
Mon, 21 Mar 2022 18:00:08 +0000 (11:00 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 21 Mar 2022 20:53:45 +0000 (13:53 -0700)
commit00b41e93e289313bbd118155df3b4b1731c7d8df
treecb5323fa83da01aa49d7388482850e53fc6c627f
parent853e4faa517378f14537e47d9e9d8ff8f5f437d1
bpf: Fix bpf_prog_pack for multi-node setup

module_alloc requires num_online_nodes * PMD_SIZE to allocate huge pages.
bpf_prog_pack uses pack of size num_online_nodes * PMD_SIZE.
OTOH, module_alloc returns addresses that are PMD_SIZE aligned (instead of
num_online_nodes * PMD_SIZE aligned). Therefore, PMD_MASK should be used
to calculate pack_ptr in bpf_prog_pack_free().

Fixes: d632d3afc71d ("bpf: Select proper size for bpf_prog_pack")
Reported-by: syzbot+c946805b5ce6ab87df0b@syzkaller.appspotmail.com
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220321180009.1944482-2-song@kernel.org
kernel/bpf/core.c