[linus:master] [ida] af73483f4e: WARNING:at_lib/idr.c:#ida_free

From: kernel test robot
Date: Wed Dec 27 2023 - 00:53:05 EST




Hello,

kernel test robot noticed "WARNING:at_lib/idr.c:#ida_free" on:

commit: af73483f4e8b6f5c68c9aa63257bdd929a9c194a ("ida: Fix crash in ida_free when the bitmap is empty")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master 5254c0cbc92d2a08e75443bdb914f1c4839cdf5a]
[test failed on linux-next/master 39676dfe52331dba909c617f213fdb21015c8d10]

in testcase: boot

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

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


+--------------------------------+------------+------------+
| | a9e01ac8c5 | af73483f4e |
+--------------------------------+------------+------------+
| WARNING:at_lib/idr.c:#ida_free | 0 | 13 |
| RIP:ida_free | 0 | 13 |
+--------------------------------+------------+------------+


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/202312271025.7f350868-oliver.sang@xxxxxxxxx


[ 147.266132][ T1] ------------[ cut here ]------------
[ 147.267720][ T1] ida_free called for id=0 which is not allocated.
[ 147.270105][ T1] WARNING: CPU: 0 PID: 1 at lib/idr.c:525 ida_free (lib/idr.c:525)
[ 147.272261][ T1] Modules linked in:
[ 147.273472][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 6.7.0-rc6-00167-gaf73483f4e8b #1 daa788c750d4052b7c3e67e211823fb8f7ec7373
[ 147.276598][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 147.279512][ T1] RIP: 0010:ida_free (lib/idr.c:525)
[ 147.280869][ T1] Code: e8 d5 b7 06 00 e9 94 00 00 00 41 83 ff 3e 76 53 49 8b 7e a0 4c 89 ee e8 4e ae 12 00 89 ee 48 c7 c7 40 56 db 86 e8 d0 33 bc fb <0f> 0b 48 b8 00 00 00 00 00 fc ff df 48 01 c3 c7 03 00 00 00 00 48
All code
========
0: e8 d5 b7 06 00 call 0x6b7da
5: e9 94 00 00 00 jmp 0x9e
a: 41 83 ff 3e cmp $0x3e,%r15d
e: 76 53 jbe 0x63
10: 49 8b 7e a0 mov -0x60(%r14),%rdi
14: 4c 89 ee mov %r13,%rsi
17: e8 4e ae 12 00 call 0x12ae6a
1c: 89 ee mov %ebp,%esi
1e: 48 c7 c7 40 56 db 86 mov $0xffffffff86db5640,%rdi
25: e8 d0 33 bc fb call 0xfffffffffbbc33fa
2a:* 0f 0b ud2 <-- trapping instruction
2c: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
33: fc ff df
36: 48 01 c3 add %rax,%rbx
39: c7 03 00 00 00 00 movl $0x0,(%rbx)
3f: 48 rex.W

Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
9: fc ff df
c: 48 01 c3 add %rax,%rbx
f: c7 03 00 00 00 00 movl $0x0,(%rbx)
15: 48 rex.W
[ 147.285910][ T1] RSP: 0000:ffffc9000001fcc0 EFLAGS: 00010246
[ 147.287600][ T1] RAX: 0000000000000000 RBX: 1ffff92000003f9a RCX: 0000000000000000
[ 147.290130][ T1] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 147.292478][ T1] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[ 147.294746][ T1] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 147.296921][ T1] R13: 0000000000000246 R14: ffffc9000001fd50 R15: 0000000000000000
[ 147.299360][ T1] FS: 0000000000000000(0000) GS:ffffffff876d7000(0000) knlGS:0000000000000000
[ 147.301863][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 147.303576][ T1] CR2: ffff88843ffff000 CR3: 00000000076b1000 CR4: 00000000000006b0
[ 147.305778][ T1] Call Trace:
[ 147.306783][ T1] <TASK>
[ 147.307689][ T1] ? __warn (kernel/panic.c:677)
[ 147.308848][ T1] ? ida_free (lib/idr.c:525)
[ 147.310354][ T1] ? report_bug (lib/bug.c:180 lib/bug.c:219)
[ 147.311607][ T1] ? handle_bug (arch/x86/kernel/traps.c:237)
[ 147.312877][ T1] ? exc_invalid_op (arch/x86/kernel/traps.c:258 (discriminator 1))
[ 147.314319][ T1] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:568)
[ 147.315780][ T1] ? ida_free (lib/idr.c:525)
[ 147.317007][ T1] ? ida_destroy (lib/idr.c:488)
[ 147.318327][ T1] ida_check_bad_free+0x23/0x200
[ 147.320141][ T1] ida_checks (lib/test_ida.c:206 (discriminator 4))
[ 147.321415][ T1] ? ida_check_alloc+0x180/0x180
[ 147.328122][ T1] do_one_initcall (init/main.c:1236)
[ 147.329710][ T1] ? trace_event_raw_event_initcall_level (init/main.c:1227)
[ 147.331457][ T1] ? kasan_set_track (mm/kasan/common.c:52)
[ 147.332761][ T1] ? __kasan_kmalloc (mm/kasan/common.c:374 mm/kasan/common.c:383)
[ 147.334110][ T1] do_initcalls (init/main.c:1297 init/main.c:1314)
[ 147.335391][ T1] kernel_init_freeable (init/main.c:1553)
[ 147.336847][ T1] ? rest_init (init/main.c:1433)
[ 147.338185][ T1] kernel_init (init/main.c:1443)
[ 147.339643][ T1] ? _raw_spin_unlock_irq (arch/x86/include/asm/irqflags.h:42 arch/x86/include/asm/irqflags.h:77 include/linux/spinlock_api_smp.h:159 kernel/locking/spinlock.c:202)
[ 147.341086][ T1] ret_from_fork (arch/x86/kernel/process.c:153)
[ 147.342257][ T1] ? rest_init (init/main.c:1433)
[ 147.343489][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:250)
[ 147.344899][ T1] </TASK>
[ 147.345857][ T1] irq event stamp: 16601637
[ 147.347086][ T1] hardirqs last enabled at (16601647): console_unlock (arch/x86/include/asm/irqflags.h:26 arch/x86/include/asm/irqflags.h:67 arch/x86/include/asm/irqflags.h:127 kernel/printk/printk.c:341 kernel/printk/printk.c:2706 kernel/printk/printk.c:3038)
[ 147.349820][ T1] hardirqs last disabled at (16601676): console_unlock (kernel/printk/printk.c:339 kernel/printk/printk.c:2706 kernel/printk/printk.c:3038)
[ 147.352396][ T1] softirqs last enabled at (16601672): __do_softirq (arch/x86/include/asm/preempt.h:27 kernel/softirq.c:400 kernel/softirq.c:582)
[ 147.354955][ T1] softirqs last disabled at (16601655): irq_exit_rcu (kernel/softirq.c:427 kernel/softirq.c:632 kernel/softirq.c:644)
[ 147.357497][ T1] ---[ end trace 0000000000000000 ]---


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



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