Skip to content

Commit b8f7095

Browse files
mokomullKAGA-KOKO
authored andcommitted
x86/entry/32: Pass cr2 to do_async_page_fault()
Commit a0d14b8 ("x86/mm, tracing: Fix CR2 corruption") added the address parameter to do_async_page_fault(), but does not pass it from the 32-bit entry point. To plumb it through, factor-out common_exception_read_cr2 in the same fashion as common_exception, and uses it from both page_fault and async_page_fault. For a 32-bit KVM guest, this fixes: Run /sbin/init as init process Starting init: /sbin/init exists but couldn't execute it (error -14) Fixes: a0d14b8 ("x86/mm, tracing: Fix CR2 corruption") Signed-off-by: Matt Mullins <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 3850657 commit b8f7095

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

arch/x86/entry/entry_32.S

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,15 +1443,20 @@ BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR,
14431443

14441444
ENTRY(page_fault)
14451445
ASM_CLAC
1446-
pushl $0; /* %gs's slot on the stack */
1446+
pushl $do_page_fault
1447+
jmp common_exception_read_cr2
1448+
END(page_fault)
14471449

1450+
common_exception_read_cr2:
1451+
/* the function address is in %gs's slot on the stack */
14481452
SAVE_ALL switch_stacks=1 skip_gs=1
14491453

14501454
ENCODE_FRAME_POINTER
14511455
UNWIND_ESPFIX_STACK
14521456

14531457
/* fixup %gs */
14541458
GS_TO_REG %ecx
1459+
movl PT_GS(%esp), %edi
14551460
REG_TO_PTGS %ecx
14561461
SET_KERNEL_GS %ecx
14571462

@@ -1463,9 +1468,9 @@ ENTRY(page_fault)
14631468

14641469
TRACE_IRQS_OFF
14651470
movl %esp, %eax # pt_regs pointer
1466-
call do_page_fault
1471+
CALL_NOSPEC %edi
14671472
jmp ret_from_exception
1468-
END(page_fault)
1473+
END(common_exception_read_cr2)
14691474

14701475
common_exception:
14711476
/* the function address is in %gs's slot on the stack */
@@ -1595,7 +1600,7 @@ END(general_protection)
15951600
ENTRY(async_page_fault)
15961601
ASM_CLAC
15971602
pushl $do_async_page_fault
1598-
jmp common_exception
1603+
jmp common_exception_read_cr2
15991604
END(async_page_fault)
16001605
#endif
16011606

0 commit comments

Comments
 (0)