-
Notifications
You must be signed in to change notification settings - Fork 5
Use correct destructor kfunc types #6426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
Use correct destructor kfunc types #6426
Conversation
|
Upstream branch: 688b745 |
8c83cb5 to
f015201
Compare
|
Upstream branch: 19f4091 |
8c8508c to
7e54e3f
Compare
f015201 to
884c5bc
Compare
|
Upstream branch: bd5bdd2 |
7e54e3f to
1f589f6
Compare
884c5bc to
4355736
Compare
|
Upstream branch: 34235a3 |
1f589f6 to
e78798f
Compare
4355736 to
5bece43
Compare
|
Upstream branch: c1af446 |
e78798f to
f9162b5
Compare
5bece43 to
52f5a27
Compare
|
Upstream branch: ff34657 |
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 <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Tested-by: Viktor Malik <[email protected]>
With CONFIG_CFI enabled, the kernel strictly enforces that indirect function calls use a function pointer type that matches the target function. As bpf_kfree_skb() signature differs from the btf_dtor_kfunc_t pointer type used for the destructor calls in bpf_obj_free_fields(), add a stub function with the correct type to fix the type mismatch. Signed-off-by: Sami Tolvanen <[email protected]> Acked-by: Yonghong Song <[email protected]>
With CONFIG_CFI enabled, the kernel strictly enforces that indirect function calls use a function pointer type that matches the target function. As bpf_testmod_ctx_release() signature differs from the btf_dtor_kfunc_t pointer type used for the destructor calls in bpf_obj_free_fields(), add a stub function with the correct type to fix the type mismatch. Signed-off-by: Sami Tolvanen <[email protected]> Acked-by: Yonghong Song <[email protected]>
Ensure that registered destructor kfuncs have the same type as btf_dtor_kfunc_t to avoid a kernel panic on systems with CONFIG_CFI enabled. Signed-off-by: Sami Tolvanen <[email protected]> Acked-by: Yonghong Song <[email protected]>
f9162b5 to
739b773
Compare
Pull request for series with
subject: Use correct destructor kfunc types
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1028057