HAL and LUKS II: revenge of cryptsetup

David Zeuthen david at fubar.dk
Mon Apr 21 07:36:30 PDT 2008


On Sun, 2008-04-20 at 16:32 +0000, Sam Morris wrote:
> Next I did it the brute-force way: list the contents of /dev/mapper, do a 
> stat on each block device, look at st_rdev and compare it to the device 
> number of the event; if they match then look at the name. This doesn't 
> work either though... the 'temporary-cryptsetup-*' block device does not 
> appear in /dev/mapper by the time HAL has a change to read the directory. 
> Probably because cryptsetup removes the mapping too quickly.
> 
> Any other ideas?

The fundamental problem is that device-mapper creates it's own device
nodes in /dev and that's why it's indeed racy. Instead it should rely on
udev doing this (udev is supposed to manage /dev) and, FWIW, it's a
known problem and have been discussed by myself, Alasdair and Kay on
more than one occasion. For some reason I'm not seeing these races on
Fedora so it "works" fine here (but probably not under load). I think a
temporary fix includes a udev rule that checks for temporary-cryptsetup*
and then avoids propagating such events the HAL. That's still a bit racy
though.

    David




More information about the hal mailing list