bpf: Add mptcp_sched_ops CFI
Subsystems (2)
PATCH 1/1 bpf: Add mptcp_sched_ops CFI
'''
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"
--- net/mptcp/bpf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/mptcp/bpf.c +14 -0
@@ -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 */
Signature · 1 line
2.39.2
Re: bpf: Add mptcp_sched_ops CFI: Tests Results
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5406963979255808
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5406963979255808/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5829176444321792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5829176444321792/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6532863886098432
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6532863886098432/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4703276537479168
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4703276537479168/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/ca110d1ee2db
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debugFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Matthieu Baerts
maintainerHi Geliang,
Quoted 19 lines · Geliang Tang
'''
Thecfi_stubspointer is added in the commit2cd3e3772e41("x86/cfi,bpf:
Fixbpf_struct_opsCFI"), 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
Quoted 2 lines
This patch fixes this error. It can be applied after the commit "bpf: Add
bpf_mptcp_sched_ops"
Thank you for having checked and fixed that!
Is it OK for you if I squash it in "bpf: Add bpf_mptcp_sched_ops" commit?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Matt,
Quoted 25 lines · Matthieu Baerts
Hi Geliang,
Quoted 22 lines · Geliang Tang
'''
Thecfi_stubspointer is added in the commit2cd3e3772e41("x86/cfi,bpf:
Fixbpf_struct_opsCFI"), 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
Quoted 7 lines
Quoted 2 lines
This patch fixes this error. It can be applied after the commit "bpf: Add
bpf_mptcp_sched_ops"Thank you for having checked and fixed that!
Is it OK for you if I squash it in "bpf: Add
bpf_mptcp_sched_ops" commit?
Yes, it's better to squash it. Please do this when merging it.
I'm not sure whether "get_subflow" should be initialized here too. If it should be, I'll send another squash-to patch to fix this.
Thanks,
-Geliang
Quoted 3 lines
Cheers,
Matt
Matthieu Baerts
maintainerHi Geliang,
Quoted 33 lines · Geliang Tang
Hi Matt,
Quoted 30 lines · Matthieu Baerts
Hi Geliang,
Quoted 22 lines · Geliang Tang
'''
Thecfi_stubspointer is added in the commit2cd3e3772e41("x86/cfi,bpf:
Fixbpf_struct_opsCFI"), 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/0x610Quoted 2 lines
This patch fixes this error. It can be applied after the commit "bpf: Add
bpf_mptcp_sched_ops"Thank you for having checked and fixed that!
Quoted 7 lines
Quoted 2 lines
Is it OK for you if I squash it in "bpf: Add
bpf_mptcp_sched_ops" commit?Yes, it's better to squash it. Please do this when merging it.
I'm not sure whether "
get_subflow" should be initialized here too. If it should be, I'll send another squash-to patch to fix this.
Good point, I guess it should. When I look at bpf_tcp_ca.c, it looks like they implemented all function pointers. Except get_info(), but this one is marked as unsupported.
I just added it when applying your patch. Please tell me if I did it wrong.
While at it, I also updated your email address (I really thought I did it before, but apparently not...)
New patches for t/upstream:
- 810cc99b7dd6: bpf: Add mptcp_sched_ops CFI
- 197ce89d9597: mptcp: bpf: add get_subflow for CFI
- Results: ca5de126f347..10ca1d146a6a (export)
- ca17d989b252: tg:msg: update Geliang's email address
- 9553337100f5: tg:msg: update Geliang's email address
- 404ca606684e: tg:msg: update Geliang's email address
- 75f8cc7247d5: tg:msg: update Geliang's email address
- d86fc89e4e11: tg:msg: update Geliang's email address
- e8708c02eace: tg:msg: update Geliang's email address
- 039488fe8e2e: tg:msg: update Geliang's email address
- 9bbd8dbced1d: tg:msg: update Geliang's email address
- 8f03f584b792: tg:msg: update Geliang's email address
- b500d1b51c5b: tg:msg: update Geliang's email address
- 4e489b19e9f0: tg:msg: update Geliang's email address
- e2029e1cfb8b: tg:msg: update Geliang's email address
- 134f88acf139: tg:msg: update Geliang's email address
- b708aa7547e1: tg:msg: update Geliang's email address
- a814d467f027: tg:msg: update Geliang's email address
- 2b1c988725e8: tg:msg: update Geliang's email address
- Results: 10ca1d146a6a..bd5be2c4e44b (export)
Tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20240108T172308
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.