Re: [AD] SVGAlib driver

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Wang <tjaden@xxxxxxxxxx> writes:
> Problem: It requires root permissions to work properly.  Currently, the 
> part in lsystem.c which dropped root priviledges has been commented out, 
> but I am looking for a better solution.  Anybody?

Allegro only uses seteuid() rather than setuid(), which allows you to get 
the permissions back if you need them later. So it's not really secure 
(programs that take this seriously should call setuid() themselves after 
initialising Allegro, to give the rights up for good), but it just gives a 
shallow layer of insulation against doing something silly by mistake.

To go back to being root, call seteuid(0). Then when are done being root, 
call seteuid(getuid()) to give up those rights again.

Unfortunately I have a feeling that SVGAlib itself calls setuid(getuid()) 
while initialising, in which case we will have truly lost the root 
permissions, and will never again be able to get them back. So for example 
if you go into the test program using the SVGAlib driver, you then won't be 
able to switch across to the VBE/AF driver, since SVGAlib will have 
abdicated ourselves from being allowed to do that...

> I will also put in no-asm versions of the bank switching routines (if that 
> is necessary), soon.

They aren't relevant for Intel platforms (even for testing the C mode 
drawing code, we use asm calling convention for the bank switch routines), 
but could be handy if the SVGAlib driver ever works on other processor 
families. It is particularly easy to write a C convention bank switcher, in 
any case: it is passed a (BITMAP *bmp, int line), and returns an unsigned 
long holding the address of where to draw.


--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/