Uh oh!
There was an error while loading. Please reload this page.
Add charp and some primitive param types - #82
Conversation
1677580 to
3adc0d5Compare
ojeda
left a comment
There was a problem hiding this comment.
Thanks for working on this, Adam!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
e20a676 to
bad069eCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
7f911a5 to
992d26aCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bb8feca to
3a289c7CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
70d0f68 to
5295a1bCompareUh oh!
There was an error while loading. Please reload this page.
ojeda
commented
Feb 1, 2021
@alex Can you please give it a second look? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
5295a1b to
22475bcCompare22475bc to
e47fac7CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
ojeda
commented
Feb 5, 2021
Thanks Adam! :-) |
We can see that "Short form of movsx, dst_reg = (s8,s16,s32)src_reg" in include/linux/filter.h, additionally, for BPF_ALU64 the value of the destination register is unchanged whereas for BPF_ALU the upper 32 bits of the destination register are zeroed, so it should clear the upper 32 bits for BPF_ALU. [root@linux fedora]# echo 1 > /proc/sys/net/core/bpf_jit_enable [root@linux fedora]# modprobe test_bpf Before: test_bpf: #81 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times) test_bpf: #82 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times) After: test_bpf: #81 ALU_MOVSX | BPF_B jited:1 6 PASS test_bpf: #82 ALU_MOVSX | BPF_H jited:1 6 PASS By the way, the bpf selftest case "./test_progs -t verifier_movsx" can also be fixed with this patch. Fixes: f48012f ("LoongArch: BPF: Support sign-extension mov instructions") Acked-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
With latest upstream llvm18, the following test cases failed: $ ./test_progs -j #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #77 fentry_fexit:FAIL #78/1 fentry_test/fentry:FAIL #78 fentry_test:FAIL #82/1 fexit_test/fexit:FAIL #82 fexit_test:FAIL #112/1 kprobe_multi_test/skel_api:FAIL #112/2 kprobe_multi_test/link_api_addrs:FAIL [...] #112 kprobe_multi_test:FAIL #356/17 test_global_funcs/global_func17:FAIL #356 test_global_funcs:FAIL Further analysis shows llvm upstream patch [1] is responsible for the above failures. For example, for function bpf_fentry_test7() in net/bpf/test_run.c, without [1], the asm code is: 0000000000000400 <bpf_fentry_test7>: 400: f3 0f 1e fa endbr64 404: e8 00 00 00 00 callq 0x409 <bpf_fentry_test7+0x9> 409: 48 89 f8 movq %rdi, %rax 40c: c3 retq 40d: 0f 1f 00 nopl (%rax) ... and with [1], the asm code is: 0000000000005d20 <bpf_fentry_test7.specialized.1>: 5d20: e8 00 00 00 00 callq 0x5d25 <bpf_fentry_test7.specialized.1+0x5> 5d25: c3 retq ... and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7> and this caused test failures for #13/#77 etc. except #356. For test case #356/17, with [1] (progs/test_global_func17.c)), the main prog looks like: 0000000000000000 <global_func17>: 0: b4 00 00 00 2a 00 00 00 w0 = 0x2a 1: 95 00 00 00 00 00 00 00 exit ... which passed verification while the test itself expects a verification failure. Let us add 'barrier_var' style asm code in both places to prevent function specialization which caused selftests failure. [1] llvm/llvm-project#72903 Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20231127050342.1945270-1-yonghong.song@linux.dev
…unctions Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Suggested-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-2-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Add types and traits for interfacing the C moduleparam API. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-3-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…::module When we add parameter support to the module macro, we want to be able to pass a reference to `ModuleInfo` to a helper function. That is not possible when we move out of the local `modinfo`. So change the function to access the local via reference rather than value. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-4-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…le parameter support Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-5-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…st_minimal sample Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-6-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae4b5@suse.com/ [1] Acked-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-7-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
For 8-bit and 16-bit sign-extention mov instructions, it can use the native instructions ext.w.b and ext.w.h directly, no need to use the temporary t1 register, just remove the redundant operations. Here are the test results: # modprobe test_bpf test_range=81,84 # dmesg -t | tail -5 test_bpf: #81 ALU_MOVSX | BPF_B jited:1 5 PASS test_bpf: #82 ALU_MOVSX | BPF_H jited:1 5 PASS test_bpf: #83 ALU64_MOVSX | BPF_B jited:1 5 PASS test_bpf: #84 ALU64_MOVSX | BPF_H jited:1 5 PASS test_bpf: Summary: 4 PASSED, 0 FAILED, [4/4 JIT'ed] Acked-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
…unctions Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Suggested-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-2-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Add types and traits for interfacing the C moduleparam API. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-3-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…::module When we add parameter support to the module macro, we want to be able to pass a reference to `ModuleInfo` to a helper function. That is not possible when we move out of the local `modinfo`. So change the function to access the local via reference rather than value. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-4-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…le parameter support Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-5-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…st_minimal sample Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-6-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae4b5@suse.com/ [1] Acked-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250711-module-params-v3-v17-7-cf9b10d4923d@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…unctions Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Suggested-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Link: https://lore.kernel.org/r/20250924-module-params-v3-v18-2-bf512c35d910@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…le parameter support Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Tested-by: Daniel Gomez <da.gomez@samsung.com> Link: https://lore.kernel.org/r/20250924-module-params-v3-v18-5-bf512c35d910@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
…st_minimal sample Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin <lossin@kernel.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Tested-by: Daniel Gomez <da.gomez@samsung.com> Link: https://lore.kernel.org/r/20250924-module-params-v3-v18-6-bf512c35d910@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae4b5@suse.com/ [1] Acked-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: Rust-for-Linux#7 [1] Link: Rust-for-Linux#82 [2] Link: Rust-for-Linux#87 [3] Link: Rust-for-Linux#11 [4] Tested-by: Daniel Gomez <da.gomez@samsung.com> Link: https://lore.kernel.org/r/20250924-module-params-v3-v18-7-bf512c35d910@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
… peek before restoring qlen Whenever fq_codel drops packets during peek, it calls qdisc_tree_reduce_backlog. An issue arises because it calls qdisc_tree_reduce_backlog before it reincrements the qlen. If qlen drops to zero, but peek returns an skb, the parent's qlen_notify callback will be executed even though fq_codel still has 1 packet on the queue and, thus, will mistakenly deactivate the parent's class causing issues like a recent report [1] and a wild memory access in qfq: [ 29.371146][ T360] Oops: general protection fault, probably for non-canonical address 0xfbd59c0000000024: 0000 [#1] SMP KASAN NOPTI [ 29.371666][ T360] KASAN: maybe wild-memory-access in range [0xdead000000000120-0xdead000000000127] [ 29.371987][ T360] CPU: 6 UID: 0 PID: 360 Comm: tc Not tainted 7.1.0-rc5-00285-gc530e5b2dbc6-dirty Rust-for-Linux#82 PREEMPT(full) [ 29.372384][ T360] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 29.372620][ T360] RIP: 0010:qfq_deactivate_agg (include/linux/list.h:1029 (discriminator 2) include/linux/list.h:1043 (discriminator 2) net/sched/sch_qfq.c:1369 (discriminator 2) net/sched/sch_qfq.c:1395 (discriminator 2)) sch_qfq [ 29.373544][ T360] RSP: 0018:ffff888102417370 EFLAGS: 00010216 [ 29.373800][ T360] RAX: 0000000000000000 RBX: ffff88811224d568 RCX: dffffc0000000000 [ 29.374079][ T360] RDX: 1ffff11021fe1543 RSI: ffff88810ff0aa00 RDI: dffffc0000000000 [ 29.374368][ T360] RBP: ffff88811224c280 R08: dead000000000122 R09: 1bd5a00000000024 [ 29.374649][ T360] R10: fffffbfff7940329 R11: fffffbfff7940329 R12: 0000000000000000 [ 29.374926][ T360] R13: dead000000000100 R14: ffff88811224d580 R15: ffff88811224d578 [ 29.375207][ T360] FS: 00007f5b794e5780(0000) GS:ffff88815d1e9000(0000) knlGS:0000000000000000 [ 29.375545][ T360] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 29.375823][ T360] CR2: 000055ffb091f000 CR3: 000000010a305000 CR4: 0000000000750ef0 [ 29.376103][ T360] PKRU: 55555554 [ 29.376258][ T360] Call Trace: [ 29.376401][ T360] <TASK> ... [ 29.376885][ T360] qfq_reset_qdisc (net/sched/sch_qfq.c:357 net/sched/sch_qfq.c:1487) sch_qfq [ 29.377074][ T360] qdisc_reset (net/sched/sch_generic.c:1057) [ 29.377414][ T360] __qdisc_destroy (net/sched/sch_generic.c:1096) [ 29.377600][ T360] qdisc_graft (net/sched/sch_api.c:1062 net/sched/sch_api.c:1053 net/sched/sch_api.c:1159) [ 29.378593][ T360] tc_get_qdisc (net/sched/sch_api.c:1528 net/sched/sch_api.c:1556) Fix this by only calling qdisc_tree_reduce_backlog in peek after the qlen is restored. [1] http://lore.kernel.org/netdev/CAN2cbVe79oj0O9==m4+4x3v+O+qzRagA=2=wkrp9i9=CqYvyZA@mail.gmail.com/ Fixes: 342debc ("codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()") Reported-by: Anirudh Gupta <anirudhrudr@gmail.com> Closes: https://lore.kernel.org/netdev/CAN2cbVe79oj0O9==m4+4x3v+O+qzRagA=2=wkrp9i9=CqYvyZA@mail.gmail.com/ Tested-by: Anirudh Gupta <anirudhrudr@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Victor Nogueira <victor@mojatatu.com> Link: https://patch.msgid.link/20260610192855.3121513-2-victor@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Adding support for
&strparams (ascharp) and a handful of primitive types.Addresses some of #11.