diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-04-21 14:43:36 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-04-21 14:43:36 +0800 |
commit | 9beee7af111a7afa5f7b787daaf8a6891c05f216 (patch) | |
tree | 92fdbea807b9ef2917d1f087355f08617230dd75 /arch/x86/kernel/ioport.c | |
parent | e8490c42825967752fef08dddf37eb3f5f34d753 (diff) | |
parent | fd9302c16fc244139c1ddfdffc145d5b772ed9ce (diff) |
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-androidlsk-v4.1-16.04-android
Conflicts:
keep -fno-pic flag in arch/arm64/Makefile
Diffstat (limited to 'arch/x86/kernel/ioport.c')
-rw-r--r-- | arch/x86/kernel/ioport.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c index 37dae792dbbe..589b3193f102 100644 --- a/arch/x86/kernel/ioport.c +++ b/arch/x86/kernel/ioport.c @@ -96,9 +96,14 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) SYSCALL_DEFINE1(iopl, unsigned int, level) { struct pt_regs *regs = current_pt_regs(); - unsigned int old = (regs->flags >> 12) & 3; struct thread_struct *t = ¤t->thread; + /* + * Careful: the IOPL bits in regs->flags are undefined under Xen PV + * and changing them has no effect. + */ + unsigned int old = t->iopl >> X86_EFLAGS_IOPL_BIT; + if (level > 3) return -EINVAL; /* Trying to gain more privileges? */ @@ -106,8 +111,9 @@ SYSCALL_DEFINE1(iopl, unsigned int, level) if (!capable(CAP_SYS_RAWIO)) return -EPERM; } - regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12); - t->iopl = level << 12; + regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | + (level << X86_EFLAGS_IOPL_BIT); + t->iopl = level << X86_EFLAGS_IOPL_BIT; set_iopl_mask(t->iopl); return 0; |