[syzbot] [net?] WARNING in hsr_fill_frame_info

21 views
Skip to first unread message

syzbot

unread,
Aug 29, 2024, 6:52:21 PMAug 29
to da...@davemloft.net, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5be63fc19fca Linux 6.11-rc5
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=150a2d8d980000
kernel config: https://syzkaller.appspot.com/x/.config?x=8605cd35ddc8ff3c
dashboard link: https://syzkaller.appspot.com/bug?extid=3d602af7549af539274e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15d1f76b980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17d49305980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/13cdc3162477/disk-5be63fc1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea315e9db653/vmlinux-5be63fc1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/eb68cddf5620/bzImage-5be63fc1.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3d602a...@syzkaller.appspotmail.com

------------[ cut here ]------------
WARNING: CPU: 0 PID: 5237 at net/hsr/hsr_forward.c:602 handle_std_frame net/hsr/hsr_forward.c:602 [inline]
WARNING: CPU: 0 PID: 5237 at net/hsr/hsr_forward.c:602 hsr_fill_frame_info+0x3da/0x570 net/hsr/hsr_forward.c:630
Modules linked in:
CPU: 0 UID: 0 PID: 5237 Comm: syz-executor387 Not tainted 6.11.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:handle_std_frame net/hsr/hsr_forward.c:602 [inline]
RIP: 0010:hsr_fill_frame_info+0x3da/0x570 net/hsr/hsr_forward.c:630
Code: 00 31 c0 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 55 bb fb f5 90 0f 0b 90 e9 09 ff ff ff e8 47 bb fb f5 90 <0f> 0b 90 eb 93 89 e9 80 e1 07 80 c1 03 38 c1 0f 8c a3 fc ff ff 48
RSP: 0018:ffffc90000007278 EFLAGS: 00010246
RAX: ffffffff8b97d2c9 RBX: 0000000000000000 RCX: ffff88807529bc00
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88807d910cc0 R08: ffffffff8b97d119 R09: 0000000000000000
R10: ffffc900000073c8 R11: fffff52000000e7b R12: dffffc0000000000
R13: 0000000000000008 R14: ffff888029d04f20 R15: ffffc900000073c0
FS: 0000555564778380(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005633c816f000 CR3: 000000001faac000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
fill_frame_info net/hsr/hsr_forward.c:700 [inline]
hsr_forward_skb+0x847/0x2b60 net/hsr/hsr_forward.c:715
hsr_handle_frame+0x51b/0x7d0 net/hsr/hsr_slave.c:70
__netif_receive_skb_core+0x13e8/0x4570 net/core/dev.c:5555
__netif_receive_skb_list_core+0x2b7/0x980 net/core/dev.c:5737
__netif_receive_skb_list net/core/dev.c:5804 [inline]
netif_receive_skb_list_internal+0xa51/0xe30 net/core/dev.c:5896
gro_normal_list include/net/gro.h:515 [inline]
napi_complete_done+0x310/0x8e0 net/core/dev.c:6247
gro_cell_poll+0x19a/0x1c0 net/core/gro_cells.c:66
__napi_poll+0xcb/0x490 net/core/dev.c:6772
napi_poll net/core/dev.c:6841 [inline]
net_rx_action+0x89b/0x1240 net/core/dev.c:6963
handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
do_softirq+0x11b/0x1e0 kernel/softirq.c:455
</IRQ>
<TASK>
__local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
tun_rx_batched+0x732/0x8f0
tun_get_user+0x2f84/0x4720 drivers/net/tun.c:2006
tun_chr_write_iter+0x113/0x1f0 drivers/net/tun.c:2052
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0xa72/0xc90 fs/read_write.c:590
ksys_write+0x1a0/0x2c0 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff04a780a30
Code: 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d 71 d6 07 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89
RSP: 002b:00007ffc50380778 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ff04a780a30
RDX: 000000000000006a RSI: 00000000200006c0 RDI: 00000000000000c8
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Lizhi Xu

unread,
Aug 29, 2024, 9:51:38 PMAug 29
to syzbot+3d602a...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
missing lock before call hsr_forward_skb

#syz test

diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index af6cf64a00e0..3971dbc0644a 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -67,7 +67,9 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
skb_reset_mac_len(skb);

+ spin_lock_bh(&hsr->seqnr_lock);
hsr_forward_skb(skb, port);
+ spin_unlock_bh(&hsr->seqnr_lock);

finish_consume:
return RX_HANDLER_CONSUMED;

syzbot

unread,
Aug 29, 2024, 10:22:04 PMAug 29
to linux-...@vger.kernel.org, lizh...@windriver.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
general protection fault in send_hsr_supervision_frame

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.11.0-rc5-syzkaller-g1b5fe53681d9-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:send_hsr_supervision_frame+0x3a/0xcc0 net/hsr/hsr_device.c:292
Code: ec 40 48 89 54 24 38 49 89 f7 49 89 fd 48 bb 00 00 00 00 00 fc ff df e8 b4 26 fc f5 48 89 d9 49 8d 5d 18 48 89 d8 48 c1 e8 03 <80> 3c 08 00 74 12 48 89 df e8 68 69 63 f6 48 b9 00 00 00 00 00 fc
RSP: 0018:ffffc90000a18a68 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: dffffc0000000000
RDX: 0000000000000100 RSI: ffffc90000a18b40 RDI: 0000000000000000
RBP: ffffc90000a18bb0 R08: ffffffff8b96c883 R09: 1ffffffff26e6908
R10: dffffc0000000000 R11: ffffffff8b976550 R12: ffff88807bcf6ed8
R13: 0000000000000000 R14: ffff88807bcf6cf0 R15: ffffc90000a18b40
FS: 0000000000000000(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055673127c950 CR3: 000000000e734000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
hsr_proxy_announce+0x23a/0x4c0 net/hsr/hsr_device.c:433
call_timer_fn+0x18e/0x650 kernel/time/timer.c:1792
expire_timers kernel/time/timer.c:1843 [inline]
__run_timers kernel/time/timer.c:2417 [inline]
__run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2428
run_timer_base kernel/time/timer.c:2437 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2447
handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:native_irq_disable arch/x86/include/asm/irqflags.h:37 [inline]
RIP: 0010:arch_local_irq_disable arch/x86/include/asm/irqflags.h:92 [inline]
RIP: 0010:acpi_safe_halt+0x21/0x30 drivers/acpi/processor_idle.c:112
Code: 90 90 90 90 90 90 90 90 90 65 48 8b 04 25 00 d7 03 00 48 f7 00 08 00 00 00 75 10 66 90 0f 00 2d 85 d3 b2 00 f3 0f 1e fa fb f4 <fa> c3 cc cc cc cc 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90
RSP: 0018:ffffc900001a7d08 EFLAGS: 00000246
RAX: ffff888018280000 RBX: ffff88801caa1064 RCX: 000000000007d0d9
RDX: 0000000000000001 RSI: ffff88801caa1000 RDI: ffff88801caa1064
RBP: 000000000003a678 R08: ffff8880b9337c7b R09: 1ffff11017266f8f
R10: dffffc0000000000 R11: ffffffff8bb74cf0 R12: ffff88801a3fc000
R13: 0000000000000000 R14: 0000000000000001 R15: ffffffff8f0df120
acpi_idle_enter+0xe4/0x140 drivers/acpi/processor_idle.c:702
cpuidle_enter_state+0x112/0x480 drivers/cpuidle/cpuidle.c:267
cpuidle_enter+0x5d/0xa0 drivers/cpuidle/cpuidle.c:388
call_cpuidle kernel/sched/idle.c:155 [inline]
cpuidle_idle_call kernel/sched/idle.c:230 [inline]
do_idle+0x375/0x5d0 kernel/sched/idle.c:326
cpu_startup_entry+0x42/0x60 kernel/sched/idle.c:424
start_secondary+0x100/0x100 arch/x86/kernel/smpboot.c:313
common_startup_64+0x13e/0x147
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:send_hsr_supervision_frame+0x3a/0xcc0 net/hsr/hsr_device.c:292
Code: ec 40 48 89 54 24 38 49 89 f7 49 89 fd 48 bb 00 00 00 00 00 fc ff df e8 b4 26 fc f5 48 89 d9 49 8d 5d 18 48 89 d8 48 c1 e8 03 <80> 3c 08 00 74 12 48 89 df e8 68 69 63 f6 48 b9 00 00 00 00 00 fc
RSP: 0018:ffffc90000a18a68 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: dffffc0000000000
RDX: 0000000000000100 RSI: ffffc90000a18b40 RDI: 0000000000000000
RBP: ffffc90000a18bb0 R08: ffffffff8b96c883 R09: 1ffffffff26e6908
R10: dffffc0000000000 R11: ffffffff8b976550 R12: ffff88807bcf6ed8
R13: 0000000000000000 R14: ffff88807bcf6cf0 R15: ffffc90000a18b40
FS: 0000000000000000(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055673127c950 CR3: 000000000e734000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: ec in (%dx),%al
1: 40 rex
2: 48 89 54 24 38 mov %rdx,0x38(%rsp)
7: 49 89 f7 mov %rsi,%r15
a: 49 89 fd mov %rdi,%r13
d: 48 bb 00 00 00 00 00 movabs $0xdffffc0000000000,%rbx
14: fc ff df
17: e8 b4 26 fc f5 call 0xf5fc26d0
1c: 48 89 d9 mov %rbx,%rcx
1f: 49 8d 5d 18 lea 0x18(%r13),%rbx
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
2e: 74 12 je 0x42
30: 48 89 df mov %rbx,%rdi
33: e8 68 69 63 f6 call 0xf66369a0
38: 48 rex.W
39: b9 00 00 00 00 mov $0x0,%ecx
3e: 00 fc add %bh,%ah


Tested on:

commit: 1b5fe536 Merge tag 'execve-v6.11-rc6' of git://git.ker..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17aa067b980000
kernel config: https://syzkaller.appspot.com/x/.config?x=8605cd35ddc8ff3c
dashboard link: https://syzkaller.appspot.com/bug?extid=3d602af7549af539274e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=113ddf93980000

Lizhi Xu

unread,
Aug 29, 2024, 11:12:21 PMAug 29
to syzbot+3d602a...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
missing lock before call hsr_forward_skb

#syz test

diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index e4cc6b78dcfc..32b43bd9f542 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -405,11 +405,15 @@ static void hsr_announce(struct timer_list *t)

rcu_read_lock();
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
+ if (!master)
+ goto out;
+
hsr->proto_ops->send_sv_frame(master, &interval, master->dev->dev_addr);

if (is_admin_up(master->dev))
mod_timer(&hsr->announce_timer, jiffies + interval);

+out:
rcu_read_unlock();
}

@@ -427,6 +431,9 @@ static void hsr_proxy_announce(struct timer_list *t)
* of SAN nodes stored in ProxyNodeTable.
*/
interlink = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
+ if (!interlink)
+ goto out;
+
list_for_each_entry_rcu(node, &hsr->proxy_node_db, mac_list) {
if (hsr_addr_is_redbox(hsr, node->macaddress_A))
continue;
@@ -440,6 +447,7 @@ static void hsr_proxy_announce(struct timer_list *t)

mod_timer(&hsr->announce_proxy_timer, jiffies + interval);
}
+out:

rcu_read_unlock();

syzbot

unread,
Aug 29, 2024, 11:53:04 PMAug 29
to linux-...@vger.kernel.org, lizh...@windriver.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+3d602a...@syzkaller.appspotmail.com
Tested-by: syzbot+3d602a...@syzkaller.appspotmail.com

Tested on:

commit: 20371ba1 Merge tag 'drm-fixes-2024-08-30' of https://g..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=127b604d980000
kernel config: https://syzkaller.appspot.com/x/.config?x=8605cd35ddc8ff3c
dashboard link: https://syzkaller.appspot.com/bug?extid=3d602af7549af539274e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1196692b980000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages