Skip to content

Commit

Permalink
bpf: Add mptcp_sched_ops CFI
Browse files Browse the repository at this point in the history
'''
The cfi_stubs pointer is added in the commit 2cd3e37 ("x86/cfi,bpf:
Fix bpf_struct_ops CFI"), this patch initializes it as dummy stubs
__bpf_mptcp_sched_ops.
'''

Note:

BPF tests on export branch fail with this error:

 BUG: kernel NULL pointer dereference, address: 0000000000000000
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: 0000 [#1] PREEMPT SMP PTI
 CPU: 3 PID: 1512 Comm: test_progs Tainted: G        W IOE      6.7.0-rc5 torvalds#37
 Hardware name: LENOVO 4180PG2/4180PG2, BIOS 83ET76WW (1.46 ) 07/05/2013
 RIP: 0010:bpf_struct_ops_map_update_elem+0x4ee/0x610

This patch fixes this error. It can be applied after the commit
"bpf: Add bpf_mptcp_sched_ops"

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Jan 6, 2024
1 parent cefcf65 commit 51a4710
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions net/mptcp/bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ static int bpf_mptcp_sched_init(struct btf *btf)
return 0;
}

static void __bpf_mptcp_sched_init(struct mptcp_sock *msk)
{
}

static void __bpf_mptcp_sched_release(struct mptcp_sock *msk)
{
}

static struct mptcp_sched_ops __bpf_mptcp_sched_ops = {
.init = __bpf_mptcp_sched_init,
.release = __bpf_mptcp_sched_release,
};

struct bpf_struct_ops bpf_mptcp_sched_ops = {
.verifier_ops = &bpf_mptcp_sched_verifier_ops,
.reg = bpf_mptcp_sched_reg,
Expand All @@ -155,6 +168,7 @@ struct bpf_struct_ops bpf_mptcp_sched_ops = {
.init_member = bpf_mptcp_sched_init_member,
.init = bpf_mptcp_sched_init,
.name = "mptcp_sched_ops",
.cfi_stubs = &__bpf_mptcp_sched_ops,
};
#endif /* CONFIG_BPF_JIT */

Expand Down

0 comments on commit 51a4710

Please sign in to comment.