]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Sanitize BTF data pointer after module is loaded
authorAndrii Nakryiko <andrii@kernel.org>
Sat, 21 Nov 2020 07:08:29 +0000 (23:08 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 24 Nov 2020 23:05:21 +0000 (00:05 +0100)
commita5b690c3b0b7551b1fa80cb3c93d1165365e388f
tree68d4e048d6674a4f926e9b53166e53e5063919ab
parent9e3142d5e3b147829e62e88eb6277ff2e09a8e46
bpf: Sanitize BTF data pointer after module is loaded

Given .BTF section is not allocatable, it will get trimmed after module is
loaded. BPF system handles that properly by creating an independent copy of
data. But prevent any accidental misused by resetting the pointer to BTF data.

Fixes: 1e772326c4aa ("bpf: Load and verify kernel module BTFs")
Suggested-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jessica Yu <jeyu@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/bpf/20201121070829.2612884-2-andrii@kernel.org
kernel/module.c