Main Page | Report this Page
 
   
Linux Forum Index  »  Linux Development - System  »  Accessing h/w without kernel intervention...
Page 1 of 1    
Author Message
Mayuresh...
Posted: Tue Sep 23, 2008 3:28 pm
Guest
Hello,

Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!
Joe Pfeiffer...
Posted: Tue Sep 23, 2008 9:19 pm
Guest
Mayuresh <b166er.496 at (no spam) gmail.com> writes:
Quote:

Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

man ioperm (for io-space devices)
man mprotect (for mmapped devices)

Both go through the kernel to initially get access, after which the
user process can do as it pleases. I think you need to be root for
the calls to succeed (I don't know if things like selinux can give
these permissions without full root privileges).
Juergen Beisert...
Posted: Wed Sep 24, 2008 2:02 am
Guest
Mayuresh wrote:
Quote:
Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

Take a look into the UIO (User I/O) kernel driver. It will provide you with
userland access to your hardware. You can also work with interrupts with
this driver in userland.

Or you can try this command line tool to access your hardware and/or use it
as an example how to do it:
http://www.pengutronix.de/software/memedit/downloads/memedit-0.7.tar.gz

jbe
Mayuresh...
Posted: Wed Sep 24, 2008 9:01 am
Guest
On Sep 24, 3:02 am, Juergen Beisert <jbeis... at (no spam) netscape.net> wrote:
Quote:
Mayuresh wrote:
Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

Take a look into the UIO (User I/O) kernel driver. It will provide you with
userland access to your hardware. You can also work with interrupts with
this driver in userland.

Or you can try this command line tool to access your hardware and/or use it
as an example how to do it:http://www.pengutronix.de/software/memedit/downloads/memedit-0.7.tar.gz

jbe

Not sure if you meant to point to something else - I downloaded the
above but see nothing relevant.

Thanks.
Juergen Beisert...
Posted: Wed Sep 24, 2008 2:38 pm
Guest
Mayuresh wrote:
Quote:
On Sep 24, 3:02 am, Juergen Beisert <jbeis... at (no spam) netscape.net> wrote:
Mayuresh wrote:
Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

Take a look into the UIO (User I/O) kernel driver. It will provide you
with userland access to your hardware. You can also work with interrupts
with this driver in userland.

Or you can try this command line tool to access your hardware and/or use
it as an example how to do it:
http://www.pengutronix.de/software/memedit/downloads/memedit-0.7.tar.gz


Not sure if you meant to point to something else - I downloaded the
above but see nothing relevant.

Hmm, its a nice console tool to get access to any memory mapped hardware
registers. But - you are right - its not a good example to start your own
application with it. Too much lex....

jbe
Janaka...
Posted: Wed Sep 24, 2008 5:28 pm
Guest
On Sep 24, 11:28 am, Mayuresh <b166er.... at (no spam) gmail.com> wrote:
Quote:
Hello,

Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

Try this earlier post from comp.os.linux.embedded group ""Writing to a
device at a known physical address":

http://groups.google.com.au/groups/search?hl=en&qt_s=1&q=%22Writing+to+a+device+at+a+known+physical+address%22
Mayuresh...
Posted: Fri Sep 26, 2008 11:21 am
Guest
On Sep 24, 11:28 pm, Janaka <jana... at (no spam) optiscan.com> wrote:
Quote:
On Sep 24, 11:28 am, Mayuresh <b166er.... at (no spam) gmail.com> wrote:

Hello,

Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Any comments greatly appreciated!

Try this earlier post from comp.os.linux.embedded group ""Writing to a
device at a known physical address":

http://groups.google.com.au/groups/search?hl=en&qt_s=1&q=%22Writing+t...


Thanks! I now have a better understanding. Looks like, in general root
has to set up up before hand in some way or the other so that you can
directly talk to h/w.
Tim Roberts...
Posted: Sat Sep 27, 2008 12:59 am
Guest
Mayuresh <b166er.496 at (no spam) gmail.com> wrote:
Quote:

Is it at all possible for a user space non privileged process to
access some hardware in the system without making a system call or
otherwise going thru the kernel to gain access?

I have come across fleeting references to memory mapped I/O devices
where you can register some user space memory with the device and
after that I/O is done by just writing to this memory. I want to
understand if this is true or if the kernel is still involved in some
way under the hoods.

Your X server is a normal user-mode process. It access the display
hardware by accessing I/O ports, mapping physical memory, and talking to
the frame buffer and registers through the memory maps.

It is, however, suid root, so I it doesn't really qualify as "non
privileged".
--
Tim Roberts, timr at (no spam) probo.com
Providenza & Boekelheide, Inc.
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Fri Dec 05, 2008 3:49 am