diff options
author | Peter Zijlstra <peterz@infradead.org> | 2023-12-15 10:12:22 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-12-16 01:25:55 +0100 |
commit | e4c00339891c074c76f626ac82981963cbba5332 (patch) | |
tree | 4f2231383a2360a9fa0d7e8841343c8c69e2b164 /kernel/bpf/cpumask.c | |
parent | cfi: Add CFI_NOSEAL() (diff) | |
download | linux-e4c00339891c074c76f626ac82981963cbba5332.tar.xz linux-e4c00339891c074c76f626ac82981963cbba5332.zip |
bpf: Fix dtor CFI
Ensure the various dtor functions match their prototype and retain
their CFI signatures, since they don't have their address taken, they
are prone to not getting CFI, making them impossible to call
indirectly.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231215092707.799451071@infradead.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/cpumask.c')
-rw-r--r-- | kernel/bpf/cpumask.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/bpf/cpumask.c b/kernel/bpf/cpumask.c index 7499b7d8c06f..2e73533a3811 100644 --- a/kernel/bpf/cpumask.c +++ b/kernel/bpf/cpumask.c @@ -96,6 +96,12 @@ __bpf_kfunc void bpf_cpumask_release(struct bpf_cpumask *cpumask) migrate_enable(); } +__bpf_kfunc void bpf_cpumask_release_dtor(void *cpumask) +{ + bpf_cpumask_release(cpumask); +} +CFI_NOSEAL(bpf_cpumask_release_dtor); + /** * bpf_cpumask_first() - Get the index of the first nonzero bit in the cpumask. * @cpumask: The cpumask being queried. @@ -453,7 +459,7 @@ static const struct btf_kfunc_id_set cpumask_kfunc_set = { BTF_ID_LIST(cpumask_dtor_ids) BTF_ID(struct, bpf_cpumask) -BTF_ID(func, bpf_cpumask_release) +BTF_ID(func, bpf_cpumask_release_dtor) static int __init cpumask_kfunc_init(void) { |