ThreadCtl and Graphics Drivers

I am working on an application which uses the Graphics Driver API
directly. After looking at the bench sample, I noticed that a call to
ThreadCtl(_NTO_TCTL_IO, 0) is made. Is it absolutely necessary to make
this call? I need to know some specifics about its relation to the
Graphics Driver API because the app I am working on will have non-root
users.

thanks,
Charlie

Charlie_Surface@oti.com wrote:

I am working on an application which uses the Graphics Driver API
directly. After looking at the bench sample, I noticed that a call to
ThreadCtl(_NTO_TCTL_IO, 0) is made. Is it absolutely necessary to make
this call? I need to know some specifics about its relation to the

Actually, this call is probably superfluous, since the graphics driver
will do the same thing internally (in fact, for drivers which use the
disputil lib, it is done automatically when they register with the lib).

Graphics Driver API because the app I am working on will have non-root
users.

Even if the graphics driver didn’t make the ThreadCtl call, there are
other calls it would make that require root access (like mapping
physical memory, attaching interrupts) which require root privilidges.

To allow non-root users to run an app which loads and runs graphics
drivers, you would need to make the app suid-root.

Note the permissions and ownership of the “io-graphics” executable.

I’m working with Charlie on this. We’ll admit to having less than complete
understanding of the permissions required. What we’d like to do is get
access to the fb from a process running as user. We promise that we will
gate access to it :slight_smile:. As well as call into the drivers. Is there any way
this can be made to happen? Even doing something wacky like starting in
root, then switching to some less powerful uid, then switching back to root
temporarily when we need to touch something sensitive …

Patrick_Mueller@oti.com



“David Donohoe” <ddonohoe@qnx.com> wrote in message
news:9ken4i$25k$1@nntp.qnx.com

Charlie_Surface@oti.com > wrote:
I am working on an application which uses the Graphics Driver API
directly. After looking at the bench sample, I noticed that a call to
ThreadCtl(_NTO_TCTL_IO, 0) is made. Is it absolutely necessary to make
this call? I need to know some specifics about its relation to the

Actually, this call is probably superfluous, since the graphics driver
will do the same thing internally (in fact, for drivers which use the
disputil lib, it is done automatically when they register with the lib).

Graphics Driver API because the app I am working on will have non-root
users.

Even if the graphics driver didn’t make the ThreadCtl call, there are
other calls it would make that require root access (like mapping
physical memory, attaching interrupts) which require root privilidges.

To allow non-root users to run an app which loads and runs graphics
drivers, you would need to make the app suid-root.

Note the permissions and ownership of the “io-graphics” executable.

Patrick Mueller <patrick_mueller@oti.com> wrote:
: I’m working with Charlie on this. We’ll admit to having less than complete
: understanding of the permissions required. What we’d like to do is get
: access to the fb from a process running as user. We promise that we will
: gate access to it :slight_smile:. As well as call into the drivers. Is there any way
: this can be made to happen? Even doing something wacky like starting in
: root, then switching to some less powerful uid, then switching back to root
: temporarily when we need to touch something sensitive …

What Dave suggested below should do what you need. Have your
application owner by root and then change the permissions of
the application to be setuid.

For example with the graphics DDK bench utility if built as
root, trying to run the utility as a user results in:

ThreadCtl: Operation not permitted

However if you change the bench permissions to bet setuid:

chmod u+s bench (done as root)

Then you can run the bench utility as a normal user.


: –
: ----------------------------------------------------
: Patrick_Mueller@oti.com
: ----------------------------------------------------


: “David Donohoe” <ddonohoe@qnx.com> wrote in message
: news:9ken4i$25k$1@nntp.qnx.com
:> Charlie_Surface@oti.com wrote:
:> > I am working on an application which uses the Graphics Driver API
:> > directly. After looking at the bench sample, I noticed that a call to
:> > ThreadCtl(_NTO_TCTL_IO, 0) is made. Is it absolutely necessary to make
:> > this call? I need to know some specifics about its relation to the
:>
:> Actually, this call is probably superfluous, since the graphics driver
:> will do the same thing internally (in fact, for drivers which use the
:> disputil lib, it is done automatically when they register with the lib).
:>
:> > Graphics Driver API because the app I am working on will have non-root
:> > users.
:>
:> Even if the graphics driver didn’t make the ThreadCtl call, there are
:> other calls it would make that require root access (like mapping
:> physical memory, attaching interrupts) which require root privilidges.
:>
:> To allow non-root users to run an app which loads and runs graphics
:> drivers, you would need to make the app suid-root.
:>
:> Note the permissions and ownership of the “io-graphics” executable.
:>