Re: [refcount] 84b21d1291: WARNING:at_lib/refcount.c:#refcount_warn_saturate
From: Will Deacon
Date: Tue Nov 19 2019 - 13:27:57 EST
On Wed, Nov 13, 2019 at 11:07:49AM +0800, kernel test robot wrote:
> FYI, we noticed the following commit (built with gcc-7):
>
> commit: 84b21d1291c67ac216f8106783609007a51baa78 ("refcount: Consolidate implementations of refcount_t")
> https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git for-kernelci
>
> in testcase: ocfs2test
Looks like the same issue I previously reported here:
https://lore.kernel.org/lkml/20190912105640.2l6mtdjmcyyhmyun@willie-the-truck/
Will
> [ 69.895894] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1533
> [ 69.898664] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2462, name: mount.ocfs2
> [ 69.900964] CPU: 1 PID: 2462 Comm: mount.ocfs2 Not tainted 5.4.0-rc2-00008-g84b21d1291c67 #1
> [ 69.904287] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
> [ 69.907871] Call Trace:
> [ 69.909860] dump_stack+0x5c/0x7b
> [ 69.911534] ___might_sleep+0x102/0x120
> [ 69.913579] down_write+0x1c/0x50
> [ 69.915478] configfs_depend_item+0x3a/0xb0
> [ 69.917386] o2hb_region_pin+0xf9/0x180 [ocfs2_nodemanager]
> [ 69.919990] ? inode_doinit_with_dentry+0x250/0x4e0
> [ 69.922010] o2hb_register_callback+0xc6/0x2a0 [ocfs2_nodemanager]
> [ 69.924758] dlm_join_domain+0xbd/0x790 [ocfs2_dlm]
> [ 69.927195] ? debugfs_create_dir+0xc4/0x100
> [ 69.928725] ? dlm_alloc_ctxt+0x42f/0x560 [ocfs2_dlm]
> [ 69.930592] dlm_register_domain+0x31f/0x440 [ocfs2_dlm]
> [ 69.932605] ? _cond_resched+0x19/0x30
> [ 69.934177] o2cb_cluster_connect+0x132/0x2c0 [ocfs2_stack_o2cb]
> [ 69.936181] ocfs2_cluster_connect+0x14b/0x220 [ocfs2_stackglue]
> [ 69.938109] ocfs2_dlm_init+0x2e9/0x4b0 [ocfs2]
> [ 69.939740] ? ocfs2_init_node_maps+0x50/0x50 [ocfs2]
> [ 69.941364] ocfs2_fill_super+0xcf4/0x12a0 [ocfs2]
> [ 69.943471] ? ocfs2_initialize_super+0x1030/0x1030 [ocfs2]
> [ 69.945609] mount_bdev+0x173/0x1b0
> [ 69.947146] legacy_get_tree+0x27/0x40
> [ 69.948647] vfs_get_tree+0x25/0xc0
> [ 69.950164] do_mount+0x715/0x9a0
> [ 69.951543] ksys_mount+0x80/0xd0
> [ 69.952573] __x64_sys_mount+0x21/0x30
> [ 69.953894] do_syscall_64+0x5b/0x1d0
> [ 69.955682] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 69.957023] RIP: 0033:0x7f5f35af548a
> [ 69.958086] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d de f9 2a 00 f7 d8 64 89 01 48
> [ 69.962124] RSP: 002b:00007ffdf0bdd3a8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
> [ 69.963869] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5f35af548a
> [ 69.965508] RDX: 000055a529b593ee RSI: 000055a52b7e20b0 RDI: 000055a52b7e2310
> [ 69.967187] RBP: 00007ffdf0bdd550 R08: 000055a52b7e22b0 R09: 0000000000000020
> [ 69.968831] R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffdf0bdd440
> [ 69.970483] R13: 0000000000000000 R14: 000055a52b7e3000 R15: 00007ffdf0bdd3c0
> [ 69.980629] o2dlm: Joining domain B7CA1824044F4C99924CDC31E1E40968
> [ 69.980630] (
> [ 69.982192] 1
> [ 69.983075] ) 1 nodes
> [ 69.990740] JBD2: Ignoring recovery information on journal
> [ 70.000782] ocfs2: Mounting device (8,0) on (node 1, slot 0) with ordered data mode.
> [ 70.020367] mount /dev/sda /mnt/ocfs2 /dev/sda 16515072 243712 16271360 2% /mnt/ocfs2
> [ 70.020369]
> [ 70.026416] OK
> [ 70.026418]
> [ 70.031238] create testdir /mnt/ocfs2/20191113_002600
> [ 70.031240]
> [ 70.043257] create 15890 files .
> [ 70.043259]
> [ 70.046469]
> [ 74.089735] o2dlm: Leaving domain B7CA1824044F4C99924CDC31E1E40968
> [ 74.155669] blk_update_request: I/O error, dev fd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
> [ 74.157766] floppy: error 10 while reading block 0
> [ 76.034283] ocfs2: Unmounting device (8,0) on (node 1)
> [ 76.036255] ------------[ cut here ]------------
> [ 76.037559] refcount_t: underflow; use-after-free.
> [ 76.039312] WARNING: CPU: 1 PID: 2523 at lib/refcount.c:28 refcount_warn_saturate+0x8d/0xf0
> [ 76.042310] Modules linked in: ocfs2_stack_o2cb ocfs2_dlm ocfs2 ocfs2_nodemanager ocfs2_stackglue jbd2 intel_rapl_msr intel_rapl_common crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sr_mod cdrom ata_generic pata_acpi sd_mod sg ppdev bochs_drm drm_vram_helper ttm aesni_intel drm_kms_helper crypto_simd syscopyarea sysfillrect sysimgblt fb_sys_fops cryptd drm glue_helper snd_pcm ata_piix snd_timer libata snd joydev serio_raw soundcore pcspkr virtio_scsi i2c_piix4 parport_pc parport floppy ip_tables
> [ 76.056817] CPU: 1 PID: 2523 Comm: umount Tainted: G W 5.4.0-rc2-00008-g84b21d1291c67 #1
> [ 76.058930] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
> [ 76.060887] RIP: 0010:refcount_warn_saturate+0x8d/0xf0
> [ 76.062346] Code: 05 ae 76 37 01 01 e8 62 a7 c1 ff 0f 0b c3 80 3d a1 76 37 01 00 75 ad 48 c7 c7 10 9a 93 b4 c6 05 91 76 37 01 01 e8 43 a7 c1 ff <0f> 0b c3 80 3d 85 76 37 01 00 75 8e 48 c7 c7 90 99 93 b4 c6 05 75
> [ 76.066602] RSP: 0018:ffffb13780483e20 EFLAGS: 00010282
> [ 76.068139] RAX: 0000000000000000 RBX: ffff9858997d9000 RCX: 0000000000000000
> [ 76.069951] RDX: ffff9858ffd27640 RSI: ffff9858ffd17778 RDI: ffff9858ffd17778
> [ 76.071781] RBP: ffff9858a0009800 R08: 0000000000000506 R09: 0000000000aaaaaa
> [ 76.073606] R10: ffff985899777900 R11: ffff9858d79ccd10 R12: ffffb13780483e34
> [ 76.075447] R13: ffff9858997d9240 R14: ffff9858997d90c8 R15: 0000000000000000
> [ 76.077285] FS: 00007f139509ee40(0000) GS:ffff9858ffd00000(0000) knlGS:0000000000000000
> [ 76.079283] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 76.080899] CR2: 00000000004216d0 CR3: 00000001d5e56000 CR4: 00000000000406e0
> [ 76.082717] Call Trace:
> [ 76.083876] ocfs2_dismount_volume+0x32a/0x3e0 [ocfs2]
> [ 76.085389] generic_shutdown_super+0x6c/0x120
> [ 76.086812] kill_block_super+0x21/0x50
> [ 76.088112] deactivate_locked_super+0x3f/0x70
> [ 76.089502] cleanup_mnt+0xb8/0x150
> [ 76.090748] task_work_run+0xa3/0xe0
> [ 76.092005] exit_to_usermode_loop+0xeb/0xf0
> [ 76.093357] do_syscall_64+0x1a7/0x1d0
> [ 76.094637] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 76.096130] RIP: 0033:0x7f1394982d77
> [ 76.097386] Code: 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d f1 00 2b 00 f7 d8 64 89 01 48
> [ 76.101690] RSP: 002b:00007ffd3220b638 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
> [ 76.103605] RAX: 0000000000000000 RBX: 000056324cf1f080 RCX: 00007f1394982d77
> [ 76.105430] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000056324cf1f260
> [ 76.107277] RBP: 000056324cf1f260 R08: 000056324cf20600 R09: 0000000000000015
> [ 76.109125] R10: 00000000000006b4 R11: 0000000000000246 R12: 00007f1394e84e64
> [ 76.110980] R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffd3220b8c0
> [ 76.112828] ---[ end trace 60d2f00fc8257cff ]---