[linus:master] [scsi] 27f58c04a8: WARNING:at_drivers/scsi/sg.c:#sg_remove_sfp_usercontext[sg]

From: kernel test robot
Date: Wed Apr 03 2024 - 01:38:30 EST




Hello,

we noticed a WARN_ON_ONCE added in this commit was hit in our tests. below
details FYI.


kernel test robot noticed "WARNING:at_drivers/scsi/sg.c:#sg_remove_sfp_usercontext[sg]" on:

commit: 27f58c04a8f438078583041468ec60597841284d ("scsi: sg: Avoid sg device teardown race")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master 026e680b0a08a62b1d948e5a8ca78700bfac0e6e]
[test failed on linux-next/master c0b832517f627ead3388c6f0c74e8ac10ad5774b]

in testcase: ltp
version: ltp-x86_64-14c1f76-1_20240330
with following parameters:

disk: 1HDD
fs: ext4
test: syscalls-00



compiler: gcc-12
test machine: 4 threads 1 sockets Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz (Ivy Bridge) with 8G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)



If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-lkp/202404031335.2790c0b9-oliver.sang@xxxxxxxxx


kern :warn : [ 306.762148] ------------[ cut here ]------------
kern :warn : [ 306.767691] WARNING: CPU: 1 PID: 89 at drivers/scsi/sg.c:2236 sg_remove_sfp_usercontext (drivers/scsi/sg.c:2236 (discriminator 1)) sg
kern :warn : [ 306.778099] Modules linked in: vfat fat xfs ext2 netconsole btrfs blake2b_generic xor zstd_compress raid6_pq libcrc32c ipmi_devintf ipmi_msghandler sd_mod intel_rapl_msr t10_pi intel_rapl_common x86_pkg_temp_thermal crc64_rocksoft_generic intel_powerclamp crc64_rocksoft coretemp crc64 sg kvm_intel i915 kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sha512_ssse3 drm_buddy intel_gtt rapl drm_display_helper ahci intel_cstate wmi_bmof libahci ttm i2c_i801 intel_uncore i2c_smbus drm_kms_helper libata lpc_ich video mei_me mei binfmt_misc wmi loop fuse drm dm_mod ip_tables
kern :warn : [ 306.831048] CPU: 1 PID: 89 Comm: kworker/1:2 Tainted: G S 6.9.0-rc1-00040-g27f58c04a8f4 #1
kern :warn : [ 306.841615] Hardware name: Hewlett-Packard HP Pro 3340 MT/17A1, BIOS 8.07 01/24/2013
kern :warn : [ 306.850241] Workqueue: events sg_remove_sfp_usercontext [sg]
kern :warn : [ 306.856832] RIP: 0010:sg_remove_sfp_usercontext (drivers/scsi/sg.c:2236 (discriminator 1)) sg
kern :warn : [ 306.863786] Code: 48 c7 c1 80 b8 87 c1 48 c7 c7 e0 a1 87 c1 e8 4e 64 1c c1 e9 a2 fe ff ff be 03 00 00 00 48 89 df e8 4c 6b b2 c0 e9 55 ff ff ff <0f> 0b e9 26 ff ff ff 4c 89 e9 49 8d 55 6d 48 b8 00 00 00 00 00 fc
All code
========
0: 48 c7 c1 80 b8 87 c1 mov $0xffffffffc187b880,%rcx
7: 48 c7 c7 e0 a1 87 c1 mov $0xffffffffc187a1e0,%rdi
e: e8 4e 64 1c c1 callq 0xffffffffc11c6461
13: e9 a2 fe ff ff jmpq 0xfffffffffffffeba
18: be 03 00 00 00 mov $0x3,%esi
1d: 48 89 df mov %rbx,%rdi
20: e8 4c 6b b2 c0 callq 0xffffffffc0b26b71
25: e9 55 ff ff ff jmpq 0xffffffffffffff7f
2a:* 0f 0b ud2 <-- trapping instruction
2c: e9 26 ff ff ff jmpq 0xffffffffffffff57
31: 4c 89 e9 mov %r13,%rcx
34: 49 8d 55 6d lea 0x6d(%r13),%rdx
38: 48 rex.W
39: b8 00 00 00 00 mov $0x0,%eax
3e: 00 fc add %bh,%ah

Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: e9 26 ff ff ff jmpq 0xffffffffffffff2d
7: 4c 89 e9 mov %r13,%rcx
a: 49 8d 55 6d lea 0x6d(%r13),%rdx
e: 48 rex.W
f: b8 00 00 00 00 mov $0x0,%eax
14: 00 fc add %bh,%ah
kern :warn : [ 306.883440] RSP: 0018:ffffc900006d7d20 EFLAGS: 00010202
kern :warn : [ 306.889602] RAX: 0000000000000002 RBX: ffff888215d53798 RCX: ffffffffc186d39c
kern :warn : [ 306.897706] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff888215d53798
kern :warn : [ 306.905724] RBP: 0000000000008000 R08: 0000000000000000 R09: ffffed1042baa6f3
kern :warn : [ 306.913756] R10: ffff888215d5379b R11: ffffffff810057ca R12: ffff8881e3278060
kern :warn : [ 306.921778] R13: ffff888215d53700 R14: 0000000000000000 R15: ffff8881e3279328
kern :warn : [ 306.929814] FS: 0000000000000000(0000) GS:ffff88818a880000(0000) knlGS:0000000000000000
kern :warn : [ 306.938749] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kern :warn : [ 306.945348] CR2: 000055ea9b833000 CR3: 00000001d92b8002 CR4: 00000000001706f0
kern :warn : [ 306.953330] Call Trace:
kern :warn : [ 306.956618] <TASK>
kern :warn : [ 306.959550] ? __warn (kernel/panic.c:694)
kern :warn : [ 306.963647] ? sg_remove_sfp_usercontext (drivers/scsi/sg.c:2236 (discriminator 1)) sg
kern :warn : [ 306.969896] ? report_bug (lib/bug.c:180 lib/bug.c:219)
kern :warn : [ 306.974403] ? handle_bug (arch/x86/kernel/traps.c:239)
kern :warn : [ 306.978753] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1))
kern :warn : [ 306.983422] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621)
kern :warn : [ 306.988468] ? ret_from_fork_asm (arch/x86/entry/entry_64.S:256)
kern :warn : [ 306.993423] ? sg_remove_sfp_usercontext (arch/x86/include/asm/atomic.h:23 (discriminator 3) include/linux/atomic/atomic-arch-fallback.h:457 (discriminator 3) include/linux/atomic/atomic-instrumented.h:33 (discriminator 3) include/linux/refcount.h:136 (discriminator 3) include/linux/kref.h:36 (discriminator 3) drivers/scsi/sg.c:2236 (discriminator 3)) sg
kern :warn : [ 306.999688] ? sg_remove_sfp_usercontext (drivers/scsi/sg.c:2236 (discriminator 1)) sg
kern :warn : [ 307.005925] process_one_work (kernel/workqueue.c:3259)
kern :warn : [ 307.010868] worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
kern :warn : [ 307.015456] ? __kthread_parkme (arch/x86/include/asm/bitops.h:206 arch/x86/include/asm/bitops.h:238 include/asm-generic/bitops/instrumented-non-atomic.h:142 kernel/kthread.c:280)
kern :warn : [ 307.020433] ? schedule (arch/x86/include/asm/preempt.h:84 kernel/sched/core.c:6824 kernel/sched/core.c:6838)
kern :warn : [ 307.024690] ? __pfx_worker_thread (kernel/workqueue.c:3362)
kern :warn : [ 307.029842] kthread (kernel/kthread.c:388)
kern :warn : [ 307.033903] ? __pfx_kthread (kernel/kthread.c:341)
kern :warn : [ 307.038503] ret_from_fork (arch/x86/kernel/process.c:153)
kern :warn : [ 307.042919] ? __pfx_kthread (kernel/kthread.c:341)
kern :warn : [ 307.047519] ret_from_fork_asm (arch/x86/entry/entry_64.S:256)
kern :warn : [ 307.052288] </TASK>
kern :warn : [ 307.055298] ---[ end trace 0000000000000000 ]---



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240403/202404031335.2790c0b9-oliver.sang@xxxxxxxxx



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki