Re: Shared Memory

Felix Schroeter (
Mon, 12 May 1997 19:34:26 +0200 (CEST)


In article <5l664n$> you write:

>> > Does anyone know of a systtem call that is available so that given a
>> > process ID and a physical range of pages, one process could map that
>> > physical memory into the address space of the process that corresponds to
>> > the given PID?

>> If you use the mmap() call on /dev/mem you can do this, it's a well
>> known hack for accessing hardware from user-space.

> The only catch with this is that it does not allow me to map into
>ANOTHER process' address space, only my own. The problem I am trying to
>address is that I have one process running as root and another process
>that is not. The non-root process communicates with the root process and
>asks it for locked-in pages. The root process will then map the locked
>pages it has in its address space into the client's address space and
>return a pointer to this area back to the client. As far as I know mmap
>only operates on one's own address space. If I could somehow modify it
>so it worked on another process' address space, that would rock.

Modifying other processes' address space seems very dirty for me.

What you can do (but you must trust the user mode process) is to
build a UNIX domain socket connection, the have the user process
authenticate itself in some way, then pass an open file descriptor
to /dev/mem to the process.

Maybe, ioperm/iopl() could be interesting for you, too.

(if your problem also relates to IO ports)

Regards, Felix.