Accessing h/w without kernel intervention - Linux

This is a discussion on Accessing h/w without kernel intervention - Linux ; 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 ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Accessing h/w without kernel intervention

  1. Accessing h/w without kernel intervention

    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!

  2. Re: Accessing h/w without kernel intervention

    Mayuresh writes:
    >
    > 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).

  3. Re: Accessing h/w without kernel intervention

    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/m...dit-0.7.tar.gz

    jbe




  4. Re: Accessing h/w without kernel intervention

    On Sep 24, 3:02 am, Juergen Beisert 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/m...dit-0.7.tar.gz
    >
    > jbe


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

    Thanks.

  5. Re: Accessing h/w without kernel intervention

    Mayuresh wrote:
    > On Sep 24, 3:02 am, Juergen Beisert 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/m...dit-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


  6. Re: Accessing h/w without kernel intervention

    On Sep 24, 11:28*am, Mayuresh 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/s...cal+address%22

  7. Re: Accessing h/w without kernel intervention

    On Sep 24, 11:28*pm, Janaka wrote:
    > On Sep 24, 11:28*am, Mayuresh 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/s...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.

  8. Re: Accessing h/w without kernel intervention

    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.


    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@probo.com
    Providenza & Boekelheide, Inc.

+ Reply to Thread