FYI, we noticed the following commit (built with gcc-5):
commit: feb689025fbb6f0aa6297d3ddf97de945ea4ad32 ("ALSA: seq: Protect in-kernel ioctl calls with mutex") https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git for-next
in testcase: trinity with following parameters:
runtime: 300s
test-description: Trinity is a linux system call fuzz tester. test-url: http://codemonkey.org.uk/projects/trinity/
on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 8G
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
+-------------------------------------------------+------------+------------+ | | f823b8a755 | feb689025f | +-------------------------------------------------+------------+------------+ | boot_successes | 0 | 0 | | boot_failures | 8 | 4 | | BUG:kernel_reboot-without-warning_in_test_stage | 8 | | | WARNING:possible_recursive_locking_detected | 0 | 4 | +-------------------------------------------------+------------+------------+
If you fix the issue, kindly add following tag Reported-by: kernel test robot rong.a.chen@intel.com
[ 17.585148] WARNING: possible recursive locking detected [ 17.585148] 5.1.0-rc1-00023-gfeb6890 #1 Not tainted [ 17.585148] -------------------------------------------- [ 17.585148] modprobe/226 is trying to acquire lock: [ 17.585148] (____ptrval____) (&client->ioctl_mutex){+.+.}, at: snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] [ 17.585148] but task is already holding lock: [ 17.585148] (____ptrval____) (&client->ioctl_mutex){+.+.}, at: snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] [ 17.585148] other info that might help us debug this: [ 17.585148] Possible unsafe locking scenario: [ 17.585148] [ 17.585148] CPU0 [ 17.585148] ---- [ 17.585148] lock(&client->ioctl_mutex); [ 17.585148] lock(&client->ioctl_mutex); [ 17.585148] [ 17.585148] *** DEADLOCK *** [ 17.585148] [ 17.585148] May be due to missing lock nesting notation [ 17.585148] [ 17.585148] 2 locks held by modprobe/226: [ 17.585148] #0: (____ptrval____) (&client->ioctl_mutex){+.+.}, at: snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] #1: (____ptrval____) (&grp->list_mutex/1){.+.+}, at: snd_seq_deliver_event+0x1f3/0x260 [ 17.585148] [ 17.585148] stack backtrace: [ 17.585148] CPU: 0 PID: 226 Comm: modprobe Not tainted 5.1.0-rc1-00023-gfeb6890 #1 [ 17.585148] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 [ 17.585148] Call Trace: [ 17.585148] __lock_acquire+0x2de/0x1120 [ 17.585148] lock_acquire+0xae/0x150 [ 17.585148] ? snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] ? snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] __mutex_lock+0x73/0x590 [ 17.585148] ? snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] ? snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] ? snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] snd_seq_kernel_client_ctl+0x71/0x90 [ 17.585148] receive_announce+0x40/0x60 [ 17.585148] receive_announce+0x35/0x40 [ 17.585148] snd_seq_deliver_single_event+0x101/0x210 [ 17.585148] snd_seq_deliver_event+0x11e/0x260 [ 17.585148] snd_seq_kernel_client_dispatch+0x5f/0x70 [ 17.585148] snd_seq_system_broadcast+0x62/0x70 [ 17.585148] snd_seq_ioctl_create_port+0x65/0x110 [ 17.585148] snd_seq_kernel_client_ctl+0x7a/0x90 [ 17.585148] create_port+0x10d/0x136 [snd_seq_dummy] [ 17.585148] ? dummy_free+0x10/0x10 [snd_seq_dummy] [ 17.585148] ? 0xffffffffa0000000 [ 17.585148] alsa_seq_dummy_init+0x4f/0xeca [snd_seq_dummy] [ 17.585148] ? create_port+0x136/0x136 [snd_seq_dummy] [ 17.585148] do_one_initcall+0x66/0x234 [ 17.585148] ? do_init_module+0x21/0x43d [ 17.585148] ? rcu_read_lock_sched_held+0x2e/0x60 [ 17.585148] ? kmem_cache_alloc_trace+0x172/0x280 [ 17.585148] ? do_init_module+0x21/0x43d [ 17.585148] do_init_module+0x58/0x43d [ 17.585148] load_module+0x15cb/0x1b50 [ 17.585148] ? kernel_read+0x25/0x40 [ 17.585148] ? __do_sys_finit_module+0xa8/0xb0 [ 17.585148] __do_sys_finit_module+0xa8/0xb0 [ 17.585148] do_syscall_64+0x4b/0x4c0 [ 17.585148] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 17.585148] RIP: 0033:0x7f52758cb229 [ 17.585148] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3f 4c 2b 00 f7 d8 64 89 01 48 [ 17.585148] RSP: 002b:00007ffdbeb1a4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 17.585148] RAX: ffffffffffffffda RBX: 000055620d2944d0 RCX: 00007f52758cb229 [ 17.585148] RDX: 0000000000000000 RSI: 000055620c571638 RDI: 0000000000000000 [ 17.585148] RBP: 000055620c571638 R08: 0000000000000000 R09: 000055620d293290 [ 17.585148] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 17.585148] R13: 000055620d294580 R14: 0000000000040000 R15: 0000000000000000 [ 17.758439] Segment Routing with IPv6 [ 17.760350] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 17.763895] 9pnet: Installing 9P2000 support [ 17.766159] start plist test [ 17.770969] end plist test [ 17.773352] ... APIC ID: 00000000 (0) [ 17.774143] ... APIC VERSION: 00050014 [ 17.774143] 0000000000000000000000000000000000000000000000000000000000000000 [ 17.774143] 0000000000000000000000000000000000000000000000000000000000000000 [ 17.774143] 0000000000000000000000000000000000000000000000000000000000001000 [ 17.786873] number of MP IRQ sources: 15. [ 17.800175] number of IO-APIC #0 registers: 24. [ 17.802406] testing the IO APIC....................... [ 17.804942] IO APIC #0...... [ 17.806554] .... register #00: 00000000 [ 17.808477] ....... : physical APIC id: 00 [ 17.820300] ....... : Delivery Type: 0 [ 17.822419] ....... : LTS : 0 [ 17.824383] .... register #01: 00170011 [ 17.826323] ....... : max redirection entries: 17 [ 17.828826] ....... : PRQ implemented: 0 [ 17.843383] ....... : IO APIC version: 11 [ 17.845625] .... register #02: 00000000 [ 17.847635] ....... : arbitration: 00 [ 17.849577] .... IRQ redirection table: [ 17.851562] IOAPIC 0: [ 17.852949] pin00, disabled, edge , high, V(00), IRR(0), S(0), physical, D(00), M(0) [ 17.858011] pin01, enabled , edge , high, V(22), IRR(0), S(0), physical, D(00), M(0) [ 17.861853] pin02, enabled , edge , high, V(30), IRR(0), S(0), physical, D(00), M(0) [ 17.875020] pin03, disabled, edge , high, V(00), IRR(0), S(0), physical, D(00), M(0)
To reproduce:
# build kernel cd linux cp config-5.1.0-rc1-00023-gfeb6890 .config make HOSTCC=gcc-5 CC=gcc-5 ARCH=x86_64 olddefconfig make HOSTCC=gcc-5 CC=gcc-5 ARCH=x86_64 prepare make HOSTCC=gcc-5 CC=gcc-5 ARCH=x86_64 modules_prepare make HOSTCC=gcc-5 CC=gcc-5 ARCH=x86_64 SHELL=/bin/bash make HOSTCC=gcc-5 CC=gcc-5 ARCH=x86_64 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, Rong Chen