Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1171037
| Path | csiph.com!aioe.org!news.e-liance.net!news.e-liance.net!feeds.phibee-telecom.net!news.panservice.it!news.spin.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Andy Lutomirski <luto@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 08/15] x86/entry/64: Really create an error-entry-from-usermode code path |
| Date | Wed, 24 Jun 2015 04:50:02 +0200 |
| Message-ID | <pEIVc-554-21@gated-at.bofh.it> (permalink) |
| References | <pEIVb-554-3@gated-at.bofh.it> |
| X-Original-To | x86@kernel.org, linux-kernel@vger.kernel.org |
| X-Mailer | git-send-email 2.4.3 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 60 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Frédéric Weisbecker <fweisbec@gmail.com>, Rik van Riel <riel@redhat.com>, Oleg Nesterov <oleg@redhat.com>, Denys Vlasenko <vda.linux@googlemail.com>, Borislav Petkov <bp@alien8.de>, Kees Cook <keescook@chromium.org>, Brian Gerst <brgerst@gmail.com>, paulmck@linux.vnet.ibm.com, Andy Lutomirski <luto@kernel.org> |
| X-Original-Date | Tue, 23 Jun 2015 19:46:11 -0700 |
| X-Original-Message-ID | <e2821d1d45f560f3b963154712668339596c9853.1435113808.git.luto@kernel.org> |
| X-Original-References | <cover.1435113808.git.luto@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1171037 |
Show key headers only | View raw
In 539f51136500 ("x86/asm/entry/64: Disentangle error_entry/exit
gsbase/ebx/usermode code"), I arranged the code slightly wrong --
IRET faults would skip the code path that was intended to execute on
all error entries from user mode. Fix it up.
This does not fix a bug, but we'll need it, and it slightly shrinks
the code.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/entry/entry_64.S | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3bb2c4302df1..b47f9686dece 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1145,9 +1145,14 @@ ENTRY(error_entry)
testb $3, CS+8(%rsp)
jz error_kernelspace
- /* We entered from user mode */
+error_entry_from_usermode_swapgs:
+ /*
+ * We entered from user mode or we're pretending to have entered
+ * from user mode due to an IRET fault.
+ */
SWAPGS
+error_entry_from_usermode_after_swapgs:
error_entry_done:
TRACE_IRQS_OFF
ret
@@ -1174,8 +1179,7 @@ error_kernelspace:
* gsbase and proceed. We'll fix up the exception and land in
* gs_change's error handler with kernel gsbase.
*/
- SWAPGS
- jmp error_entry_done
+ jmp error_entry_from_usermode_swapgs
bstep_iret:
/* Fix truncated RIP */
@@ -1198,7 +1202,7 @@ error_bad_iret:
call fixup_bad_iret
mov %rax, %rsp
decl %ebx
- jmp error_entry_done
+ jmp error_entry_from_usermode_after_swapgs
END(error_entry)
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v3 08/15] x86/entry/64: Really create an error-entry-from-usermode code path Andy Lutomirski <luto@kernel.org> - 2015-06-24 04:50 +0200
csiph-web