summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-06-28 03:16:32 +0000
committerimp <imp@FreeBSD.org>2004-06-28 03:16:32 +0000
commitc83f7f6bdcdacf5908121e3c3e902febfcdffca7 (patch)
tree9a1b95130c8ab26b23e50c5dc1825859aee74d05 /sys/i386
parent16d11e08eb148af997d3bc1d5799a947aa9a71fb (diff)
downloadFreeBSD-src-c83f7f6bdcdacf5908121e3c3e902febfcdffca7.zip
FreeBSD-src-c83f7f6bdcdacf5908121e3c3e902febfcdffca7.tar.gz
When opening /dev/io, preserve iopl properly. Otherwise, if you open
/dev/io multiple times, the first close remove the privs.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/mem.c2
-rw-r--r--sys/i386/include/proc.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 379b59c..c129feb 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/mem.c
@@ -98,6 +98,7 @@ mmclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
switch (minor(dev)) {
case 14:
+ td->td_proc->p_md.md_iopl = 0;
td->td_frame->tf_eflags &= ~PSL_IOPL;
}
return (0);
@@ -125,6 +126,7 @@ mmopen(struct cdev *dev, int flags, int fmt, struct thread *td)
if (error != 0)
return (error);
td->td_frame->tf_eflags |= PSL_IOPL;
+ td->td_proc->p_md.md_iopl = PSL_IOPL;
break;
}
return (0);
diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h
index 5b2c286..810a8e5 100644
--- a/sys/i386/include/proc.h
+++ b/sys/i386/include/proc.h
@@ -52,6 +52,7 @@ struct mdthread {
struct mdproc {
struct proc_ldt *md_ldt; /* (j) per-process ldt */
+ uint32_t md_iopl; /* process' iopl level */
};
#ifdef _KERNEL
OpenPOWER on IntegriCloud