Bluehost.com Web Hosting $6.95

iopl() vs. ioperm()

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 ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-29-2007
Philbo 30
 
Posts: n/a
Default iopl() vs. ioperm()

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?

Reply With Quote
  #2 (permalink)  
Old 08-29-2007
Darren Salt
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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.
Reply With Quote
  #3 (permalink)  
Old 08-29-2007
Jan Kandziora
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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

Reply With Quote
  #4 (permalink)  
Old 08-30-2007
Robert M. Riches Jr.
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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.)
Reply With Quote
  #5 (permalink)  
Old 08-30-2007
Bob Hauck
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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/
Reply With Quote
  #6 (permalink)  
Old 08-30-2007
Philbo 30
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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.

Reply With Quote
  #7 (permalink)  
Old 08-30-2007
Jan Kandziora
 
Posts: n/a
Default Re: iopl() vs. ioperm()

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0