public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [wireless?] divide error in mac80211_hwsim_link_info_changed (3)
@ 2026-04-27 19:28 syzbot
  2026-04-27 20:29 ` Arjan van de Ven
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2026-04-27 19:28 UTC (permalink / raw)
  To: johannes, linux-kernel, linux-wireless, netdev, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    254f49634ee1 Linux 7.1-rc1
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13b32348580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=4caf64b1ee83dac0
dashboard link: https://syzkaller.appspot.com/bug?extid=ca7a2759caaa6cd4e3db
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
userspace arch: i386

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/fd59c3aee25f/disk-254f4963.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2a93e1c819bd/vmlinux-254f4963.xz
kernel image: https://storage.googleapis.com/syzbot-assets/18c05b34ca3c/bzImage-254f4963.xz

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

Oops: divide error: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 193 Comm: kworker/u8:6 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Workqueue: events_unbound cfg80211_wiphy_work
RIP: 0010:mac80211_hwsim_link_info_changed+0x476/0xfc0 drivers/net/wireless/virtual/mac80211_hwsim.c:2734
Code: 3c 06 00 49 89 c6 48 8b 7c 24 20 74 0a e8 42 72 26 fb 48 8b 7c 24 20 48 8b 0f 89 ce 4c 89 e0 48 c1 e8 20 74 60 4c 89 e0 31 d2 <48> f7 f6 eb 5d e8 30 37 bb fa 4c 8b 74 24 20 49 8d 7e 10 e8 a2 e4
RSP: 0000:ffffc90002ea7860 EFLAGS: 00010246
RAX: 000650757bb12572 RBX: 0000000000000200 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88806fbe7b98
RBP: ffffc90002ea7958 R08: ffffffff903096f7 R09: 1ffffffff20612de
R10: dffffc0000000000 R11: fffffbfff20612df R12: 000650757bb12572
R13: ffff88806fbe7b18 R14: dffffc0000000000 R15: 1ffff920005d4f18
FS:  0000000000000000(0000) GS:ffff888125393000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000f540c000 CR3: 0000000064b3a000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 000000000000000e DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 drv_link_info_changed+0x505/0x880 net/mac80211/driver-ops.c:-1
 ieee80211_offchannel_return+0x375/0x500 net/mac80211/offchannel.c:160
 __ieee80211_scan_completed+0x75a/0xb40 net/mac80211/scan.c:519
 cfg80211_wiphy_work+0x2cf/0x460 net/wireless/core.c:513
 process_one_work kernel/workqueue.c:3302 [inline]
 process_scheduled_works+0xb5d/0x1860 kernel/workqueue.c:3385
 worker_thread+0xa53/0xfc0 kernel/workqueue.c:3466
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:mac80211_hwsim_link_info_changed+0x476/0xfc0 drivers/net/wireless/virtual/mac80211_hwsim.c:2734
Code: 3c 06 00 49 89 c6 48 8b 7c 24 20 74 0a e8 42 72 26 fb 48 8b 7c 24 20 48 8b 0f 89 ce 4c 89 e0 48 c1 e8 20 74 60 4c 89 e0 31 d2 <48> f7 f6 eb 5d e8 30 37 bb fa 4c 8b 74 24 20 49 8d 7e 10 e8 a2 e4
RSP: 0000:ffffc90002ea7860 EFLAGS: 00010246
RAX: 000650757bb12572 RBX: 0000000000000200 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88806fbe7b98
RBP: ffffc90002ea7958 R08: ffffffff903096f7 R09: 1ffffffff20612de
R10: dffffc0000000000 R11: fffffbfff20612df R12: 000650757bb12572
R13: ffff88806fbe7b18 R14: dffffc0000000000 R15: 1ffff920005d4f18
FS:  0000000000000000(0000) GS:ffff888125393000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000f7487a54 CR3: 00000000608c4000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 000000000000000e DR6: 00000000ffff0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 3 bytes skipped:
   0:	49 89 c6             	mov    %rax,%r14
   3:	48 8b 7c 24 20       	mov    0x20(%rsp),%rdi
   8:	74 0a                	je     0x14
   a:	e8 42 72 26 fb       	call   0xfb267251
   f:	48 8b 7c 24 20       	mov    0x20(%rsp),%rdi
  14:	48 8b 0f             	mov    (%rdi),%rcx
  17:	89 ce                	mov    %ecx,%esi
  19:	4c 89 e0             	mov    %r12,%rax
  1c:	48 c1 e8 20          	shr    $0x20,%rax
  20:	74 60                	je     0x82
  22:	4c 89 e0             	mov    %r12,%rax
  25:	31 d2                	xor    %edx,%edx
* 27:	48 f7 f6             	div    %rsi <-- trapping instruction
  2a:	eb 5d                	jmp    0x89
  2c:	e8 30 37 bb fa       	call   0xfabb3761
  31:	4c 8b 74 24 20       	mov    0x20(%rsp),%r14
  36:	49 8d 7e 10          	lea    0x10(%r14),%rdi
  3a:	e8                   	.byte 0xe8
  3b:	a2                   	.byte 0xa2
  3c:	e4                   	.byte 0xe4


---
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 syzkaller@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 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

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

* Re: [syzbot] [wireless?] divide error in mac80211_hwsim_link_info_changed (3)
  2026-04-27 19:28 [syzbot] [wireless?] divide error in mac80211_hwsim_link_info_changed (3) syzbot
@ 2026-04-27 20:29 ` Arjan van de Ven
  0 siblings, 0 replies; 2+ messages in thread
From: Arjan van de Ven @ 2026-04-27 20:29 UTC (permalink / raw)
  To: linux-wireless
  Cc: syzbot+ca7a2759caaa6cd4e3db, johannes, linux-kernel, netdev,
	syzkaller-bugs

This email is created by automation to help kernel developers
deal with a large volume of AI generated bug reports by decoding
oopses into more actionable information.


Decoded Backtrace

1. mac80211_hwsim_link_info_changed -- crash site
   (drivers/net/wireless/virtual/mac80211_hwsim.c:2734)

2701  static void mac80211_hwsim_link_info_changed(struct ieee80211_hw *hw,
2702  					     struct ieee80211_vif *vif,
2703  					     struct ieee80211_bss_conf *info,
2704  					     u64 changed)
2705  {
2706  	struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
2707  	struct mac80211_hwsim_data *data = hw->priv;
2708  	unsigned int link_id = info->link_id;
2709  	struct mac80211_hwsim_link_data *link_data = &data->link_data[link_id];
        ...
2722  	if (changed & BSS_CHANGED_BEACON_ENABLED) {
2723  		wiphy_dbg(hw->wiphy, "  BCN EN: %d (BI=%u)\n",
2724  			  info->enable_beacon, info->beacon_int);
2725  		vp->bcn_en = info->enable_beacon;
2726  		if (data->started &&
2727  		    !hrtimer_active(&link_data->beacon_timer) &&
2728  		    info->enable_beacon) {
2729  			u64 tsf, until_tbtt;
2730  			u32 bcn_int;
2731  			link_data->beacon_int = info->beacon_int * 1024;
2732  			tsf = mac80211_hwsim_get_tsf(hw, vif);
2733  			bcn_int = link_data->beacon_int;
-> 2734  			until_tbtt = bcn_int - do_div(tsf, bcn_int);  // <- bcn_int=0; RSI=0 -> #DE
2735
2736  			hrtimer_start(&link_data->beacon_timer,
2737  				      ns_to_ktime(until_tbtt * NSEC_PER_USEC),
2738  				      HRTIMER_MODE_REL_SOFT);
2739  		} else if (!info->enable_beacon) {
        ...
2748  				link_data->beacon_int = 0;
        ...
2750  		}
2751  	}

2. drv_link_info_changed -- (net/mac80211/driver-ops.c:497)

460  void drv_link_info_changed(struct ieee80211_local *local,
461  			   struct ieee80211_sub_if_data *sdata,
462  			   struct ieee80211_bss_conf *info,
463  			   int link_id, u64 changed)
464  {
        ...
493  	trace_drv_link_info_changed(local, sdata, info, changed);
494  	if (local->ops->link_info_changed)
495  		local->ops->link_info_changed(&local->hw, &sdata->vif,
496  					      info, changed);
-> 497  	else if (local->ops->bss_info_changed)
498  		local->ops->bss_info_changed(&local->hw, &sdata->vif,
499  					     info, changed);
500  	trace_drv_return_void(local);
501  }

3. ieee80211_offchannel_return -- (net/mac80211/offchannel.c:160)

133  void ieee80211_offchannel_return(struct ieee80211_local *local)
134  {
135  	struct ieee80211_sub_if_data *sdata;
136
137  	lockdep_assert_wiphy(local->hw.wiphy);
        ...
142  	list_for_each_entry(sdata, &local->interfaces, list) {
        ...
157  		if (test_and_clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
158  				       &sdata->state)) {
159  			sdata->vif.bss_conf.enable_beacon = true;
-> 160  			ieee80211_link_info_change_notify(
161  				sdata, &sdata->deflink,
162  				BSS_CHANGED_BEACON_ENABLED);
163  		}
164  	}

4. __ieee80211_scan_completed -- (net/mac80211/scan.c:519)

516  	if (!hw_scan && was_scanning) {
517  		ieee80211_configure_filter(local);
518  		drv_sw_scan_complete(local, scan_sdata);
-> 519  		ieee80211_offchannel_return(local);
520  	}

5. cfg80211_wiphy_work -- (net/wireless/core.c:513)
   (workqueue dispatch point for scan completion)


Tentative Analysis

When a software scan completes, __ieee80211_scan_completed calls
ieee80211_offchannel_return, which iterates active interfaces and
re-enables beaconing for any interface that had its beacon stopped
during the scan. It sets bss_conf.enable_beacon = true and issues
a BSS_CHANGED_BEACON_ENABLED notification, but does NOT update
bss_conf.beacon_int.

This notification reaches mac80211_hwsim_link_info_changed. The
condition at lines 2726-2728 (data->started, timer not active,
enable_beacon) is satisfied, so the function enters the beacon
timer setup block at line 2731. It sets link_data->beacon_int =
info->beacon_int * 1024. When info->beacon_int is zero -- which
syzbot achieved by creating an AP interface with beacon_int=0 --
this produces link_data->beacon_int = 0 and bcn_int = 0 (line
2733). The subsequent do_div(tsf, bcn_int) with a zero divisor
triggers the x86 #DE (divide error) exception (RSI = 0, as
confirmed by the register dump).

