From e4af128b30855b2b29a27c2fd7580b62059bbe51 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 25 Nov 2015 11:09:17 +0100 Subject: nlplug-findfs: fix cryptsetup race condition We need run cryptsetup in parallel so that keyboard drivers are loaded while waiting for password input. But cryptsetup will recreate the device which means that the uevent for new device node will first be added then changed and finally will it create the /dev/mapper/* device node. We handle the first generated uevent and while handling, the device node might have disappeared causeing blkid not find any UUID, and the /dev/mapper/* does not yet exist. This means that we need to: - handle uevents in parallel while waiting for password input - block uevent handling while actually setting up the crypt device So we use libcryptsetup and add a mutex while setting up the crypt device. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a62c294..11c5546 100644 --- a/Makefile +++ b/Makefile @@ -81,9 +81,11 @@ BLKID_CFLAGS := $(shell $(PKGCONF) --cflags blkid) BLKID_LIBS := $(shell $(PKGCONF) --libs blkid) LIBKMOD_CFLAGS := $(shell $(PKGCONF) --cflags libkmod) LIBKMOD_LIBS := $(shell $(PKGCONF) --libs libkmod) +CRYPTSETUP_CFLAGS := $(shell $(PKGCONF) --cflags libcryptsetup) +CRYPTSETUP_LIBS := $(shell $(PKGCONF) --libs libcryptsetup) -CFLAGS += $(BLKID_CFLAGS) $(LIBKMOD_CFLAGS) -LIBS = $(BLKID_LIBS) $(LIBKMOD_LIBS) +CFLAGS += $(BLKID_CFLAGS) $(LIBKMOD_CFLAGS) $(CRYPTSETUP_CFLAGS) +LIBS = $(BLKID_LIBS) $(LIBKMOD_LIBS) $(CRYPTSETUP_LIBS) %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< -- cgit v1.2.3