summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/spigot.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-04-14 15:54:39 +0000
committerbde <bde@FreeBSD.org>1997-04-14 15:54:39 +0000
commit1c0ab07a266f3b071ce84f79a038cb7ef340396b (patch)
tree13ae33e7ddec4a2869ffe451e056d82bcfa9375f /sys/i386/isa/spigot.c
parent93bc52bbfc3efe16fd656b69eca9a3d6ee133b39 (diff)
downloadFreeBSD-src-1c0ab07a266f3b071ce84f79a038cb7ef340396b.zip
FreeBSD-src-1c0ab07a266f3b071ce84f79a038cb7ef340396b.tar.gz
Use the same IOPL check as in syscons.
Reviewed by: pst, joerg
Diffstat (limited to 'sys/i386/isa/spigot.c')
-rw-r--r--sys/i386/isa/spigot.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index 2643166..c149895 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -149,6 +149,7 @@ spigot_attach(struct isa_device *devp)
static int
spigot_open(dev_t dev, int flags, int fmt, struct proc *p)
{
+int error;
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
if((ss->flags & ALIVE) == 0)
@@ -158,8 +159,16 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
return EBUSY;
#if !defined(SPIGOT_UNSECURE)
- /* Since we can't map the i/o page, don't allow open unless suser */
- if(suser(p->p_ucred, &p->p_acflag) != 0)
+ /*
+ * Don't allow open() unless the process has sufficient privileges,
+ * since mapping the i/o page and granting i/o privilege would
+ * require sufficient privilege soon and nothing much can be done
+ * without them.
+ */
+ error = suser(p->p_ucred, &p->p_acflag);
+ if (error != 0)
+ return error;
+ if (securelevel > 0)
return EPERM;
#endif
@@ -216,6 +225,8 @@ struct spigot_info *info;
error = suser(p->p_ucred, &p->p_acflag);
if (error != 0)
return error;
+ if (securelevel > 0)
+ return EPERM;
#endif
fp=(struct trapframe *)p->p_md.md_regs;
fp->tf_eflags |= PSL_IOPL;
OpenPOWER on IntegriCloud