Skip to content

Commit d264fb0

Browse files
samitolvanenKernel Patches Daemon
authored andcommitted
bpf: net_sched: Use the correct destructor kfunc type
With CONFIG_CFI_CLANG 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]>
1 parent fdc0be4 commit d264fb0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/sched/bpf_qdisc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ __bpf_kfunc void bpf_kfree_skb(struct sk_buff *skb)
202202
kfree_skb(skb);
203203
}
204204

205+
__used __retain void __bpf_kfree_skb(void *skb)
206+
{
207+
bpf_kfree_skb(skb);
208+
}
209+
210+
CFI_NOSEAL(__bpf_kfree_skb);
211+
205212
/* bpf_qdisc_skb_drop - Drop an skb by adding it to a deferred free list.
206213
* @skb: The skb whose reference to be released and dropped.
207214
* @to_free_list: The list of skbs to be dropped.
@@ -449,7 +456,7 @@ static struct bpf_struct_ops bpf_Qdisc_ops = {
449456
.owner = THIS_MODULE,
450457
};
451458

452-
BTF_ID_LIST_SINGLE(bpf_sk_buff_dtor_ids, func, bpf_kfree_skb)
459+
BTF_ID_LIST_SINGLE(bpf_sk_buff_dtor_ids, func, __bpf_kfree_skb)
453460

454461
static int __init bpf_qdisc_kfunc_init(void)
455462
{

0 commit comments

Comments
 (0)