Re: ima: BUG: spinlock bad magic

From: Mimi Zohar
Date: Mon Sep 12 2016 - 06:59:01 EST


Hi Dmitry,

On Fri, 2016-09-09 at 21:19 +0200, Dmitry Vyukov wrote:
> Hello,
>
> While booting linux-next on 4affa544adb8077403893e62b9e327fcf87de6f7
> (Sep 8), I've got the following BUG:
>
> BUG: spinlock bad magic on CPU#3, swapper/0/1
> lock: template_list+0x0/0x60, .magic: 00000000, .owner: <none>/-1,
> .owner_cpu: 0
> CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc5-next-20160905+ #14
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> ffffffff886b6fe0 ffff88003ebf7d48 ffffffff82db81a9 ffffffff870b20c0
> fffffbfff10d6dfc ffffffff8a6ac660 ffff88003ebee040 dffffc0000000000
> ffffffff88ad2ca0 dffffc0000000000 ffff88003ebf7d80 ffffffff814a71fd
> Call Trace:
> [< inline >] __dump_stack lib/dump_stack.c:15
> [<ffffffff82db81a9>] dump_stack+0x12e/0x185 lib/dump_stack.c:51
> [<ffffffff814a71fd>] spin_dump+0x14d/0x280 kernel/locking/spinlock_debug.c:67
> [< inline >] spin_bug kernel/locking/spinlock_debug.c:75
> [< inline >] debug_spin_lock_before kernel/locking/spinlock_debug.c:83
> [<ffffffff814a75e4>] do_raw_spin_lock+0x224/0x2b0
> kernel/locking/spinlock_debug.c:135
> [< inline >] __raw_spin_lock ./include/linux/spinlock_api_smp.h:145
> [<ffffffff86e19a4b>] _raw_spin_lock+0x3b/0x50 kernel/locking/spinlock.c:151
> [< inline >] spin_lock ./include/linux/spinlock.h:302
> [<ffffffff896de48a>] ima_init_template_list+0x4c/0x10c
> security/integrity/ima/ima_template.c:218
> [<ffffffff896ddb26>] init_ima+0xf/0x44 security/integrity/ima/ima_main.c:421
> [<ffffffff81002310>] do_one_initcall+0xa0/0x2b0 init/main.c:782
> [< inline >] do_initcall_level init/main.c:848
> [< inline >] do_initcalls init/main.c:856
> [< inline >] do_basic_setup init/main.c:874
> [<ffffffff8963fd43>] kernel_init_freeable+0x476/0x52f init/main.c:1021
> [<ffffffff86dff183>] kernel_init+0x13/0x160 init/main.c:947
> [<ffffffff86e1ab4a>] ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
>
> Seems to be caused by:
>
> commit 5d74ec48cc8fd2109001c36bada5bf69c046b487
> Author: Mimi Zohar <zohar@xxxxxxxxxxxxxxxxxx>
> Date: Sat Sep 3 15:20:40 2016 +1000
> ima: store the builtin/custom template definitions in a list

Thank you for reporting this bug. The fix will be included in the v4
post.

Mimi