RE: [PATCH v2 2/2] powerpc/hibernate: PPC64 fix user threads access to kernel space
From: Wang Dongsheng-B40534 <hidden>
Date: 2013-06-09 11:31:08
Sorry, Please ignore this patch. This is replaced. Replace by: http://patchwork.ozlabs.org/patch/250033/ - dongsheng
quoted hunk ↗ jump to hunk
-----Original Message----- From: Wang Dongsheng-B40534 Sent: Sunday, June 09, 2013 1:23 PM To: benh@kernel.crashing.org; johannes@sipsolutions.net; anton@enomsg.org Cc: Wood Scott-B07421; galak@kernel.crashing.org; linuxppc- dev@lists.ozlabs.org; Wang Dongsheng-B40534 Subject: [PATCH v2 2/2] powerpc/hibernate: PPC64 fix user threads access to kernel space =20 If PID is used in the TLB, after hibernation resume, the user threads will access to kernel space. =20 We must restore PID register, because TLB will use PID. The hibernation suspend flow is trapped from user space to kernel space, the PID register is user thread pid. =20 The hibernation resume is begin in kernel start flow, the PID alway 0. After the kernel thread back to user thread, there is not have context switch and the pid can not update, because the kernel thread is trapped form user space. So if we did't restore PID the user space of thread will be addressing in the kernel space. =20 There are two ways to restore PID: 1/ In swsusp_arch_suspend/swsusp_arch_resume, save/resotre PID register. 2/ Form restore_processor_state to restore. this function will do context switch. switch_mmu_context(current->active_mm, current->active_mm) =20 PPC32 Using the second method. For consistency reason, PPC64 using the same way. =20 Signed-off-by: Wang Dongsheng <redacted> --- arch/powerpc/kernel/swsusp.c | 2 -- 1 file changed, 2 deletions(-) =20diff --git a/arch/powerpc/kernel/swsusp.c b/arch/powerpc/kernel/swsusp.c index eae33e1..1930e44 100644 --- a/arch/powerpc/kernel/swsusp.c +++ b/arch/powerpc/kernel/swsusp.c@@ -32,7 +32,5 @@ void save_processor_state(void)=20 void restore_processor_state(void) { -#ifdef CONFIG_PPC32 switch_mmu_context(current->active_mm, current->active_mm); -#endif } -- 1.8.0