Re: [PATCH v2] x86: Load __USER_DS into DS/ES after resume
From: Brian Gerst <hidden>
Date: 2015-06-14 14:22:32
On Sun, Jun 14, 2015 at 4:57 AM, Pavel Machek [off-list ref] wrote:
quoted hunk ↗ jump to hunk
On Sun 2015-06-14 09:49:22, Ingo Molnar wrote:quoted
* Linus Torvalds [off-list ref] wrote:quoted
On Jun 13, 2015 8:56 PM, "Ingo Molnar" [off-list ref] wrote:quoted
Ok, so something like the patch below, right? movw $__KERNEL_DS, %ax movw %ax, %ss - movw %ax, %ds - movw %ax, %es movw %ax, %fs movw %ax, %gs + movw $__KERNEL_DS, %ax + movw %ax, %ds + movw %ax, %es.. except with less cut-and-paste bugs. That second KERNEL should be USER.Yeah, doh :-/ Updated patch below.Do we want similar patch for 64-bit, too? Signed-off-by: Pavel Machek <redacted>diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index ae693b5..2ac2bc7 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S@@ -18,10 +18,12 @@ ENTRY(wakeup_long64) cmpq %rdx, %rax jne bogus_64_magic - movw $__KERNEL_DS, %ax - movw %ax, %ss + movw $__USER_DS, %ax movw %ax, %ds movw %ax, %es + + movw $__KERNEL_DS, %ax + movw %ax, %ss movw %ax, %fs movw %ax, %gs movq saved_rsp, %rsp
64-bit is a different animal. DS/ES are ignored in 64-bit mode, so they are always userspace-owned, and only matter for 32-bit user processes. 64-bit does currently save/restore these in x86/power/cpu.c. -- Brian Gerst