[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix iopl() syscall so that we pass LTP's iopl02 test.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID d25da0ddd9d51cfd4f4f487a46706290546563f6 # Parent 0ee061e5b8a89295b5b4dd5471e50e6fafc8db80 Fix iopl() syscall so that we pass LTP's iopl02 test. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c Thu Aug 4 13:13:02 2005 @@ -113,16 +113,12 @@ if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO)) return -EPERM; - /* Maintain OS privileges even if user attempts to relinquish them. */ - if (new_io_pl == 0) - new_io_pl = 1; - /* Change our version of the privilege levels. */ current->thread.io_pl = new_io_pl; /* Force the change at ring 0. */ op.cmd = PHYSDEVOP_SET_IOPL; - op.u.set_iopl.iopl = new_io_pl; + op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl; HYPERVISOR_physdev_op(&op); return 0; diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c Thu Aug 4 13:13:02 2005 @@ -539,7 +539,7 @@ if (unlikely(prev->io_pl != next->io_pl)) { iopl_op.cmd = PHYSDEVOP_SET_IOPL; - iopl_op.u.set_iopl.iopl = next->io_pl; + iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl; mcl->op = __HYPERVISOR_physdev_op; mcl->args[0] = (unsigned long)&iopl_op; mcl++; diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Thu Aug 4 13:13:02 2005 @@ -1636,7 +1636,7 @@ efi_map_memmap(); op.cmd = PHYSDEVOP_SET_IOPL; - op.u.set_iopl.iopl = current->thread.io_pl = 1; + op.u.set_iopl.iopl = 1; HYPERVISOR_physdev_op(&op); #ifdef CONFIG_ACPI_BOOT diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Thu Aug 4 13:13:02 2005 @@ -880,7 +880,8 @@ ctxt.user_regs.cs = __KERNEL_CS; ctxt.user_regs.eip = start_eip; ctxt.user_regs.esp = idle->thread.esp; - ctxt.user_regs.eflags = (1<<9) | (1<<2) | (idle->thread.io_pl<<12); +#define X86_EFLAGS_IOPL_RING1 0x1000 + ctxt.user_regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_IOPL_RING1; /* FPU is set up to default initial state. */ memset(&ctxt.fpu_ctxt, 0, sizeof(ctxt.fpu_ctxt)); diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c Thu Aug 4 13:13:02 2005 @@ -30,7 +30,6 @@ unsigned int old_io_pl = current->thread.io_pl; physdev_op_t op; - if (new_io_pl > 3) return -EINVAL; @@ -38,16 +37,12 @@ if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO)) return -EPERM; - /* Maintain OS privileges even if user attempts to relinquish them. */ - if (new_io_pl == 0) - new_io_pl = 1; - /* Change our version of the privilege levels. */ current->thread.io_pl = new_io_pl; /* Force the change at ring 0. */ op.cmd = PHYSDEVOP_SET_IOPL; - op.u.set_iopl.iopl = new_io_pl; + op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl; HYPERVISOR_physdev_op(&op); return 0; diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c Thu Aug 4 13:13:02 2005 @@ -465,7 +465,7 @@ if (unlikely(prev->io_pl != next->io_pl)) { iopl_op.cmd = PHYSDEVOP_SET_IOPL; - iopl_op.u.set_iopl.iopl = next->io_pl; + iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl; mcl->op = __HYPERVISOR_physdev_op; mcl->args[0] = (unsigned long)&iopl_op; mcl++; diff -r 0ee061e5b8a8 -r d25da0ddd9d5 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Thu Aug 4 09:00:16 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Thu Aug 4 13:13:02 2005 @@ -824,7 +824,7 @@ #endif op.cmd = PHYSDEVOP_SET_IOPL; - op.u.set_iopl.iopl = current->thread.io_pl = 1; + op.u.set_iopl.iopl = 1; HYPERVISOR_physdev_op(&op); if (xen_start_info.flags & SIF_INITDOMAIN) { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |