From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@redhat.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [GIT PULL] x86: unify sys_iopl
Date: Fri, 25 Sep 2009 15:05:54 -0700 [thread overview]
Message-ID: <4ABD3EC2.1020104@goop.org> (raw)
Hi Ingo,
The x86-64 implementation of iopl was buggy because it never ended up calling
set_iopl_mask(). This had no effect on native sys_iopl (because set_iopl_mask
is normally no-op on 64-bit), but it ended up never calling the pvop, which caused
iopl to have no effect on 64-bit Xen guests.
The two functions are needlessly different anyway. This patch just unifies them
into a single function which is mostly derived from the 32-bit version.
Thanks,
J
The following changes since commit c44c9ec0f38b939b3200436e3aa95c1aa83c41c7:
Jeremy Fitzhardinge (1):
x86: split NX setup into separate file to limit unstack-protected code
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git bugfix
Jeremy Fitzhardinge (1):
x86: unify sys_iopl
arch/x86/include/asm/syscalls.h | 8 +++-----
arch/x86/kernel/ioport.c | 11 ++---------
2 files changed, 5 insertions(+), 14 deletions(-)
>From 8dbb1d168eb8be6bf43d123fdfb3ba3b03762e62 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Date: Wed, 23 Sep 2009 16:35:24 -0700
Subject: [PATCH] x86: unify sys_iopl
The 32 and 64-bit versions of sys_iopl were needlessly different:
- The 32-bit version ignored its function argument and directly
fetched the parameter from struct regs, presumably code dating
from the neolithic era.
- The 64-bit version never called set_iopl_mask(). Usually this
is a no-op for 64-bit, but it is also a pvop, which meant that
that iopl never worked for 64-bit guests under Xen.
- Both versions use the archaic style of getting pt_regs passed
to them. We can get the current pt_regs with task_pt_regs, which
avoids worrying about the fine details of stack layout.
We can use the body of the 32-bit function with a few small
adjustments to the function definition.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 372b76e..5336ce2 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -33,11 +33,11 @@ long sys_rt_sigreturn(struct pt_regs *);
asmlinkage int sys_set_thread_area(struct user_desc __user *);
asmlinkage int sys_get_thread_area(struct user_desc __user *);
-/* X86_32 only */
-#ifdef CONFIG_X86_32
/* kernel/ioport.c */
-long sys_iopl(struct pt_regs *);
+asmlinkage long sys_iopl(unsigned int);
+/* X86_32 only */
+#ifdef CONFIG_X86_32
/* kernel/process_32.c */
int sys_clone(struct pt_regs *);
int sys_execve(struct pt_regs *);
@@ -70,8 +70,6 @@ int sys_vm86(struct pt_regs *);
#else /* CONFIG_X86_32 */
/* X86_64 only */
-/* kernel/ioport.c */
-asmlinkage long sys_iopl(unsigned int, struct pt_regs *);
/* kernel/process_64.c */
asmlinkage long sys_clone(unsigned long, unsigned long,
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 99c4d30..bad4f22 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -119,11 +119,10 @@ static int do_iopl(unsigned int level, struct pt_regs *regs)
return 0;
}
-#ifdef CONFIG_X86_32
-long sys_iopl(struct pt_regs *regs)
+asmlinkage long sys_iopl(unsigned int level)
{
- unsigned int level = regs->bx;
struct thread_struct *t = ¤t->thread;
+ struct pt_regs *regs = task_pt_regs(current);
int rc;
rc = do_iopl(level, regs);
@@ -135,9 +134,3 @@ long sys_iopl(struct pt_regs *regs)
out:
return rc;
}
-#else
-asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
-{
- return do_iopl(level, regs);
-}
-#endif
next reply other threads:[~2009-09-25 22:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-25 22:05 Jeremy Fitzhardinge [this message]
2009-09-25 22:56 ` [GIT PULL] x86: unify sys_iopl Brian Gerst
2009-09-25 23:22 ` Jeremy Fitzhardinge
2009-09-25 23:54 ` Brian Gerst
2009-09-26 0:22 ` Jeremy Fitzhardinge
2009-10-13 10:30 ` Ingo Molnar
2009-10-13 16:24 ` H. Peter Anvin
2009-10-13 16:53 ` Jeremy Fitzhardinge
2009-10-13 17:13 ` H. Peter Anvin
2009-10-13 17:55 ` H. Peter Anvin
2009-10-13 21:27 ` H. Peter Anvin
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=4ABD3EC2.1020104@goop.org \
--to=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.