An identical do_div(tsf, bcn_int) expression in
mac80211_hwsim_config (mac80211_hwsim.c:2635) is protected by a
guard: "if (!data->started || !link_data->beacon_int)" -- this
guard is absent from the BSS_CHANGED_BEACON_ENABLED path.


Potential Solution

Add a zero check for bcn_int immediately after it is loaded from
link_data->beacon_int (line 2733), before the do_div call. A
beacon interval of zero is invalid; when encountered, return
without starting the timer:

    bcn_int = link_data->beacon_int;
    if (!bcn_int)
        return;
    until_tbtt = bcn_int - do_div(tsf, bcn_int);

This mirrors the guard already present in mac80211_hwsim_config
for the same expression. The Fixes tag for the commit would be:

    Fixes: c51f878379b1 ("mac80211_hwsim: fix beacon timing")


More information

Oops-Analysis: http://oops.fenrus.org/reports/lkml/69efb8dd.050a0220.18b4f.0006.GAE_google.com/
Assisted-by: Copilot:claude-sonnet-4.6 linux-kernel-oops-x86.

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

end of thread, other threads:[~2026-04-27 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 19:28 [syzbot] [wireless?] divide error in mac80211_hwsim_link_info_changed (3) syzbot
2026-04-27 20:29 ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox