Repository navigation
arm64: bpf: Fix branch offset in JIT - #75
Closed
kernel-patches-bot wants to merge 2 commits into
Closed
kernel-patches-bot wants to merge 2 commits into
kernel-patches-bot wants to merge 2 commits into
Conversation
Author
Author
kernel-patches-bot
force-pushed
the
series/201615=>bpf-next
branch
from
September 18, 2020 03:19
6085881 to
5825842
Compare
Author
kernel-patches-bot
force-pushed
the
series/201615=>bpf-next
branch
from
September 18, 2020 23:08
5825842 to
c6c47f7
Compare
Author
kernel-patches-bot
force-pushed
the
series/201615=>bpf-next
branch
from
September 18, 2020 23:20
c6c47f7 to
3b07b12
Compare
[ 6525.735488] Unexpected kernel BRK exception at EL1 [ 6525.735502] Internal error: ptrace BRK handler: f2000100 [#1] SMP [ 6525.741609] Modules linked in: nls_utf8 cifs libdes libarc4 dns_resolver fscache binfmt_misc nls_ascii nls_cp437 vfat fat aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce gf128mul efi_pstore sha2_ce sha256_arm64 sha1_ce evdev efivars efivarfs ip_tables x_tables autofs4 btrfs blake2b_generic xor xor_neon zstd_compress raid6_pq libcrc32c crc32c_generic ahci xhci_pci libahci xhci_hcd igb libata i2c_algo_bit nvme realtek usbcore nvme_core scsi_mod t10_pi netsec mdio_devres of_mdio gpio_keys fixed_phy libphy gpio_mb86s7x [ 6525.787760] CPU: 3 PID: 7881 Comm: test_verifier Tainted: G W 5.9.0-rc1+ #47 [ 6525.796111] Hardware name: Socionext SynQuacer E-series DeveloperBox, BIOS build #1 Jun 6 2020 [ 6525.804812] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--) [ 6525.810390] pc : bpf_prog_c3d01833289b6311_F+0xc8/0x9f4 [ 6525.815613] lr : bpf_prog_d53bb52e3f4483f9_F+0x38/0xc8c [ 6525.820832] sp : ffff8000130cbb80 [ 6525.824141] x29: ffff8000130cbbb0 x28: 0000000000000000 [ 6525.829451] x27: 000005ef6fcbf39b x26: 0000000000000000 [ 6525.834759] x25: ffff8000130cbb80 x24: ffff800011dc7038 [ 6525.840067] x23: ffff8000130cbd00 x22: ffff0008f624d080 [ 6525.845375] x21: 0000000000000001 x20: ffff800011dc7000 [ 6525.850682] x19: 0000000000000000 x18: 0000000000000000 [ 6525.855990] x17: 0000000000000000 x16: 0000000000000000 [ 6525.861298] x15: 0000000000000000 x14: 0000000000000000 [ 6525.866606] x13: 0000000000000000 x12: 0000000000000000 [ 6525.871913] x11: 0000000000000001 x10: ffff8000000a660c [ 6525.877220] x9 : ffff800010951810 x8 : ffff8000130cbc38 [ 6525.882528] x7 : 0000000000000000 x6 : 0000009864cfa881 [ 6525.887836] x5 : 00ffffffffffffff x4 : 002880ba1a0b3e9f [ 6525.893144] x3 : 0000000000000018 x2 : ffff8000000a4374 [ 6525.898452] x1 : 000000000000000a x0 : 0000000000000009 [ 6525.903760] Call trace: [ 6525.906202] bpf_prog_c3d01833289b6311_F+0xc8/0x9f4 [ 6525.911076] bpf_prog_d53bb52e3f4483f9_F+0x38/0xc8c [ 6525.915957] bpf_dispatcher_xdp_func+0x14/0x20 [ 6525.920398] bpf_test_run+0x70/0x1b0 [ 6525.923969] bpf_prog_test_run_xdp+0xec/0x190 [ 6525.928326] __do_sys_bpf+0xc88/0x1b28 [ 6525.932072] __arm64_sys_bpf+0x24/0x30 [ 6525.935820] el0_svc_common.constprop.0+0x70/0x168 [ 6525.940607] do_el0_svc+0x28/0x88 [ 6525.943920] el0_sync_handler+0x88/0x190 [ 6525.947838] el0_sync+0x140/0x180 [ 6525.951154] Code: d4202000 d4202000 d4202000 d4202000 (d4202000) [ 6525.957249] ---[ end trace cecc3f93b14927e2 ]--- The reason is the offset[] creation and later usage, while building the eBPF body. The code currently omits the first instruction, since build_insn() will increase our ctx->idx before saving it. That was fine up until bounded eBPF loops were introduced. After that introduction, offset[0] must be the offset of the end of prologue which is the start of the 1st insn while, offset[n] holds the offset of the end of n-th insn. When "taken loop with back jump to 1st insn" test runs, it will eventually call bpf2a64_offset(-1, 2, ctx). Since negative indexing is permitted, the current outcome depends on the value stored in ctx->offset[-1], which has nothing to do with our array. If the value happens to be 0 the tests will work. If not this error triggers. commit 7c2e988 ("bpf: fix x64 JIT code generation for jmp to 1st insn") fixed an indentical bug on x86 when eBPF bounded loops were introduced. So let's fix it by creating the ctx->offset[] differently. Track the beginning of instruction and account for the extra instruction while calculating the arm instruction offsets. Fixes: 2589726 ("bpf: introduce bounded loops") Reported-by: Naresh Kamboju <[email protected]> Reported-by: Jiri Olsa <[email protected]> Co-developed-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Co-developed-by: Yauheni Kaliuta <[email protected]> Signed-off-by: Yauheni Kaliuta <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> --- Changes since v1: - Added Co-developed-by, Reported-by and Fixes tags correctly - Describe the expected context of ctx->offset[] in comments Changes since v2: - Drop the change of behavior for 16-byte eBPF instructions. This won't currently cause any problems and can go in on a different patch - simplify bpf2a64_offset() arch/arm64/net/bpf_jit_comp.c | 43 +++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-)
Author
kernel-patches-bot
force-pushed
the
series/201615=>bpf-next
branch
from
September 21, 2020 19:27
3b07b12 to
e1c9c67
Compare
Author
|
At least one diff in series https://patchwork.ozlabs.org/project/netdev/list/?series=202354 expired. Closing PR. |
kernel-patches-bot
pushed a commit
that referenced
this pull request
Jan 29, 2021
…abled When booting a kernel which has been built with CONFIG_AMD_MEM_ENCRYPT enabled as a Xen pv guest a warning is issued for each processor: [ 5.964347] ------------[ cut here ]------------ [ 5.968314] WARNING: CPU: 0 PID: 1 at /home/gross/linux/head/arch/x86/xen/enlighten_pv.c:660 get_trap_addr+0x59/0x90 [ 5.972321] Modules linked in: [ 5.976313] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.11.0-rc5-default #75 [ 5.980313] Hardware name: Dell Inc. OptiPlex 9020/0PC5F7, BIOS A05 12/05/2013 [ 5.984313] RIP: e030:get_trap_addr+0x59/0x90 [ 5.988313] Code: 42 10 83 f0 01 85 f6 74 04 84 c0 75 1d b8 01 00 00 00 c3 48 3d 00 80 83 82 72 08 48 3d 20 81 83 82 72 0c b8 01 00 00 00 eb db <0f> 0b 31 c0 c3 48 2d 00 80 83 82 48 ba 72 1c c7 71 1c c7 71 1c 48 [ 5.992313] RSP: e02b:ffffc90040033d38 EFLAGS: 00010202 [ 5.996313] RAX: 0000000000000001 RBX: ffffffff82a141d0 RCX: ffffffff8222ec38 [ 6.000312] RDX: ffffffff8222ec38 RSI: 0000000000000005 RDI: ffffc90040033d40 [ 6.004313] RBP: ffff8881003984a0 R08: 0000000000000007 R09: ffff888100398000 [ 6.008312] R10: 0000000000000007 R11: ffffc90040246000 R12: ffff8884082182a8 [ 6.012313] R13: 0000000000000100 R14: 000000000000001d R15: ffff8881003982d0 [ 6.016316] FS: 0000000000000000(0000) GS:ffff888408200000(0000) knlGS:0000000000000000 [ 6.020313] CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 6.024313] CR2: ffffc900020ef000 CR3: 000000000220a000 CR4: 0000000000050660 [ 6.028314] Call Trace: [ 6.032313] cvt_gate_to_trap.part.7+0x3f/0x90 [ 6.036313] ? asm_exc_double_fault+0x30/0x30 [ 6.040313] xen_convert_trap_info+0x87/0xd0 [ 6.044313] xen_pv_cpu_up+0x17a/0x450 [ 6.048313] bringup_cpu+0x2b/0xc0 [ 6.052313] ? cpus_read_trylock+0x50/0x50 [ 6.056313] cpuhp_invoke_callback+0x80/0x4c0 [ 6.060313] _cpu_up+0xa7/0x140 [ 6.064313] cpu_up+0x98/0xd0 [ 6.068313] bringup_nonboot_cpus+0x4f/0x60 [ 6.072313] smp_init+0x26/0x79 [ 6.076313] kernel_init_freeable+0x103/0x258 [ 6.080313] ? rest_init+0xd0/0xd0 [ 6.084313] kernel_init+0xa/0x110 [ 6.088313] ret_from_fork+0x1f/0x30 [ 6.092313] ---[ end trace be9ecf17dceeb4f3 ]--- Reason is that there is no Xen pv trap entry for X86_TRAP_VC. Fix that by adding a generic trap handler for unknown traps and wire all unknown bare metal handlers to this generic handler, which will just crash the system in case such a trap will ever happen. Fixes: 0786138 ("x86/sev-es: Add a Runtime #VC Exception Handler") Cc: <[email protected]> # v5.10 Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Andrew Cooper <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 15, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 15, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 15, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 15, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 16, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 16, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 16, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Nov 16, 2021
Branch data available to bpf programs can be very useful to get stack traces out of userspace applications. Commit fff7b64 ("bpf: Add bpf_read_branch_records() helper") added bpf support to capture branch records in x86. Enable this feature for powerpc as well. Commit 67306f8 ("selftests/bpf: Add bpf_read_branch_records() selftest") adds selftest corresponding to bpf branch read function bpf_read_branch_records(). Used this selftest to test bpf support, for reading branch records in powerpc. Selftest result in power9 box before this patch changes: [command]# ./test_progs -t perf_branches Failed to load bpf_testmod.ko into the kernel: -8 WARNING! Selftests relying on bpf_testmod.ko will be skipped. test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:PASS:output not valid 0 nsec check_good_sample:FAIL:read_branches_size err -2 check_good_sample:FAIL:read_branches_stack err -2 check_good_sample:FAIL:read_branches_stack stack bytes written=-2 not multiple of struct size=24 check_good_sample:FAIL:read_branches_global err -2 check_good_sample:FAIL:read_branches_global global bytes written=-2 not multiple of struct size=24 check_good_sample:PASS:read_branches_size 0 nsec #75/1 perf_branches_hw:FAIL #75/2 perf_branches_no_hw:OK #75 perf_branches:FAIL Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED Selftest result in power9 box after this patch changes: [command]#: ./test_progs -t perf_branches #75/1 perf_branches_hw:OK #75/2 perf_branches_no_hw:OK #75 perf_branches:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Kajol Jain<[email protected]>
kernel-patches-bot
pushed a commit
that referenced
this pull request
Dec 9, 2021
…fails Check for a valid hv_vp_index array prior to derefencing hv_vp_index when setting Hyper-V's TSC change callback. If Hyper-V setup failed in hyperv_init(), the kernel will still report that it's running under Hyper-V, but will have silently disabled nearly all functionality. BUG: kernel NULL pointer dereference, address: 0000000000000010 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc2+ #75 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:set_hv_tscchange_cb+0x15/0xa0 Code: <8b> 04 82 8b 15 12 17 85 01 48 c1 e0 20 48 0d ee 00 01 00 f6 c6 08 ... Call Trace: kvm_arch_init+0x17c/0x280 kvm_init+0x31/0x330 vmx_init+0xba/0x13a do_one_initcall+0x41/0x1c0 kernel_init_freeable+0x1f2/0x23b kernel_init+0x16/0x120 ret_from_fork+0x22/0x30 Fixes: 9328626 ("x86/hyperv: Reenlightenment notifications support") Cc: [email protected] Cc: Vitaly Kuznetsov <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 26, 2023
With latest clang18, I hit test_progs failures for the following test: #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #75 fentry_fexit:FAIL #76/1 fentry_test/fentry:FAIL #76 fentry_test:FAIL #80/1 fexit_test/fexit:FAIL #80 fexit_test:FAIL #110/1 kprobe_multi_test/skel_api:FAIL #110/2 kprobe_multi_test/link_api_addrs:FAIL #110/3 kprobe_multi_test/link_api_syms:FAIL #110/4 kprobe_multi_test/attach_api_pattern:FAIL #110/5 kprobe_multi_test/attach_api_addrs:FAIL #110/6 kprobe_multi_test/attach_api_syms:FAIL #110 kprobe_multi_test:FAIL For example, for #13/2, the error messages are ... kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 ... kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 27, 2023
With latest clang18, I hit test_progs failures for the following test: #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #75 fentry_fexit:FAIL #76/1 fentry_test/fentry:FAIL #76 fentry_test:FAIL #80/1 fexit_test/fexit:FAIL #80 fexit_test:FAIL #110/1 kprobe_multi_test/skel_api:FAIL #110/2 kprobe_multi_test/link_api_addrs:FAIL #110/3 kprobe_multi_test/link_api_syms:FAIL #110/4 kprobe_multi_test/attach_api_pattern:FAIL #110/5 kprobe_multi_test/attach_api_addrs:FAIL #110/6 kprobe_multi_test/attach_api_syms:FAIL #110 kprobe_multi_test:FAIL For example, for #13/2, the error messages are ... kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 ... kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 28, 2023
With latest clang18, I hit test_progs failures for the following test: #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #75 fentry_fexit:FAIL #76/1 fentry_test/fentry:FAIL #76 fentry_test:FAIL #80/1 fexit_test/fexit:FAIL #80 fexit_test:FAIL #110/1 kprobe_multi_test/skel_api:FAIL #110/2 kprobe_multi_test/link_api_addrs:FAIL #110/3 kprobe_multi_test/link_api_syms:FAIL #110/4 kprobe_multi_test/attach_api_pattern:FAIL #110/5 kprobe_multi_test/attach_api_addrs:FAIL #110/6 kprobe_multi_test/attach_api_syms:FAIL #110 kprobe_multi_test:FAIL For example, for #13/2, the error messages are ... kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 ... kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]> Tested-by: Eduard Zingerman <[email protected]>
eddyz87
pushed a commit
to eddyz87/bpf
that referenced
this pull request
Aug 28, 2023
With latest clang18, I hit test_progs failures for the following test: kernel-patches#13/2 bpf_cookie/multi_kprobe_link_api:FAIL kernel-patches#13/3 bpf_cookie/multi_kprobe_attach_api:FAIL kernel-patches#13 bpf_cookie:FAIL kernel-patches#75 fentry_fexit:FAIL kernel-patches#76/1 fentry_test/fentry:FAIL kernel-patches#76 fentry_test:FAIL kernel-patches#80/1 fexit_test/fexit:FAIL kernel-patches#80 fexit_test:FAIL kernel-patches#110/1 kprobe_multi_test/skel_api:FAIL kernel-patches#110/2 kprobe_multi_test/link_api_addrs:FAIL kernel-patches#110/3 kprobe_multi_test/link_api_syms:FAIL kernel-patches#110/4 kprobe_multi_test/attach_api_pattern:FAIL kernel-patches#110/5 kprobe_multi_test/attach_api_addrs:FAIL kernel-patches#110/6 kprobe_multi_test/attach_api_syms:FAIL kernel-patches#110 kprobe_multi_test:FAIL For example, for kernel-patches#13/2, the error messages are ... kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 ... kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 30, 2023
With latest clang18, I hit test_progs failures for the following test: #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #75 fentry_fexit:FAIL #76/1 fentry_test/fentry:FAIL #76 fentry_test:FAIL #80/1 fexit_test/fexit:FAIL #80 fexit_test:FAIL #110/1 kprobe_multi_test/skel_api:FAIL #110/2 kprobe_multi_test/link_api_addrs:FAIL #110/3 kprobe_multi_test/link_api_syms:FAIL #110/4 kprobe_multi_test/attach_api_pattern:FAIL #110/5 kprobe_multi_test/attach_api_addrs:FAIL #110/6 kprobe_multi_test/attach_api_syms:FAIL #110 kprobe_multi_test:FAIL For example, for #13/2, the error messages are: [...] kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 [...] kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 30, 2023
With latest clang18, I hit test_progs failures for the following test: #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #75 fentry_fexit:FAIL #76/1 fentry_test/fentry:FAIL #76 fentry_test:FAIL #80/1 fexit_test/fexit:FAIL #80 fexit_test:FAIL #110/1 kprobe_multi_test/skel_api:FAIL #110/2 kprobe_multi_test/link_api_addrs:FAIL #110/3 kprobe_multi_test/link_api_syms:FAIL #110/4 kprobe_multi_test/attach_api_pattern:FAIL #110/5 kprobe_multi_test/attach_api_addrs:FAIL #110/6 kprobe_multi_test/attach_api_syms:FAIL #110 kprobe_multi_test:FAIL For example, for #13/2, the error messages are ... kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1 ... kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1 clang17 does not have this issue. Further investigation shows that kernel func bpf_fentry_test7(), used in the above tests, is inlined by the compiler although it is marked as noinline. int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg) { return (long)arg; } It is known that for simple functions like the above (e.g. just returning a constant or an input argument), the clang compiler may still do inlining for a noinline function. Adding 'asm volatile ("")' in the beginning of the bpf_fentry_test7() can prevent inlining. Signed-off-by: Yonghong Song <[email protected]> Tested-by: Eduard Zingerman <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Jun 5, 2025
Specify the threshold for dumping offcpu samples with --off-cpu-thresh,
the unit is milliseconds. Default value is 500ms.
Example:
perf record --off-cpu --off-cpu-thresh 824
The example above collects direct off-cpu samples where the off-cpu time
is longer than 824ms.
Committer testing:
After commenting out the end off-cpu dump to have just the ones that are
added right after the task is scheduled back, and using a threshould of
1000ms, we see some periods (the 5th column, just before "offcpu-time"
in the 'perf script' output) that are over 1000.000.000 nanoseconds:
root@number:~# perf record --off-cpu --off-cpu-thresh 10000
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 3.902 MB perf.data (34335 samples) ]
root@number:~# perf script
<SNIP>
Isolated Web Co 59932 [028] 63839.594437: 1000049427 offcpu-time:
7fe63c7976c2 __syscall_cancel_arch_end+0x0 (/usr/lib64/libc.so.6)
7fe63c78c04c __futex_abstimed_wait_common+0x7c (/usr/lib64/libc.so.6)
7fe63c78e928 pthread_cond_timedwait@@GLIBC_2.3.2+0x178 (/usr/lib64/libc.so.6)
5599974a9fe7 mozilla::detail::ConditionVariableImpl::wait_for(mozilla::detail::MutexImpl&, mozilla::BaseTimeDuration<mozilla::TimeDurationValueCalculator> const&)+0xe7 (/usr/lib64/fir>
100000000 [unknown] ([unknown])
swapper 0 [025] 63839.594459: 195724 cycles:P: ffffffffac328270 read_tsc+0x0 ([kernel.kallsyms])
Isolated Web Co 59932 [010] 63839.594466: 1000055278 offcpu-time:
7fe63c7976c2 __syscall_cancel_arch_end+0x0 (/usr/lib64/libc.so.6)
7fe63c78ba24 __syscall_cancel+0x14 (/usr/lib64/libc.so.6)
7fe63c804c4e __poll+0x1e (/usr/lib64/libc.so.6)
7fe633b0d1b8 PollWrapper(_GPollFD*, unsigned int, int) [clone .lto_priv.0]+0xf8 (/usr/lib64/firefox/libxul.so)
10000002c [unknown] ([unknown])
swapper 0 [027] 63839.594475: 134433 cycles:P: ffffffffad4c45d9 irqentry_enter+0x19 ([kernel.kallsyms])
swapper 0 [028] 63839.594499: 215838 cycles:P: ffffffffac39199a switch_mm_irqs_off+0x10a ([kernel.kallsyms])
MediaPD~oder #1 1407676 [027] 63839.594514: 134433 cycles:P: 7f982ef5e69f dct_IV(int*, int, int*)+0x24f (/usr/lib64/libfdk-aac.so.2.0.0)
swapper 0 [024] 63839.594524: 267411 cycles:P: ffffffffad4c6ee6 poll_idle+0x56 ([kernel.kallsyms])
MediaSu~sor #75 1093827 [026] 63839.594555: 332652 cycles:P: 55be753ad030 moz_xmalloc+0x200 (/usr/lib64/firefox/firefox)
swapper 0 [027] 63839.594616: 160548 cycles:P: ffffffffad144840 menu_select+0x570 ([kernel.kallsyms])
Isolated Web Co 14019 [027] 63839.595120: 1000050178 offcpu-time:
7fc9537cc6c2 __syscall_cancel_arch_end+0x0 (/usr/lib64/libc.so.6)
7fc9537c104c __futex_abstimed_wait_common+0x7c (/usr/lib64/libc.so.6)
7fc9537c3928 pthread_cond_timedwait@@GLIBC_2.3.2+0x178 (/usr/lib64/libc.so.6)
7fc95372a3c8 pt_TimedWait+0xb8 (/usr/lib64/libnspr4.so)
7fc95372a8d8 PR_WaitCondVar+0x68 (/usr/lib64/libnspr4.so)
7fc94afb1f7c WatchdogMain(void*)+0xac (/usr/lib64/firefox/libxul.so)
7fc947498660 [unknown] ([unknown])
7fc9535fce88 [unknown] ([unknown])
7fc94b620e60 WatchdogManager::~WatchdogManager()+0x0 (/usr/lib64/firefox/libxul.so)
fff8548387f8b48 [unknown] ([unknown])
swapper 0 [003] 63839.595712: 212948 cycles:P: ffffffffacd5b865 acpi_os_read_port+0x55 ([kernel.kallsyms])
<SNIP>
Suggested-by: Arnaldo Carvalho de Melo <[email protected]>
Suggested-by: Ian Rogers <[email protected]>
Suggested-by: Namhyung Kim <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Howard Chu <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Tested-by: Gautam Menghani <[email protected]>
Tested-by: Ian Rogers <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
guidosarducci
added a commit
to guidosarducci/bpf-ci
that referenced
this pull request
Sep 19, 2025
Update memory-layout, alignment, and expected results to ensure consistent behaviour regardless of 32/64-bit host architecture, similar to a previous fix [0]. All tests now pass on 32-bit armhf after these changes: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a core_reloc kernel-patches#75/1 core_reloc/kernel:OK kernel-patches#75/2 core_reloc/module_probed:OK kernel-patches#75/3 core_reloc/module_direct:OK [...] kernel-patches#75/78 core_reloc/enum64val___err_missing:OK kernel-patches#75 core_reloc:OK Summary: 1/78 PASSED, 0 SKIPPED, 0 FAILED 0: 5705d70 ("selftests/bpf: Correct various core_reloc 64-bit assumptions") Signed-off-by: Tony Ambardar <[email protected]>
guidosarducci
added a commit
to guidosarducci/bpf-ci
that referenced
this pull request
Sep 19, 2025
Update memory-layout, alignment, and expected results to ensure consistent behaviour regardless of 32/64-bit host architecture, similar to a previous fix [0]. All tests now pass on 32-bit armhf after these changes: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a core_reloc kernel-patches#75/1 core_reloc/kernel:OK kernel-patches#75/2 core_reloc/module_probed:OK kernel-patches#75/3 core_reloc/module_direct:OK [...] kernel-patches#75/78 core_reloc/enum64val___err_missing:OK kernel-patches#75 core_reloc:OK Summary: 1/78 PASSED, 0 SKIPPED, 0 FAILED 0: 5705d70 ("selftests/bpf: Correct various core_reloc 64-bit assumptions") Signed-off-by: Tony Ambardar <[email protected]>
guidosarducci
added a commit
to guidosarducci/bpf-ci
that referenced
this pull request
Sep 22, 2025
Update memory-layout, alignment, and expected results to ensure consistent behaviour regardless of 32/64-bit host architecture, similar to a previous fix [0]. All tests now pass on 32-bit armhf after these changes: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a core_reloc kernel-patches#75/1 core_reloc/kernel:OK kernel-patches#75/2 core_reloc/module_probed:OK kernel-patches#75/3 core_reloc/module_direct:OK [...] kernel-patches#75/78 core_reloc/enum64val___err_missing:OK kernel-patches#75 core_reloc:OK Summary: 1/78 PASSED, 0 SKIPPED, 0 FAILED 0: 5705d70 ("selftests/bpf: Correct various core_reloc 64-bit assumptions") Signed-off-by: Tony Ambardar <[email protected]>
guidosarducci
added a commit
to guidosarducci/bpf-ci
that referenced
this pull request
Sep 23, 2025
Update memory-layout, alignment, and expected results to ensure consistent behaviour regardless of 32/64-bit host architecture, similar to a previous fix [0]. All tests now pass on 32-bit armhf after these changes: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a core_reloc kernel-patches#75/1 core_reloc/kernel:OK kernel-patches#75/2 core_reloc/module_probed:OK kernel-patches#75/3 core_reloc/module_direct:OK [...] kernel-patches#75/78 core_reloc/enum64val___err_missing:OK kernel-patches#75 core_reloc:OK Summary: 1/78 PASSED, 0 SKIPPED, 0 FAILED 0: 5705d70 ("selftests/bpf: Correct various core_reloc 64-bit assumptions") Signed-off-by: Tony Ambardar <[email protected]>
guidosarducci
added a commit
to guidosarducci/bpf-ci
that referenced
this pull request
Sep 24, 2025
Update memory-layout, alignment, and expected results to ensure consistent behaviour regardless of 32/64-bit host architecture, similar to a previous fix [0]. All tests now pass on 32-bit armhf after these changes: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a core_reloc kernel-patches#75/1 core_reloc/kernel:OK kernel-patches#75/2 core_reloc/module_probed:OK kernel-patches#75/3 core_reloc/module_direct:OK [...] kernel-patches#75/78 core_reloc/enum64val___err_missing:OK kernel-patches#75 core_reloc:OK Summary: 1/78 PASSED, 0 SKIPPED, 0 FAILED 0: 5705d70 ("selftests/bpf: Correct various core_reloc 64-bit assumptions") Signed-off-by: Tony Ambardar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Aug 17, 2026
__smbdirect_socket_schedule_cleanup() and smbdirect_socket_cleanup_work() take sc->listen.lock and walk the listener's pending list, recursing into smbdirect_socket_schedule_cleanup() for each child, and every child takes its own listen.lock inside that walk. This cannot deadlock for real: the nesting is strictly listener into child, a child never listens, so the outer and the inner lock are always different instances. lockdep only tracks lock classes, though; it sees the same class acquired twice and reports a possible recursive locking deadlock. This change therefore works around a lockdep limitation rather than fixing a real hang, but the report is still worth avoiding: lockdep disables itself after the first splat and then hides real locking bugs for the rest of the run. Only a socket that was a listener owns a populated listen.ready/pending list; a child has empty lists and nothing to do in these blocks. Guard both of them with sc->listen.backlog != -1, the "was a listener" marker that smbdirect_socket_destroy() already uses: listen.backlog leaves its initial -1 exactly once, when smbdirect_socket_listen() succeeds. The alternative !sc->accept.listener test reads as "not a listener" while meaning the opposite, and it is also true for an accepted child, whose accept.listener has been cleared on hand-over. With the guard the walk only runs for a listener and never nests a child's listen.lock under it; a pending child stays on its listener's list for the free path (smbdirect_socket_destroy) to reap. [ 741.705044] WARNING: possible recursive locking detected [ 741.705403] 7.1.0-next-20260623+ #75 Not tainted [ 741.705695] -------------------------------------------- [ 741.706022] ksmbd.control/18502 is trying to acquire lock: [ 741.706379] ffff888108d612f8 (&sc->listen.lock){....}-{3:3}, at: __smbdirect_socket_schedule_cleanup+0x719/0xd70 [ 741.707008] [ 741.707008] but task is already holding lock: [ 741.707396] ffff8881087642f8 (&sc->listen.lock){....}-{3:3}, at: __smbdirect_socket_schedule_cleanup+0x719/0xd70 [ 741.708025] [ 741.708025] other info that might help us debug this: [ 741.708448] Possible unsafe locking scenario: [ 741.708448] [ 741.708845] CPU0 [ 741.709016] ---- [ 741.709186] lock(&sc->listen.lock); [ 741.709453] lock(&sc->listen.lock); [ 741.709705] [ 741.709705] *** DEADLOCK *** [ 741.709705] [ 741.710095] May be due to missing lock nesting notation [ 741.710095] [ 741.710663] 6 locks held by ksmbd.control/18502: [ 741.710975] #0: ffff888109e51420 (sb_writers#7){.+.+}-{0:0}, at: vfs_write+0x1e7/0xc70 [ 741.711561] #1: ffff888126ec3880 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x1be/0x4d0 [ 741.712147] #2: ffff888102af17b0 (kn->active#45){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x205/0x4d0 [ 741.712803] #3: ffffffff85ad1e00 (ctrl_lock){+.+.}-{4:4}, at: kill_server_store+0x1e0/0x2b0 [ 741.713381] #4: ffffffff85ad41a0 (init_lock){+.+.}-{4:4}, at: ksmbd_conn_transport_destroy+0x5b/0x3c0 [ 741.713995] #5: ffff8881087642f8 (&sc->listen.lock){....}-{3:3}, at: __smbdirect_socket_schedule_cleanup+0x719/0xd70 [ 741.714736] [ 741.714736] stack backtrace: [ 741.715038] CPU: 4 UID: 0 PID: 18502 Comm: ksmbd.control Not tainted 7.1.0-next-20260623+ #75 PREEMPT(lazy) [ 741.715043] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014 [ 741.715046] Call Trace: [ 741.715049] <TASK> [ 741.715052] dump_stack_lvl+0x77/0xa0 [ 741.715058] print_deadlock_bug+0x279/0x290 [ 741.715065] __lock_acquire+0x272a/0x2e30 [ 741.715070] ? stack_trace_save+0xae/0x100 [ 741.715075] ? smb_direct_logging_vaprintf+0x1a0/0x230 [ 741.715079] ? __pfx_smb_direct_logging_vaprintf+0x10/0x10 [ 741.715082] ? __timer_delete+0x58/0x320 [ 741.715087] lock_acquire+0xd3/0x270 [ 741.715091] ? __smbdirect_socket_schedule_cleanup+0x719/0xd70 [ 741.715095] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 741.715099] _raw_spin_lock_irqsave+0x42/0x60 [ 741.715105] ? __smbdirect_socket_schedule_cleanup+0x719/0xd70 Note the two addresses above: ffff888108d612f8 is the child's lock, ffff8881087642f8 the listener's, always distinct objects. Found with ksmbdzzer [2], a KSMBD fuzzer that drives libFuzzer with a kcov-dataflow [1] coverage vector: it folds each instrumented comparison/argument's runtime operand value together with its PC (the default arm mixes them as pc⊕val) so that a new operand value at a known site counts as new coverage. [1] https://lwn.net/Articles/1077606/ [2] https://github.com/yskzalloc/kcov-dataflow Fixes: dc691b9 ("smb: smbdirect: introduce smbdirect_socket_{listen,accept}()") Signed-off-by: Yunseong Kim <[email protected]> Reviewed-by: Stefan Metzmacher <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Oct 6, 2026
When a namespace on a multipath controller is updated,
nvme_update_ns_info() freezes the head disk queue, commits the new
limits, and then calls nvme_mpath_revalidate_zones() before it
unfreezes the queue again.
That is the wrong way round for blk_revalidate_disk_zones(). It starts
a limits update, which takes q->limits_lock, and it freezes the queue
itself while updating the zone resources. The block layer takes
limits_lock before freezing the queue, never the other way around, so
calling it with the head queue already frozen reverses that order.
syzbot has hit this twice. One report goes through q->limits_lock. The
other one is on linux-next, where blk_revalidate_disk_zones() also
takes disk->zone_revalidate_mutex and holds it across alloc_workqueue()
the first time a disk's zone resources are set up. Lockdep then sees:
q_usage_counter(io) (frozen head queue, nvme_update_ns_info())
--> &disk->zone_revalidate_mutex
--> wq_pool_mutex --> fs_reclaim --> q_usage_counter(io)
WARNING: possible circular locking dependency detected
kworker/u8:10/3352 is trying to acquire lock:
(&disk->zone_revalidate_mutex){+.+.}-{4:4}, at: blk_revalidate_disk_zones+0x1c5/0x1650
but task is already holding lock:
(&q->q_usage_counter(io)#75){++++}-{0:0}, at: nvme_update_ns_info+0x3ac/0x1200
...
blk_revalidate_disk_zones+0x1c5/0x1650 block/blk-zoned.c:2560
nvme_mpath_revalidate_zones+0x106/0x1c0 drivers/nvme/host/multipath.c:301
nvme_update_ns_info+0x984/0x1200 drivers/nvme/host/core.c:2620
The rest of the driver already does this correctly:
nvme_update_ns_info_block() unfreezes ns->disk->queue before calling
blk_revalidate_disk_zones(), and nvme_mpath_set_live() revalidates the
head zones without freezing the queue. Do the same here, and only
revalidate the head zones once the queue is unfrozen and the limits
update has succeeded.
Fixes: 2240414 ("nvme-multipath: revalidate zones for namespace heads")
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=b0910be96b7c31314822
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=2e02ccadb3c5522a5c59
Link: https://lore.kernel.org/all/[email protected]/
Cc: Shuah Khan <[email protected]>
Cc: Brigham Campbell <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Reviewed-by: Yao Sang <[email protected]>
Tested-by: Yao Sang <[email protected]>
Signed-off-by: Palla Raghunath <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: arm64: bpf: Fix branch offset in JIT
version: 3
url: https://patchwork.ozlabs.org/project/netdev/list/?series=202354