linux-next: x86: Unalbe to run x32 processes on the x86_64 kernel

From: Andrei Vagin
Date: Mon Mar 20 2017 - 19:58:36 EST


Hello,

We run CRIU tests on linux-next. And today we found that when we start
x32 processes, a kernel bug is triggered:

[root@fc24 ~]# uname -a
Linux fc24 4.11.0-rc2-next-20170320 #159 SMP Mon Mar 20 16:53:58 PDT
2017 x86_64 x86_64 x86_64 GNU/Linux
[root@fc24 ~]# cat t.c
int main()
{
return 0;
}
[root@fc24 ~]# gcc -m32 t.c
[root@fc24 ~]# ./a.out
Killed
[root@fc24 ~]# dmesg
[ 90.033310] BUG: unable to handle kernel paging request at ffffffffff576060
[ 90.034008] IP: 0xf76fa9f4
[ 90.034008] PGD 13de1e067
[ 90.034008] P4D 13de1e067
[ 90.034008] PUD 13de20067
[ 90.034008] PMD 13de21067
[ 90.034008] PTE 800000013fd09161

[ 90.034008] Oops: 0003 [#1] SMP
[ 90.034008] Modules linked in:
[ 90.034008] CPU: 1 PID: 475 Comm: a.out Not tainted
4.11.0-rc2-next-20170320 #159
[ 90.034008] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.9.3-1.fc25 04/01/2014
[ 90.034008] task: ffff9d11efdca700 task.stack: ffffb0ccc0d4c000
[ 90.034008] RIP: 0023:0xf76fa9f4
[ 90.034008] RSP: 002b:00000000ffafc860 EFLAGS: 00010246
[ 90.034008] RAX: 0000000000000063 RBX: 00000000ffafc860 RCX: 0000000008aea440
[ 90.034008] RDX: 00000000f7515700 RSI: 00000000f771dfcc RDI: 0000000000000040
[ 90.034008] RBP: 00000000ffafc928 R08: 0000000000000000 R09: 0000000000000000
[ 90.034008] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 90.034008] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 90.034008] FS: 0000000000000000(0000) GS:ffff9d11ffd00000(0000)
knlGS:0000000000000000
[ 90.034008] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
[ 90.034008] CR2: ffffffffff576060 CR3: 000000012fd8d000 CR4: 00000000003406e0
[ 90.034008] RIP: 0xf76fa9f4 RSP: 00000000ffafc860
[ 90.034008] CR2: ffffffffff576060
[ 90.034008] ---[ end trace 3c9a8bbd0d11f377 ]---
[ 90.034008] BUG: sleeping function called from invalid context at
./include/linux/percpu-rwsem.h:33
[ 90.034008] in_atomic(): 0, irqs_disabled(): 1, pid: 475, name: a.out
[ 90.034008] INFO: lockdep is turned off.
[ 90.034008] irq event stamp: 2014
[ 90.034008] hardirqs last enabled at (2013): [<ffffffffb98dc39d>]
entry_INT80_compat+0x3d/0x50
[ 90.034008] hardirqs last disabled at (2014): [<ffffffffb98dc03c>]
error_entry+0x6c/0xd0
[ 90.034008] softirqs last enabled at (1666): [<ffffffffb98df7cd>]
__do_softirq+0x38d/0x4c3
[ 90.034008] softirqs last disabled at (1657): [<ffffffffb90947b7>]
irq_exit+0xf7/0x100
[ 90.034008] CPU: 1 PID: 475 Comm: a.out Tainted: G D
4.11.0-rc2-next-20170320 #159
[ 90.034008] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.9.3-1.fc25 04/01/2014
[ 90.034008] Call Trace:
[ 90.034008] dump_stack+0x86/0xc1
[ 90.034008] ___might_sleep+0x17d/0x250
[ 90.034008] __might_sleep+0x4a/0x80
[ 90.034008] exit_signals+0x33/0x250
[ 90.034008] ? blocking_notifier_call_chain+0x16/0x20
[ 90.034008] do_exit+0xbb/0xc60
[ 90.034008] ? trace_do_page_fault+0x58/0x2a0
[ 90.034008] rewind_stack_do_exit+0x17/0x20
[ 90.034008] RIP: 0023:0xf76fa9f4
[ 90.034008] RSP: 002b:00000000ffafc860 EFLAGS: 00010246
[ 90.034008] RAX: 0000000000000063 RBX: 00000000ffafc860 RCX: 0000000008aea440
[ 90.034008] RDX: 00000000f7515700 RSI: 00000000f771dfcc RDI: 0000000000000040
[ 90.034008] RBP: 00000000ffafc928 R08: 0000000000000000 R09: 0000000000000000
[ 90.034008] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 90.034008] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Thanks,
Andrei