This is a discussion on iopl() vs. ioperm() within the Linux General forums, part of the Linux Forums category; Newbie to iopl(), some work with ioperm() I'm writing a function to do the following: 1. Gain access to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Newbie to iopl(), some work with ioperm()
I'm writing a function to do the following: 1. Gain access to the parallel port base at 0x378 2. Disable interrupts 3. Do some bit work, send signals, etc. 4. Enable interrupts 5. Exit Currently I'm using ioperm() for gaining access to the port, but perhaps it's better to use iopl() and then a call to .asm cli and sti to disable and enable interrupts respectively. Thoughts? |
|
|||
|
I demand that Philbo 30 may or may not have written...
[snip] > Currently I'm using ioperm() for gaining access to the port, but perhaps > it's better to use iopl() and then a call to .asm cli and sti to disable > and enable interrupts respectively. Thoughts? Yes: that looks like it might just possibly be x86-specific... -- | Darren Salt | linux or ds at | nr. Ashington, | Toon | RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army | + Output *more* particulate pollutants. BUFFER AGAINST GLOBAL WARMING. A clean desk is a sign of a cluttered desk drawer. |
|
|||
|
Philbo 30 schrieb:
> > Currently I'm using ioperm() for gaining access to the port, but > perhaps it's better to use iopl() and then a call to .asm cli and sti > to disable and enable interrupts respectively. Thoughts? > You should never disable interrupts in a userspace program though iopl() will allow you to do it. Such a program is likely to crash the whole system, which users won't expect from a "program" -- they would expect from a poorly written driver module, I think. What do you intend to do? Kind regards Jan |
|
|||
|
On 2007-08-29, Jan Kandziora <jjj@gmx.de> wrote:
> Philbo 30 schrieb: >> >> Currently I'm using ioperm() for gaining access to the port, but >> perhaps it's better to use iopl() and then a call to .asm cli and sti >> to disable and enable interrupts respectively. Thoughts? >> > You should never disable interrupts in a userspace program though iopl() > will allow you to do it. > > Such a program is likely to crash the whole system, which users won't expect > from a "program" -- they would expect from a poorly written driver module, > I think. A userspace program being able to crash the whole system? That would quality as a DoS security vulnerability and would or at least should be fixed promptly. -- Robert Riches spamtrap42@verizon.net (Yes, that is one of my email addresses.) |
|
|||
|
On Wed, 29 Aug 2007 22:12:20 GMT, Robert M. Riches Jr.
<spamtrap42@verizon.net> wrote: [calling iopl() and then disabling interrupts] > A userspace program being able to crash the whole system? > That would quality as a DoS security vulnerability and would > or at least should be fixed promptly. You have to be root to sucessfully call iopl(). There are lots of ways for root to crash or otherwise DOS the system besides that. -- -| Bob Hauck -| "Reality has a well-known liberal bias." -- Stephen Colbert -| http://www.haucks.org/ |
|
|||
|
On Aug 29, 7:48 pm, Bob Hauck <postmas...@localhost.localdomain>
wrote: > On Wed, 29 Aug 2007 22:12:20 GMT, Robert M. Riches Jr. > > <spamtra...@verizon.net> wrote: > > [calling iopl() and then disabling interrupts] > > > A userspace program being able to crash the whole system? > > That would quality as a DoS security vulnerability and would > > or at least should be fixed promptly. > > You have to be root to sucessfully call iopl(). There are lots of ways > for root to crash or otherwise DOS the system besides that. > > -- > -| Bob Hauck > -| "Reality has a well-known liberal bias." -- Stephen Colbert > -|http://www.haucks.org/ Thanx for the info; I was able to call cli() and sti() using asm/ system.h and each promptly segfaults the app, but (fortunately) not the whole box. |
|
|||
|
Philbo 30 schrieb:
> > Thanx for the info; I was able to call cli() and sti() using asm/ > system.h and each promptly segfaults the app, but (fortunately) not > the whole box. > Yes, they are priviledged instructions. If you don't have the permissions to use them, the process will be ended. However, it is(was?) possible to get permission to use cli and sti in a userspace program. This *is* a DoS source, so only root may run such a program. $ man iopl Kind regards Jan |