]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: crypto: Use the correct destructor kfunc type
authorSami Tolvanen <samitolvanen@google.com>
Sat, 10 Jan 2026 08:25:50 +0000 (08:25 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 13 Jan 2026 02:53:57 +0000 (18:53 -0800)
commitb40a5d724f29fc2eed23ff353808a9aae616b48a
tree7e3ef0c3f9fcbd1a256a14e7dfa654682dd06be5
parent5714ca8cba5ed736f3733663c446cbee63a10a64
bpf: crypto: Use the correct destructor kfunc type

With CONFIG_CFI enabled, the kernel strictly enforces that indirect
function calls use a function pointer type that matches the target
function. I ran into the following type mismatch when running BPF
self-tests:

  CFI failure at bpf_obj_free_fields+0x190/0x238 (target:
    bpf_crypto_ctx_release+0x0/0x94; expected type: 0xa488ebfc)
  Internal error: Oops - CFI: 00000000f2008228 [#1]  SMP
  ...

As bpf_crypto_ctx_release() is also used in BPF programs and using
a void pointer as the argument would make the verifier unhappy, add
a simple stub function with the correct type and register it as the
destructor kfunc instead.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Tested-by: Viktor Malik <vmalik@redhat.com>
Link: https://lore.kernel.org/r/20260110082548.113748-7-samitolvanen@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/crypto.c