[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug#46709: Mach lets processes write to I/O ports
From: |
Marcus Brinkmann |
Subject: |
Bug#46709: Mach lets processes write to I/O ports |
Date: |
Sun, 7 Oct 2001 19:11:01 +0200 |
User-agent: |
Mutt/1.3.22i |
On Sun, Oct 07, 2001 at 03:20:11PM +0200, Marcus Brinkmann wrote:
> On Sun, Oct 07, 2001 at 05:19:28AM +0200, Marcus Brinkmann wrote:
> > The reason I could not continue testing the user tss is that
> > the i386_io_port_add call can't find the device -> io_port mapping.
>
> It turns out that the mach_device_t address registered with io_port_create
> doesn't match the mach_device_t address used to lookup the device again.
> I don't know why (yet).
The i386_io_port_add and i386_io_port_remove do not convert the device_t to
a mach_device_t as the other device RPCs for i386 (this is connected to the
glue code in i386/i386at/i386at_ds_routines.c, which is introduces another
level of indirection for device RPCs, without changing the io_port rpcs as
well).
I have fixed this, and i386_io_port_add finds the i/o port list now.
However, the I/O permission are not correctly updated, I still get an
Illegal Instruction exception. So I am continuing to debug this.
The below patch is to only fix this particular problem. It's as ugly as the
rest of the glue code :)
Thanks,
Marcus
--- /mnt/marcus/gnu/cvs/gnumach/i386/i386/iopb.c Tue Feb 25 22:27:09 1997
+++ i386/i386/iopb.c Sun Oct 7 18:20:34 2001
@@ -307,11 +317,21 @@
/*
* Add an IO mapping to a thread.
*/
+#ifdef i386
+kern_return_t
+i386_io_port_add(
+ thread_t thread,
+ device_t d)
+#else
kern_return_t
i386_io_port_add(
thread_t thread,
mach_device_t device)
+#endif
{
+#ifdef i386
+ mach_device_t device = d->emul_data;
+#endif
pcb_t pcb;
iopb_tss_t io_tss, new_io_tss;
io_port_t io_port;
@@ -406,11 +429,21 @@
/*
* Remove an IO mapping from a thread.
*/
+#ifdef i386
+kern_return_t
+i386_io_port_remove(thread, d)
+ thread_t thread;
+ device_t d;
+#else
kern_return_t
i386_io_port_remove(thread, device)
thread_t thread;
mach_device_t device;
+#endif
{
+#ifdef i386
+ mach_device_t device = d->emul_data;
+#endif
pcb_t pcb;
iopb_tss_t io_tss;
io_port_t io_port;
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de