Date: Tue, 07 Jul 1998 10:00:04 -0700 From: Mike Smith <mike@smith.net.au> To: Terry Lambert <tlambert@primenet.com> Cc: jkh@time.cdrom.com (Jordan K. Hubbard), joelh@gnu.org, smoergrd@oslo.geco-prakla.slb.com, tarkhil@asteroid.svib.ru, current@FreeBSD.ORG Subject: Re: xf86OpenConsole: KDENABIO failed (Operation not permitted) Message-ID: <199807071700.KAA00644@dingo.cdrom.com> In-Reply-To: Your message of "Tue, 07 Jul 1998 07:18:05 -0000." <199807070718.AAA04728@usr06.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > Truly, standing up on a soapbox and calling it a bug is Not Useful and
> > has already been done before by a succession of previous soapbox
> > orators (check out the OpenBSD mailing lists sometime for a whole
> > book's worth of material on the topic). Suggesting some real,
> > tangible approach to dealing with it would be a welcome switch from
> > the usual.
>
> I'm pretty sure patches to add Linux-like control to the I/O address
> space rather than using the /dev/io hack have gone by several times;
They actually exist in -current, although Bruce is not fond of the
implementation. He says:
... FreeBSD ioperm is not
completely implemented. It is only available if the kernel was configured
with `options "VM86"'. It is a subcall of sysarch(undocumented). You
have to pass it a pointer to a poorly laid out struct giving the args,
something like this:
Linux: int ioperm(u_long from, u_long num, int turn_on);
FreeBSD: struct i386_ioperm_args { u_short from, num; u_char turn_on; } foo;
sysarch(I386_SET_IOPERM, /* XXX 1970's interface */ (char *)&foo);
Here are some fixes for the bugs. They are untested.
diff -c2 sys_machdep.c~ sys_machdep.c
*** sys_machdep.c~ Fri Nov 28 14:37:35 1997
--- sys_machdep.c Fri Nov 28 17:28:16 1997
***************
*** 181,185 ****
char *args;
{
! int i, error = 0;
struct i386_ioperm_args ua;
char *iomap;
--- 181,185 ----
char *args;
{
! int i, error;
struct i386_ioperm_args ua;
char *iomap;
***************
*** 188,194 ****
return (error);
- /* Only root can do this */
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
/*
* XXX
--- 188,195 ----
return (error);
if (error = suser(p->p_ucred, &p->p_acflag))
return (error);
+ if (securelevel > 0)
+ return (EPERM);
/*
* XXX
***************
*** 203,207 ****
iomap = (char *)p->p_addr->u_pcb.pcb_ext->ext_iomap;
! if ((int)(ua.start + ua.length) > 0xffff)
return (EINVAL);
--- 204,208 ----
iomap = (char *)p->p_addr->u_pcb.pcb_ext->ext_iomap;
! if (ua.start + ua.length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);
***************
*** 220,224 ****
char *args;
{
! int i, state, error = 0;
struct i386_ioperm_args ua;
char *iomap;
--- 221,225 ----
char *args;
{
! int i, state, error;
struct i386_ioperm_args ua;
char *iomap;
***************
*** 226,229 ****
--- 227,232 ----
if (error = copyin(args, &ua, sizeof(struct i386_ioperm_args)))
return (error);
+ if (ua.start >= IOPAGES * PAGE_SIZE * NBBY)
+ return (EINVAL);
if (p->p_addr->u_pcb.pcb_ext == 0) {
***************
*** 234,237 ****
--- 237,242 ----
iomap = (char *)p->p_addr->u_pcb.pcb_ext->ext_iomap;
+ i = ua.start;
+ state = (iomap[i >> 3] >> (i & 7)) & 1;
ua.enable = !state;
ua.length = 1;
Bruce
--
\\ Sometimes you're ahead, \\ Mike Smith
\\ sometimes you're behind. \\ mike@smith.net.au
\\ The race is long, and in the \\ msmith@freebsd.org
\\ end it's only with yourself. \\ msmith@cdrom.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807071700.KAA00644>
