All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] bpf: Add mptcp_sched_ops CFI
@ 2024-01-06  8:40 Geliang Tang
  2024-01-06  9:57 ` bpf: Add mptcp_sched_ops CFI: Tests Results MPTCP CI
  2024-01-08 10:14 ` [PATCH mptcp-next] bpf: Add mptcp_sched_ops CFI Matthieu Baerts
  0 siblings, 2 replies; 5+ messages in thread
From: Geliang Tang @ 2024-01-06  8:40 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

'''
The cfi_stubs pointer is added in the commit 2cd3e3772e41 ("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 #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 <geliang.tang@linux.dev>
---
 net/mptcp/bpf.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index b92c9014ac2c..fb67768aa07d 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -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,
@@ -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 */
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-08 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-06  8:40 [PATCH mptcp-next] bpf: Add mptcp_sched_ops CFI Geliang Tang
2024-01-06  9:57 ` bpf: Add mptcp_sched_ops CFI: Tests Results MPTCP CI
2024-01-08 10:14 ` [PATCH mptcp-next] bpf: Add mptcp_sched_ops CFI Matthieu Baerts
2024-01-08 12:37   ` Geliang Tang
2024-01-08 17:24     ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.