mmap question

Hans de Goede j.w.r.degoede at hhs.nl
Sun Jul 3 16:34:50 UTC 2005


Hi all,

I'm busy trying to package svgalib-1.9.x for Fedora-Extras (I know I'm 
also mailing to devel). And I've hit a bit of a bump.

svgalib-1.9.x mmap's part of the linear framebuffer at the same address 
each time vga_setpage gets called. This is done for cards which are not 
100% vga compatible, so that old programs which expect to see banked 
modes will get banked modes emulated.

The problem with this is that in order todo this svgalib leaves the fd 
for /dev/mem open. Which of course is a big nono from a security point 
of view. So I've been tracking all uses of the /dev/mem fd and I'm 
almost so far that it can be closed immediatly after calling vga_init or 
vga_setmode, as it used to be done in the 1.4.x series.

The setpage emulation on linearframebuffers is the last problem I have. 
What I would like todo is:
open /dev/mem
mmap the entire lfb
close /dev/mem
mmap part of the lfb (64k) at a random address, using the mmap of the
  entire lfb as source instead of an fd.
mmap another part of the lfb (64k) at the address the previous part had.

So what I want is something like mremap, which will allow me to:
-specify a new offset into the file instead of a new size.
or a mmap which will take an existing mapping as source rather then an fd.

Thus such a beast exist and or can anyone help me with another solution?

Thanks & Regards,

Hans




More information about the fedora-extras-list mailing list