mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@sw.ru>
To: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH]: 4/4GB:
Date: Thu, 11 Nov 2004 19:20:51 +0300	[thread overview]
Message-ID: <41939163.5020305@sw.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

This patch fixes exception handling in RESTORE_ALL macro on returing
to user space. Incorrect values in %ds/%es can lead to incorrect 
behaivour and iret to kernel space address. This patch moves
exception handler from .fixup section to .entry.text and makes it
to be between int80_ret_start_marker/int80_ret_end_marker markers.

Signed-Off-By: Kirill Korotaev <dev@sw.ru>

Kirill

P.S. These 4GB split patches are against modified 2.6.8.1 kernel, but 
should be appliable to last Fedora kernels

[-- Attachment #2: diff-arch-4gb-restore --]
[-- Type: text/plain, Size: 1032 bytes --]

--- ./arch/i386/kernel/entry.S.4gbrest	2004-11-10 11:21:32.000000000 +0300
+++ ./arch/i386/kernel/entry.S	2004-11-10 12:35:24.239613040 +0300
@@ -167,7 +167,7 @@ int80_ret_start_marker:					\
 	movl %edx, %esp; 				\
 	movl %ecx, %cr3;				\
 							\
-	__RESTORE_ALL;					\
+	__RESTORE_ALL_USER;				\
 int80_ret_end_marker:					\
 2:
 
@@ -204,14 +204,19 @@ int80_ret_end_marker:					\
 
 #define __RESTORE_REGS	\
 	__RESTORE_INT_REGS; \
+	popl %ds;	\
+	popl %es;
+
+#define __RESTORE_REGS_USER \
+	__RESTORE_INT_REGS; \
 111:	popl %ds;	\
 222:	popl %es;	\
-.section .fixup,"ax";	\
+	jmp 666f;	\
 444:	movl $0,(%esp);	\
 	jmp 111b;	\
 555:	movl $0,(%esp);	\
 	jmp 222b;	\
-.previous;		\
+666:			\
 .section __ex_table,"a";\
 	.align 4;	\
 	.long 111b,444b;\
@@ -220,6 +225,13 @@ int80_ret_end_marker:					\
 
 #define __RESTORE_ALL	\
 	__RESTORE_REGS	\
+	__RESTORE_IRET
+
+#define __RESTORE_ALL_USER \
+	__RESTORE_REGS_USER \
+	__RESTORE_IRET
+
+#define __RESTORE_IRET	\
 	addl $4, %esp;	\
 333:	iret;		\
 .section .fixup,"ax";   \

             reply	other threads:[~2004-11-11 16:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-11 16:20 Kirill Korotaev [this message]
2004-11-12 20:22 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41939163.5020305@sw.ru \
    --to=dev@sw.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome