Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 2010 11:57:12 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Garrett Cooper <gcooper@FreeBSD.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: fix pnpinfo on arch=amd64
Message-ID:  <20101024115712.GA61342@freebsd.org>
In-Reply-To: <AANLkTinzn1r3qn3d7MoVhZPNOo6OHDfF-0KVrLN%2BC516@mail.gmail.com>
References:  <20101024002248.GA73346@freebsd.org> <AANLkTinzn1r3qn3d7MoVhZPNOo6OHDfF-0KVrLN%2BC516@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat Oct 23 10, Garrett Cooper wrote:
> On Sat, Oct 23, 2010 at 5:22 PM, Alexander Best <arundel@freebsd.org> wrote:
> > this tiny patch will fix pnpinfo so it doesn't core dump (bus error) any
> > longer on arch=amd64.
> 
> 1. I had to modify the Makefile to get it to work.

probably because you built pnpinfo from contrib/pnpinfo and not from
usr.sbin/pnpinfo. i'm not sure your changes to contrib/pnpinfo/Makefile are
according to current practice. maybe the vendor Makefile shouldn't be modified
and every additional stuff should rather go into usr.sbin/pnpinfo/Makefile. but
i don't really know.

also in the in usr.sbin/pnpinfo/makefile there's a check for PC98 that i'm not
sure is really needed.

> 2. FWIW, I don't there's really much point in adding a check for only
> x86 architectures, if the tool is capable of more than that.

yeah you're probably right. to be honest i know nothing about
"archs != i386|amd64". ;) so i just added the amd64 option, because i didn't
want to break pnpinfo on other platforms.

> 3. Might as well close the file descriptor after opening it.

right. expecially, because opening /dev/io (even in ro mode) is a huge security
issue. so better close it asap.

of course on i386/amd64 (maybe pc98 too?) i386_set_ioperm(2) could be used to
work around the security issue. but since pnpinfo's job is to access hardware
directly i think opening /dev/io directly can be consideren ok.

> 
> SIGBUS occurs because it doesn't have permission to write via outb.
> It's a shame that there isn't a more proper way to catch this SIGBUS
> fault minus adding a SIGBUS handler (but that might have other
> undesired side effects).

well on i386/amd (pc98?) you could use i386_get_ioperm(2) to check for proper
io permissions.

> Thanks,
> -Garrett



-- 
a13x



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101024115712.GA61342>