lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxfSV66cYq7N6i5H@LQ3V64L9R2>
Date: Tue, 22 Oct 2024 09:27:03 -0700
From: Joe Damato <jdamato@...tly.com>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Simon Horman <horms@...nel.org>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: RTNL: assertion failed at net/core/dev.c

On Tue, Oct 22, 2024 at 11:24:45AM +0300, Dmitry Antipov wrote:
> Hello,
> 
> running around https://syzkaller.appspot.com/bug?extid=b390c8062d8387b6272a
> with net-next and linux-next, I've noticed the following:
> 
> # reboot -f
> ...
> [   16.324520][ T5121] ------------[ cut here ]------------
> [   16.324750][ T5121] RTNL: assertion failed at net/core/dev.c (6627)
> [   16.325133][ T5121] WARNING: CPU: 0 PID: 5121 at net/core/dev.c:6627 netif_queue_set_napi+0x25b/0x2e0
> [   16.325530][ T5121] Modules linked in:
> [   16.325697][ T5121] CPU: 0 UID: 0 PID: 5121 Comm: reboot Not tainted 6.12.0-rc4-00051-g5d4382aa0e93 #4
> [   16.326085][ T5121] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
> [   16.326470][ T5121] RIP: 0010:netif_queue_set_napi+0x25b/0x2e0
> [   16.326725][ T5121] Code: 62 fe ff ff e8 96 a2 e1 f8 c6 05 37 47 7e 07 01
> 90 ba e3 19 00 00 48 c7 c6 c0 f5 7a 8c 48 c7 c7 00 f6 7a 8c e8 76 85 a4 f8
> 90 <0f> 0b 90 90 e9 33 fe ff ff e8 67 a2 e1 f8 90 0f 0b 90 e8 5e a2 e1
> [   16.327487][ T5121] RSP: 0018:ffffc9000320fb58 EFLAGS: 00010282
> [   16.327737][ T5121] RAX: 0000000000000000 RBX: ffff888107a48000 RCX: 0000000000000000
> [   16.328169][ T5121] RDX: 0000000000000000 RSI: ffffffff8abe03c6 RDI: 0000000000000001
> [   16.328483][ T5121] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
> [   16.328794][ T5121] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
> [   16.329128][ T5121] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888105b04940
> [   16.329517][ T5121] FS:  00007efd0d0c7380(0000) GS:ffff888062800000(0000) knlGS:0000000000000000
> [   16.329877][ T5121] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   16.330148][ T5121] CR2: 00007efd0d3af8c0 CR3: 000000002460a000 CR4: 00000000000006f0
> [   16.330467][ T5121] Call Trace:
> [   16.330601][ T5121]  <TASK>
> [   16.330723][ T5121]  ? __warn.cold+0x163/0x2ef
> [   16.330933][ T5121]  ? netif_queue_set_napi+0x25b/0x2e0
> [   16.331157][ T5121]  ? report_bug+0x28f/0x490
> [   16.331349][ T5121]  ? handle_bug+0x54/0x90
> [   16.331527][ T5121]  ? exc_invalid_op+0x17/0x50
> [   16.331719][ T5121]  ? asm_exc_invalid_op+0x1a/0x20
> [   16.331928][ T5121]  ? __warn_printk.cold+0x146/0x1a0
> [   16.332144][ T5121]  ? netif_queue_set_napi+0x25b/0x2e0
> [   16.332364][ T5121]  ? netif_queue_set_napi+0x25a/0x2e0
> [   16.332583][ T5121]  e1000_down+0x2be/0x6b0
> [   16.332767][ T5121]  __e1000_shutdown.isra.0+0x1d6/0x7f0
> [   16.332995][ T5121]  e1000_shutdown+0x6d/0x110
> [   16.333191][ T5121]  ? __pfx_e1000_shutdown+0x10/0x10
> [   16.333405][ T5121]  ? lockdep_hardirqs_on+0x7b/0x110
> [   16.333618][ T5121]  ? _raw_spin_unlock_irqrestore+0x3b/0x80
> [   16.333854][ T5121]  ? __pm_runtime_resume+0xc3/0x170
> [   16.334072][ T5121]  ? __pfx_e1000_shutdown+0x10/0x10
> [   16.334323][ T5121]  pci_device_shutdown+0x83/0x160
> [   16.334539][ T5121]  device_shutdown+0x3ba/0x5c0
> [   16.334738][ T5121]  ? __pfx_pci_device_shutdown+0x10/0x10
> [   16.334979][ T5121]  kernel_restart+0x64/0xa0
> [   16.335170][ T5121]  __do_sys_reboot+0x29a/0x400
> [   16.335369][ T5121]  ? __pfx___do_sys_reboot+0x10/0x10
> [   16.335582][ T5121]  ? lock_acquire+0x2f/0xb0
> [   16.335772][ T5121]  ? __pfx_ksys_sync+0x10/0x10
> [   16.335975][ T5121]  do_syscall_64+0xc7/0x250
> [   16.336166][ T5121]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> [   16.336408][ T5121] RIP: 0033:0x7efd0d2208b4
> [   16.336589][ T5121] Code: f0 ff ff 73 01 c3 48 8b 0d 71 55 0d 00 f7 d8 64
> 89 01 48 83 c8 ff c3 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f
> 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 45 55 0d 00 f7 d8 64 89 02 48 83
> [   16.337336][ T5121] RSP: 002b:00007ffd84212378 EFLAGS: 00000202 ORIG_RAX: 00000000000000a9
> [   16.337663][ T5121] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007efd0d2208b4
> [   16.337971][ T5121] RDX: 0000000001234567 RSI: 0000000028121969 RDI: 00000000fee1dead
> [   16.338381][ T5121] RBP: 0000000000000004 R08: 0000000000000001 R09: 00007efd0d3af8ca
> [   16.338690][ T5121] R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffd842124c8
> [   16.339003][ T5121] R13: 00007ffd842124e0 R14: 0000558687946169 R15: 00007efd0d3fea80
> [   16.339322][ T5121]  </TASK>
> [   16.339448][ T5121] Kernel panic - not syncing: kernel: panic_on_warn set ...
> [   16.339729][ T5121] CPU: 0 UID: 0 PID: 5121 Comm: reboot Not tainted 6.12.0-rc4-00051-g5d4382aa0e93 #4
> [   16.340092][ T5121] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
> [   16.340458][ T5121] Call Trace:
> [   16.340590][ T5121]  <TASK>
> [   16.340709][ T5121]  dump_stack_lvl+0x100/0x190
> [   16.340898][ T5121]  panic+0x314/0x6da
> [   16.341061][ T5121]  ? __pfx_panic+0x10/0x10
> [   16.341242][ T5121]  ? show_trace_log_lvl+0x1ac/0x300
> [   16.341454][ T5121]  ? check_panic_on_warn+0x1f/0x90
> [   16.341664][ T5121]  check_panic_on_warn.cold+0x19/0x34
> [   16.341879][ T5121]  ? netif_queue_set_napi+0x25b/0x2e0
> [   16.342098][ T5121]  __warn.cold+0x16f/0x2ef
> [   16.342278][ T5121]  ? netif_queue_set_napi+0x25b/0x2e0
> [   16.342491][ T5121]  report_bug+0x28f/0x490
> [   16.342665][ T5121]  handle_bug+0x54/0x90
> [   16.342831][ T5121]  exc_invalid_op+0x17/0x50
> [   16.343017][ T5121]  asm_exc_invalid_op+0x1a/0x20
> [   16.343265][ T5121] RIP: 0010:netif_queue_set_napi+0x25b/0x2e0
> [   16.343508][ T5121] Code: 62 fe ff ff e8 96 a2 e1 f8 c6 05 37 47 7e 07 01
> 90 ba e3 19 00 00 48 c7 c6 c0 f5 7a 8c 48 c7 c7 00 f6 7a 8c e8 76 85 a4 f8
> 90 <0f> 0b 90 90 e9 33 fe ff ff e8 67 a2 e1 f8 90 0f 0b 90 e8 5e a2 e1
> [   16.344252][ T5121] RSP: 0018:ffffc9000320fb58 EFLAGS: 00010282
> [   16.344493][ T5121] RAX: 0000000000000000 RBX: ffff888107a48000 RCX: 0000000000000000
> [   16.344798][ T5121] RDX: 0000000000000000 RSI: ffffffff8abe03c6 RDI: 0000000000000001
> [   16.345109][ T5121] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
> [   16.345420][ T5121] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
> [   16.345734][ T5121] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888105b04940
> [   16.346115][ T5121]  ? __warn_printk.cold+0x146/0x1a0
> [   16.346328][ T5121]  ? netif_queue_set_napi+0x25a/0x2e0
> [   16.346547][ T5121]  e1000_down+0x2be/0x6b0
> [   16.346722][ T5121]  __e1000_shutdown.isra.0+0x1d6/0x7f0
> [   16.346943][ T5121]  e1000_shutdown+0x6d/0x110
> [   16.347133][ T5121]  ? __pfx_e1000_shutdown+0x10/0x10
> [   16.347345][ T5121]  ? lockdep_hardirqs_on+0x7b/0x110
> [   16.347570][ T5121]  ? _raw_spin_unlock_irqrestore+0x3b/0x80
> [   16.347806][ T5121]  ? __pm_runtime_resume+0xc3/0x170
> [   16.348119][ T5121]  ? __pfx_e1000_shutdown+0x10/0x10
> [   16.348335][ T5121]  pci_device_shutdown+0x83/0x160
> [   16.348542][ T5121]  device_shutdown+0x3ba/0x5c0
> [   16.348738][ T5121]  ? __pfx_pci_device_shutdown+0x10/0x10
> [   16.348970][ T5121]  kernel_restart+0x64/0xa0
> [   16.349159][ T5121]  __do_sys_reboot+0x29a/0x400
> [   16.349355][ T5121]  ? __pfx___do_sys_reboot+0x10/0x10
> [   16.349573][ T5121]  ? lock_acquire+0x2f/0xb0
> [   16.349760][ T5121]  ? __pfx_ksys_sync+0x10/0x10
> [   16.349960][ T5121]  do_syscall_64+0xc7/0x250
> [   16.350148][ T5121]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> [   16.350388][ T5121] RIP: 0033:0x7efd0d2208b4
> [   16.350568][ T5121] Code: f0 ff ff 73 01 c3 48 8b 0d 71 55 0d 00 f7 d8 64
> 89 01 48 83 c8 ff c3 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f
> 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 45 55 0d 00 f7 d8 64 89 02 48 83
> [   16.351318][ T5121] RSP: 002b:00007ffd84212378 EFLAGS: 00000202 ORIG_RAX: 00000000000000a9
> [   16.351649][ T5121] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007efd0d2208b4
> [   16.351962][ T5121] RDX: 0000000001234567 RSI: 0000000028121969 RDI: 00000000fee1dead
> [   16.352274][ T5121] RBP: 0000000000000004 R08: 0000000000000001 R09: 00007efd0d3af8ca
> [   16.352587][ T5121] R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffd842124c8
> [   16.352897][ T5121] R13: 00007ffd842124e0 R14: 0000558687946169 R15: 00007efd0d3fea80
> [   16.353215][ T5121]  </TASK>
> [   16.353721][ T5121] Kernel Offset: disabled
> [   16.353907][ T5121] Rebooting in 86400 seconds..
> 
> Fast manual bisection makes me think that this was introduced with
> 8f7ff18a5ec7 ("e1000: Link NAPI instances to queues and IRQs"), so
> please look at this patch once again.

Thanks for reporting this.

The issue is that in the path highlighted above, rtnl is not held
before e1000_down is called.

I believe this will fix the issue you are seeing, but I am not sure
if a similar change needs to be added for power management's suspend
(which also eventually calls e1000_down):

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 4de9b156b2be..ebbd3fa3a5c8 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -5074,7 +5074,9 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
                        usleep_range(10000, 20000);

                WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
+               rtnl_lock()
                e1000_down(adapter);
+               rtnl_unlock();
        }

        status = er32(STATUS);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