ia64/xen-unstable
changeset 6026:d25da0ddd9d5
Fix iopl() syscall so that we pass LTP's iopl02 test.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Thu Aug 04 13:13:02 2005 +0000 (2005-08-04) |
parents | 0ee061e5b8a8 |
children | f3f483059250 43f424818d6e |
files | linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c Thu Aug 04 09:00:16 2005 +0000 1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c Thu Aug 04 13:13:02 2005 +0000 1.3 @@ -113,16 +113,12 @@ asmlinkage long sys_iopl(unsigned int ne 1.4 if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO)) 1.5 return -EPERM; 1.6 1.7 - /* Maintain OS privileges even if user attempts to relinquish them. */ 1.8 - if (new_io_pl == 0) 1.9 - new_io_pl = 1; 1.10 - 1.11 /* Change our version of the privilege levels. */ 1.12 current->thread.io_pl = new_io_pl; 1.13 1.14 /* Force the change at ring 0. */ 1.15 op.cmd = PHYSDEVOP_SET_IOPL; 1.16 - op.u.set_iopl.iopl = new_io_pl; 1.17 + op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl; 1.18 HYPERVISOR_physdev_op(&op); 1.19 1.20 return 0;
2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c Thu Aug 04 09:00:16 2005 +0000 2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c Thu Aug 04 13:13:02 2005 +0000 2.3 @@ -539,7 +539,7 @@ struct task_struct fastcall * __switch_t 2.4 2.5 if (unlikely(prev->io_pl != next->io_pl)) { 2.6 iopl_op.cmd = PHYSDEVOP_SET_IOPL; 2.7 - iopl_op.u.set_iopl.iopl = next->io_pl; 2.8 + iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl; 2.9 mcl->op = __HYPERVISOR_physdev_op; 2.10 mcl->args[0] = (unsigned long)&iopl_op; 2.11 mcl++;
3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Thu Aug 04 09:00:16 2005 +0000 3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Thu Aug 04 13:13:02 2005 +0000 3.3 @@ -1636,7 +1636,7 @@ void __init setup_arch(char **cmdline_p) 3.4 efi_map_memmap(); 3.5 3.6 op.cmd = PHYSDEVOP_SET_IOPL; 3.7 - op.u.set_iopl.iopl = current->thread.io_pl = 1; 3.8 + op.u.set_iopl.iopl = 1; 3.9 HYPERVISOR_physdev_op(&op); 3.10 3.11 #ifdef CONFIG_ACPI_BOOT
4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Thu Aug 04 09:00:16 2005 +0000 4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Thu Aug 04 13:13:02 2005 +0000 4.3 @@ -880,7 +880,8 @@ static int __init do_boot_cpu(int apicid 4.4 ctxt.user_regs.cs = __KERNEL_CS; 4.5 ctxt.user_regs.eip = start_eip; 4.6 ctxt.user_regs.esp = idle->thread.esp; 4.7 - ctxt.user_regs.eflags = (1<<9) | (1<<2) | (idle->thread.io_pl<<12); 4.8 +#define X86_EFLAGS_IOPL_RING1 0x1000 4.9 + ctxt.user_regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_IOPL_RING1; 4.10 4.11 /* FPU is set up to default initial state. */ 4.12 memset(&ctxt.fpu_ctxt, 0, sizeof(ctxt.fpu_ctxt));
5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c Thu Aug 04 09:00:16 2005 +0000 5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c Thu Aug 04 13:13:02 2005 +0000 5.3 @@ -30,7 +30,6 @@ asmlinkage long sys_iopl(unsigned int ne 5.4 unsigned int old_io_pl = current->thread.io_pl; 5.5 physdev_op_t op; 5.6 5.7 - 5.8 if (new_io_pl > 3) 5.9 return -EINVAL; 5.10 5.11 @@ -38,16 +37,12 @@ asmlinkage long sys_iopl(unsigned int ne 5.12 if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO)) 5.13 return -EPERM; 5.14 5.15 - /* Maintain OS privileges even if user attempts to relinquish them. */ 5.16 - if (new_io_pl == 0) 5.17 - new_io_pl = 1; 5.18 - 5.19 /* Change our version of the privilege levels. */ 5.20 current->thread.io_pl = new_io_pl; 5.21 5.22 /* Force the change at ring 0. */ 5.23 op.cmd = PHYSDEVOP_SET_IOPL; 5.24 - op.u.set_iopl.iopl = new_io_pl; 5.25 + op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl; 5.26 HYPERVISOR_physdev_op(&op); 5.27 5.28 return 0;
6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c Thu Aug 04 09:00:16 2005 +0000 6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c Thu Aug 04 13:13:02 2005 +0000 6.3 @@ -465,7 +465,7 @@ struct task_struct *__switch_to(struct t 6.4 6.5 if (unlikely(prev->io_pl != next->io_pl)) { 6.6 iopl_op.cmd = PHYSDEVOP_SET_IOPL; 6.7 - iopl_op.u.set_iopl.iopl = next->io_pl; 6.8 + iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl; 6.9 mcl->op = __HYPERVISOR_physdev_op; 6.10 mcl->args[0] = (unsigned long)&iopl_op; 6.11 mcl++;
7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Thu Aug 04 09:00:16 2005 +0000 7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Thu Aug 04 13:13:02 2005 +0000 7.3 @@ -824,7 +824,7 @@ void __init setup_arch(char **cmdline_p) 7.4 #endif 7.5 7.6 op.cmd = PHYSDEVOP_SET_IOPL; 7.7 - op.u.set_iopl.iopl = current->thread.io_pl = 1; 7.8 + op.u.set_iopl.iopl = 1; 7.9 HYPERVISOR_physdev_op(&op); 7.10 7.11 if (xen_start_info.flags & SIF_INITDOMAIN) {