bpf: Add config to allow loading modules with BTF mismatches
authorConnor O'Brien <connoro@google.com>
Wed, 23 Feb 2022 01:28:14 +0000 (01:28 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 28 Feb 2022 13:17:10 +0000 (14:17 +0100)
commit5e214f2e43e453d862ebbbd2a4f7ee3fe650f209
tree457e120feecafe35cc3475dcd897f4f25dea12f1
parentdda7596c109fc382876118627e29db7607cde35d
bpf: Add config to allow loading modules with BTF mismatches

BTF mismatch can occur for a separately-built module even when the ABI is
otherwise compatible and nothing else would prevent successfully loading.

Add a new Kconfig to control how mismatches are handled. By default, preserve
the current behavior of refusing to load the module. If MODULE_ALLOW_BTF_MISMATCH
is enabled, load the module but ignore its BTF information.

Suggested-by: Yonghong Song <yhs@fb.com>
Suggested-by: Michal Suchánek <msuchanek@suse.de>
Signed-off-by: Connor O'Brien <connoro@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/CAADnVQJ+OVPnBz8z3vNu8gKXX42jCUqfuvhWAyCQDu8N_yqqwQ@mail.gmail.com
Link: https://lore.kernel.org/bpf/20220223012814.1898677-1-connoro@google.com
kernel/bpf/btf.c
lib/Kconfig.debug