Re: [PATCH -mm] mm, swap: Fix bad swap file entry warning

From: Qian Cai
Date: Fri May 31 2019 - 15:20:35 EST


On Fri, 2019-05-31 at 11:27 -0700, Dexuan-Linux Cui wrote:
> Hi,
> Did you know about the panic reported here:
> https://marc.info/?t=155930773000003&r=1&w=2
>
> "Kernel panic - not syncing: stack-protector: Kernel stack is
> corrupted in: write_irq_affinity.isra"
>
> This panic is reported on PowerPC and x86.
>
> In the case of x86, we see a lot of "get_swap_device: Bad swap file entry"
> errors before the panic:
>
> ...
> [ÂÂÂ24.404693] get_swap_device: Bad swap file entry 5800000000000001
> [ÂÂÂ24.408702] get_swap_device: Bad swap file entry 5c00000000000001
> [ÂÂÂ24.412510] get_swap_device: Bad swap file entry 6000000000000001
> [ÂÂÂ24.416519] get_swap_device: Bad swap file entry 6400000000000001
> [ÂÂÂ24.420217] get_swap_device: Bad swap file entry 6800000000000001
> [ÂÂÂ24.423921] get_swap_device: Bad swap file entry 6c00000000000001
> [ÂÂÂ24.427685] get_swap_device: Bad swap file entry 7000000000000001
> [ÂÂÂ24.760678] Kernel panic - not syncing: stack-protector: Kernel
> stack is corrupted in: write_irq_affinity.isra.7+0xe5/0xf0
> [ÂÂÂ24.760975] CPU: 25 PID: 1773 Comm: irqbalance Not tainted
> 5.2.0-rc2-2fefea438dac #1
> [ÂÂÂ24.760975] Hardware name: Microsoft Corporation Virtual
> Machine/Virtual Machine, BIOS 090007ÂÂ06/02/2017
> [ÂÂÂ24.760975] Call Trace:
> [ÂÂÂ24.760975]ÂÂdump_stack+0x46/0x5b
> [ÂÂÂ24.760975]ÂÂpanic+0xf8/0x2d2
> [ÂÂÂ24.760975]ÂÂ? write_irq_affinity.isra.7+0xe5/0xf0
> [ÂÂÂ24.760975]ÂÂ__stack_chk_fail+0x15/0x20
> [ÂÂÂ24.760975]ÂÂwrite_irq_affinity.isra.7+0xe5/0xf0
> [ÂÂÂ24.760975]ÂÂproc_reg_write+0x40/0x60
> [ÂÂÂ24.760975]ÂÂvfs_write+0xb3/0x1a0
> [ÂÂÂ24.760975]ÂÂ? _cond_resched+0x16/0x40
> [ÂÂÂ24.760975]ÂÂksys_write+0x5c/0xe0
> [ÂÂÂ24.760975]ÂÂdo_syscall_64+0x4f/0x120
> [ÂÂÂ24.760975]ÂÂentry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ÂÂÂ24.760975] RIP: 0033:0x7f93bcdde187
> [ÂÂÂ24.760975] Code: c3 66 90 41 54 55 49 89 d4 53 48 89 f5 89 fb 48
> 83 ec 10 e8 6b 05 02 00 4c 89 e2 41 89 c0 48 89 ee 89 df b8 01 00 00
> 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 a4 05 02
> 00 48
> [ÂÂÂ24.760975] RSP: 002b:00007ffc4600d900 EFLAGS: 00000293 ORIG_RAX:
> 0000000000000001
> [ÂÂÂ24.760975] RAX: ffffffffffffffda RBX: 0000000000000006 RCX:
> 00007f93bcdde187
> [ÂÂÂ24.760975] RDX: 0000000000000008 RSI: 00005595ad515540 RDI:
> 0000000000000006
> [ÂÂÂ24.760975] RBP: 00005595ad515540 R08: 0000000000000000 R09:
> 00005595ab381820
> [ÂÂÂ24.760975] R10: 0000000000000008 R11: 0000000000000293 R12:
> 0000000000000008
> [ÂÂÂ24.760975] R13: 0000000000000008 R14: 00007f93bd0b62a0 R15:
> 00007f93bd0b5760
> [ÂÂÂ24.760975] Kernel Offset: 0x3a000000 from 0xffffffff81000000
> (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
> [ÂÂÂ24.760975] ---[ end Kernel panic - not syncing: stack-protector:
> Kernel stack is corrupted in: write_irq_affinity.isra.7+0xe5/0xf0 ]---

Looks familiar,

https://lore.kernel.org/lkml/1559242868.6132.35.camel@xxxxxx/

I suppose Andrew might be better of reverting the whole series first before Yury
came up with a right fix, so that other people who is testing linux-next don't
need to waste time for the same problem.