Wednesday, January 21, 2009

potential framebuffer deadlock

In the latest kernel (2.6.29-rc2) there's a potential deadlock condition in the frame buffer between fb_ioctl() and fb_mmap().

The cause is that fb_mmap() is called under mm->mmap_sem (A) held, that also acquires fb_info->lock (B); fb_ioctl() takes fb_info->lock (B) and does copy_from/to_user() that might acquire mm->mmap_sem (A) if a page fault occurs.

So we've a classic deadlock condition: a process holds the lock A and attempts to obtain the lock B, but B is already held by a second process that attemps to lock A.

A possible fix is to prevent the deadlock condition, that means "push down" the mutex fb_info->lock into the fb_ioctl() implementation and avoid the occurrence of the page fault with fb_info->lock held (A). But this also requires to define two basic primitives i.e. lock/unlock_fb_info() and use them opportunely inside *all* the framebuffer drivers. For now I've tried to fix at least the main fb_ioctl() function (with the common ioctl ops) that is shared by all the drivers.

systemimager-light: opening a new branch?

I wonder if it's worth to open a new SystemImager branch without shipping the standard BOEL kernel anymore. Providing the packages for all the supported architectures requires a *huge* amount of time and it's not possible for me to build everything... :( (also because I don't have all the required architectures). So, probably the best way to proceed is to just remove BOEL and set UYOK the default. UYOK allows to create a boot&install package (kernel+initrd.img) for SystemImager using the kernel shipped in any distribution (preferably the kernel shipped with the distribution we want to install) and an initrd_template (shipped with the SystemImager packages). And with the UYOK-only version the time to build the packages is 10 times faster!

I've just opened the new branch locally in my PC using a git repository and pushed the initial release to (to get it: git-clone git://, but the server is down again! :( grrr.... it seems we need a newer and more powerful server...