Commit 9718769d authored by Chris Wright's avatar Chris Wright Committed by Ingo Molnar

x86: fix ioport unification on 32-bit

ioport unification was broken for 32-bit; it was missing
the acutal pushf/popf EFLAGS manipulation (set_iopl_mask()).
Also, use of volatile looks like leftover cruft.

Cc: mboton@gmail.com
Cc: Kevin Winchester <kjwinchester@gmail.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent ccafa59a
...@@ -116,9 +116,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -116,9 +116,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
asmlinkage long sys_iopl(unsigned long regsp) asmlinkage long sys_iopl(unsigned long regsp)
{ {
volatile struct pt_regs *regs = (struct pt_regs *)&regsp; struct pt_regs *regs = (struct pt_regs *)&regsp;
unsigned int level = regs->bx; unsigned int level = regs->bx;
unsigned int old = (regs->flags >> 12) & 3; unsigned int old = (regs->flags >> 12) & 3;
struct thread_struct *t = &current->thread;
if (level > 3) if (level > 3)
return -EINVAL; return -EINVAL;
...@@ -127,8 +128,9 @@ asmlinkage long sys_iopl(unsigned long regsp) ...@@ -127,8 +128,9 @@ asmlinkage long sys_iopl(unsigned long regsp)
if (!capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
return -EPERM; return -EPERM;
} }
t->iopl = level << 12;
regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12); regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
set_iopl_mask(t->iopl);
return 0; return 0;
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment