Subject: [genetlink] 9eb5d9390b: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/rwsem.c

From: kernel test robot <[email-masked]>
Date: Sat, 27 Jun 2020 15:58:52 +0800

Greeting,

FYI, we noticed the following commit (built with gcc-9):

commit: 9eb5d9390b46aa669c119a4d003521dd8130b9f4 ("[PATCH net] genetlink: take netlink table lock when (un)registering")
url: https://github.com/0day-ci/linux/commits/Sean-Tranchetti/genetlink-take-netlink-table-lock-when-un-registering/20200627-083344

in testcase: boot

on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):

+-----------------------------------------------------------------------------+------------+------------+
|                                                                             | 0574e2000f | 9eb5d9390b |
+-----------------------------------------------------------------------------+------------+------------+
| boot_successes                                                              | 2          | 0          |
| boot_failures                                                               | 2          | 10         |
| Kernel_panic-not_syncing:VFS:Unable_to_mount_root_fs_on_unknown-block(#,#)  | 2          |            |
| BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/rwsem.c | 0          | 10         |
+-----------------------------------------------------------------------------+------------+------------+

If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email-masked]>

[    1.484228] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1530
[    1.484864] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0
[    1.484864] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc2-00314-g9eb5d9390b46a #1
[    1.484864] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[    1.484864] Call Trace:
[    1.484864]  dump_stack+0x57/0x6a
[    1.484864]  ___might_sleep+0x10b/0x11a
[    1.484864]  down_write+0x1c/0x4d
[    1.484864]  ? bpf_lwt_init+0x16/0x16
[    1.484864]  genl_register_family+0x97/0x4ae
[    1.484864]  ? bpf_lwt_init+0x16/0x16
[    1.484864]  devlink_init+0x11/0x28
[    1.484864]  do_one_initcall+0x9d/0x1bb
[    1.484864]  kernel_init_freeable+0x19c/0x200
[    1.484864]  ? rest_init+0xc6/0xc6
[    1.484864]  kernel_init+0xa/0x104
[    1.484864]  ret_from_fork+0x22/0x30
[    1.485148] PCI: Using ACPI for IRQ routing
[    1.486413] PCI: pci_cache_line_size set to 64 bytes
[    1.488044] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
[    1.488930] e820: reserve RAM buffer [mem 0xbffde000-0xbfffffff]
[    1.491749] clocksource: Switched to clocksource kvm-clock
[    1.760841] VFS: Disk quotas dquot_6.6.0
[    1.762724] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    1.764754] pnp: PnP ACPI init
[    1.766406] pnp 00:00: Plug and Play ACPI device, IDs PNP0b00 (active)
[    1.768381] pnp 00:01: Plug and Play ACPI device, IDs PNP0303 (active)
[    1.770337] pnp 00:02: Plug and Play ACPI device, IDs PNP0f13 (active)
[    1.772106] pnp 00:03: [dma 2]
[    1.773423] pnp 00:03: Plug and Play ACPI device, IDs PNP0700 (active)
[    1.775433] pnp 00:04: Plug and Play ACPI device, IDs PNP0400 (active)
[    1.777470] pnp 00:05: Plug and Play ACPI device, IDs PNP0501 (active)
[    1.779394] pnp 00:06: Plug and Play ACPI device, IDs PNP0501 (active)
[    1.781531] pnp: PnP ACPI: found 7 devices
[    1.801024] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    1.804057] NET: Registered protocol family 2
[    1.805883] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    1.808508] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    1.811316] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    1.822411] TCP: Hash tables configured (established 65536 bind 65536)
[    1.825283] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    1.827267] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    1.829849] NET: Registered protocol family 1
[    1.832327] RPC: Registered named UNIX socket transport module.
[    1.833979] RPC: Registered udp transport module.
[    1.835428] RPC: Registered tcp transport module.
[    1.836787] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.838437] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    1.839989] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    1.841577] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    1.843272] pci_bus 0000:00: resource 7 [mem 0xc0000000-0xfebfffff window]
[    1.844921] pci_bus 0000:00: resource 8 [mem 0x240000000-0x2bfffffff window]
[    1.846796] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    1.848221] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    1.849860] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    1.851551] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    1.854092] PCI: CLS 0 bytes, default 64
[    1.855599] Trying to unpack rootfs image as initramfs...
[    3.173317] Freeing initrd memory: 40380K
[    3.175647] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    3.177521] software IO TLB: mapped [mem 0xbbfde000-0xbffde000] (64MB)
[    3.180387] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x1fa3704c1a9, max_idle_ns: 440795296692 ns
[    3.188645] check: Scanning for low memory corruption every 60 seconds
[    3.191795] Initialise system trusted keyrings
[    3.196126] workingset: timestamp_bits=40 max_order=21 bucket_order=0
[    3.201530] NFS: Registering the id_resolver key type
[    3.203047] Key type id_resolver registered
[    3.204216] Key type id_legacy registered
[    3.205502] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    3.207814] Key type cifs.idmap registered
[    3.226627] Key type asymmetric registered
[    3.228159] Asymmetric key parser 'x509' registered
[    3.229723] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    3.231909] io scheduler mq-deadline registered
[    3.233196] io scheduler kyber registered
[    3.235185] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    3.237705] ACPI: Power Button [PWRF]
[    3.239600] ERST DBG: ERST support is disabled.
[    3.296154] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    3.298892] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    3.301612] 00:06: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[    3.307523] Initializing Nozomi driver 2.1d
[    3.309121] Non-volatile memory driver v1.3
[    3.310446] Hangcheck: starting hangcheck timer 0.9.1 (tick is 180 seconds, margin is 60 seconds).
[    3.319568] loop: module loaded
[    3.321242] rdac: device handler registered
[    3.322740] hp_sw: device handler registered
[    3.323913] emc: device handler registered
[    3.325326] alua: device handler registered
[    3.327170] ata_piix 0000:00:01.1: version 2.13
[    3.329229] scsi host0: ata_piix
[    3.330475] scsi host1: ata_piix
[    3.331746] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc080 irq 14
[    3.333483] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc088 irq 15
[    3.338871] MACsec IEEE 802.1AE
[    3.339632] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1530
[    3.341105] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0
[    3.341798] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W         5.8.0-rc2-00314-g9eb5d9390b46a #1
[    3.341798] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[    3.341798] Call Trace:
[    3.341798]  dump_stack+0x57/0x6a
[    3.341798]  ___might_sleep+0x10b/0x11a
[    3.341798]  down_write+0x1c/0x4d
[    3.341798]  ? dummy_init_module+0xe4/0xe4
[    3.341798]  genl_register_family+0x97/0x4ae
[    3.341798]  ? dummy_init_module+0xe4/0xe4
[    3.341798]  macsec_init+0x45/0x6a
[    3.341798]  do_one_initcall+0x9d/0x1bb
[    3.341798]  ? pstore_init+0x61/0x61
[    3.341798]  kernel_init_freeable+0x19c/0x200
[    3.341798]  ? rest_init+0xc6/0xc6
[    3.341798]  kernel_init+0xa/0x104
[    3.341798]  ret_from_fork+0x22/0x30
[    3.379723] cnic: QLogic cnicDriver v2.5.22 (July 20, 2015)
[    3.394719] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    3.396626] e100: Copyright(c) 1999-2006 Intel Corporation
[    3.398336] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[    3.399783] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    3.427228] PCI Interrupt Link [LNKC] enabled at IRQ 11
[    3.799991] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[    3.801765] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[    3.803434] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    3.804724] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    3.806170] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[    3.807679] igb: Copyright (c) 2007-2014 Intel Corporation.
[    3.808908] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[    3.811469] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    3.813293] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 5.1.0-k
[    3.815797] ixgbe: Copyright (c) 1999-2016 Intel Corporation.
[    3.817589] i40e: Intel(R) Ethernet Connection XL710 Network Driver - version 2.8.20-k
[    3.820012] i40e: Copyright (c) 2013 - 2019 Intel Corporation.
[    3.821715] ixgb: Intel(R) PRO/10GbE Network Driver - version 1.0.135-k2-NAPI
[    3.825520] ixgb: Copyright (c) 1999-2008 Intel Corporation.
[    3.827188] jme: JMicron JMC2XX ethernet driver version 1.0.8
[    3.828812] sky2: driver version 1.30
[    3.830175] myri10ge: Version 1.5.3-1.534
[    3.831464] ns83820.c: National Semiconductor DP83820 10/100/1000 driver.
[    3.833127] vxge: Copyright(c) 2002-2010 Exar Corp.
[    3.834880] vxge: Driver version: 2.5.3.22640-k
[    3.836303] QLogic 1/10 GbE Converged/Intelligent Ethernet Driver v5.3.66
[    3.837934] QLogic/NetXen Network Driver v4.0.82
[    3.839592] tehuti: Tehuti Networks(R) Network Driver, 7.29.3
[    3.841062] tehuti: Options: hw_csum 
[    3.842275] tlan: ThunderLAN driver v1.17
[    3.843590] tlan: 0 devices installed, PCI: 0  EISA: 0
[    3.845076] PPP generic driver version 2.4.2
[    3.846506] PPP BSD Compression module registered
[    3.847743] PPP Deflate Compression module registered
[    3.849154] PPP MPPE Compression module registered
[    3.850404] NET: Registered protocol family 24
[    3.851580] SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256) (6 bit encapsulation enabled).
[    3.853942] SLIP linefill/keepalive option.
[    3.855353] usbcore: registered new interface driver catc
[    3.856687] usbcore: registered new interface driver kaweth
[    3.858180] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    3.860559] usbcore: registered new interface driver pegasus
[    3.862234] usbcore: registered new interface driver rtl8150
[    3.864434] usbcore: registered new interface driver asix
[    3.865939] usbcore: registered new interface driver ax88179_178a
[    3.867130] usbcore: registered new interface driver cdc_ether
[    3.868220] usbcore: registered new interface driver cdc_eem
[    3.869638] usbcore: registered new interface driver dm9601
[    3.870626] usbcore: registered new interface driver smsc75xx
[    3.871935] usbcore: registered new interface driver smsc95xx
[    3.873216] usbcore: registered new interface driver gl620a
[    3.874378] usbcore: registered new interface driver net1080
[    3.875626] usbcore: registered new interface driver plusb
[    3.877129] usbcore: registered new interface driver rndis_host
[    3.878774] usbcore: registered new interface driver cdc_subset
[    3.880429] usbcore: registered new interface driver zaurus
[    3.882039] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[    3.884658] usbcore: registered new interface driver int51x1
[    3.886150] usbcore: registered new interface driver kalmia
[    3.887602] usbcore: registered new interface driver ipheth
[    3.888657] usbcore: registered new interface driver sierra_net
[    3.889692] usbcore: registered new interface driver cx82310_eth
[    3.891300] usbcore: registered new interface driver cdc_ncm
[    3.892796] usbcore: registered new interface driver lg-vl600
[    3.894867] aoe: AoE v85 initialised.
[    3.896116] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.897627] ehci-pci: EHCI PCI platform driver
[    3.899097] uhci_hcd: USB Universal Host Controller Interface driver
[    3.900662] usbcore: registered new interface driver cdc_acm
[    3.902031] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    3.903773] usbcore: registered new interface driver cdc_wdm
[    3.905196] usbcore: registered new interface driver usb-storage
[    3.906716] usbcore: registered new interface driver ums-alauda
[    3.908171] usbcore: registered new interface driver ums-cypress
[    3.909315] usbcore: registered new interface driver ums-datafab
[    3.910828] usbcore: registered new interface driver ums_eneub6250
[    3.912021] usbcore: registered new interface driver ums-freecom
[    3.913269] usbcore: registered new interface driver ums-isd200
[    3.914392] usbcore: registered new interface driver ums-jumpshot
[    3.915774] usbcore: registered new interface driver ums-karma
[    3.917103] usbcore: registered new interface driver ums-onetouch
[    3.918458] usbcore: registered new interface driver ums-realtek

To reproduce:

        # build kernel
	cd linux
	cp config-5.8.0-rc2-00314-g9eb5d9390b46a .config
	make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage

        git clone https://github.com/intel/lkp-tests.git
        cd lkp-tests
        bin/lkp qemu -k <bzImage> job-script # job-script is attached in this email

Thanks,
lkp