Re: [patch V181 00/54] x86/pti: Final XMAS release

From: Kirill A. Shutemov
Date: Thu Dec 21 2017 - 11:26:39 EST


On Thu, Dec 21, 2017 at 03:57:02PM +0300, Kirill A. Shutemov wrote:
> On Wed, Dec 20, 2017 at 10:35:03PM +0100, Thomas Gleixner wrote:
> > The series is also available from git:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/pti
>
> The patchset looks sane in 5-level paging configuration as long as commit
> c739f930be1d ("x86/espfix/64: Fix espfix double-fault handling on 5-level
> systems") from tip/x86/urgent is applied.
>
> Tested-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

Failed to boot with EFI. I don't think it's limited to 5-level paging.

The fix is below.

BUG: unable to handle kernel paging request at ff1000017d803000
IP: __pti_set_user_pgd+0x22/0x44
PGD 4be4067 P4D 4be5067 PUD 27f905067 PMD 27f718067 PTE 800000017d803060
Oops: 0002 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-00174-g9b1270951308 #6613
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
task: ffffffff822114c0 task.stack: ffffffff82200000
RIP: 0010:__pti_set_user_pgd+0x22/0x44
RSP: 0000:ffffffff82203c70 EFLAGS: 00000202
RAX: 000000007c490063 RBX: ffffffff82203e28 RCX: 0000000000000002
RDX: 0000000000000001 RSI: 000000007c490063 RDI: ff1000017d803000
RBP: 000000007ff58000 R08: 0000000000000000 R09: 0000000000000067
R10: ffffffff82203a78 R11: 0000000000000001 R12: ff1000017d802000
R13: 0000000000000000 R14: 000000007ff58000 R15: ffffffff82203e28
FS: 0000000000000000(0000) GS:ff1000007f000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ff1000017d803000 CR3: 000000000440a000 CR4: 00000000000016b0
Call Trace:
__cpa_process_fault+0x3f6/0x5d0
? get_page_from_freelist+0x34f/0xbd0
__change_page_attr_set_clr+0x820/0xd70
? __alloc_pages_nodemask+0x124/0xfd0
? __alloc_pages_nodemask+0x124/0xfd0
? printk+0x3e/0x46
? kernel_map_pages_in_pgd+0x91/0x180
kernel_map_pages_in_pgd+0x91/0x180
? __map_region+0x37/0x53
__map_region+0x37/0x53
efi_map_region+0x27/0xb3
efi_enter_virtual_mode+0x26f/0x490
start_kernel+0x368/0x3df
secondary_startup_64+0xab/0xb0
Code: 90 90 90 90 90 90 90 90 90 48 89 fa 48 89 f0 81 e2 ff 0f 00 00 48 81 fa ff 07 00 00 77 16 48 89 f2 48 81 cf 00 10 00 00 83 e2 05 <48> 89 37 48 83 fa 05 74 01 c3 48 83 3d 6c 7c 29 01 00 79 f5 48
RIP: __pti_set_user_pgd+0x22/0x44 RSP: ffffffff82203c70
CR2: ff1000017d803000

-----------8<-----------