[dm-crypt] Cryptsetup (>= 1.7.0) luksOpen/luksClose gets stuck after open/close

Guido Trentalancia guido at trentalancia.net
Thu Apr 7 16:26:22 CEST 2016


Hello.

Cryptsetup version 1.7.0 and 1.7.1 gets stuck on luksOpen and luksClose
immediately after the device has been opened or closed.

The process has to be killed.

Here are the last bits of the strace output for luksOpen (after
entering the passphrase):

read(7, "\213\364\23\350X'\326\355s\231\34\262\360h\4\266\245\"\266:\207\330)\344s\332\3211\354\2\355\17"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"p\1O\225\233\244\235\315G\243o\7\265QO\316\3I\305\300\f\201Awh\321&m\200}\353."..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\f7\223&\245\357Z!\367\206g\346\267Y\251\377\200\345\246\357GG\333,6\202`Z\247:4\310"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\207 at -\276\372\347\26\0\24\335Y6\244\2Q\344\315^\301\"\325e\352\271'Y+\210\320\237\313\10"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\264\267\211\254R\23|\202\335Zt\203\333\22\362\350\1\315\261\306\241e\340\362\376\210\30\205\35\0275\235"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\7\304\2346\243s\225\235*\314u\370\310VL\337S\216\17\r\265\366\252W\346J\201\357\253)\356\227"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\232a\262\334\320\372a\253\372\227Ky&&\10\2363V\225\263\370\316\264\277\\\266G\217\226\253\261\31"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"P\"\304\212S\322\10LD\217\17S\0*\205\7c\343\312\322\254Vl\31\304\214\247:\270\233\272Y"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "k\242\250Xw\376N\352\202\37q|\315 :\230\23 \2/h\221x\305\313\334\n\6\241\350\342\24"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"j%\214\327*\203\225\216\233\3776\225\373\373+(XNC\371\277\32\363\322~j`\333J.\267\25"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\3621\202\0359\t\323\220\241\206\231:\314\207B\274\221\7\305\253\223\201H<\316\300\232\216r\367+\224"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"o\342w\330\354\244\377\23f\177b\34\244\323gt\352\332\324\241\246\21\211&@n\256\307\275\7\2536"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\241\307\344I\342\334gJ\340\375\322u\33\341\0038u\10\323\257\313u\23$\243\27\217\36\247^\322\260"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\312[#\211\344w\206\36l\312\326\31\210\362\17\267\1[\305\373\21\354\340p\214C\245\315js\t\22"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "/<G(\364\203\341\257\2121\0\215~\302\337\6\314\356\227\215\341\177\366t\355\350e\350\234b]\332"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"e\253\30,$\363p\303[RqU\347k\236\241\245U]\333\330\332\306\221\324\213\313\331F\23\0\345"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "K\226{i\316\217\363)\340\207\317]3\356}\322>A\6\2c\267\337I\347\244.o\305\234\352\373"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\356\17\214w\220V6l\351\212\2\314\273\255&\333u\276\254\n\370\262eDT\340]\232XN\203i"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\267\211f\322\232\3327Us\10\311{\303\2273\332)\211\300#\276H\2207\2607N\375\375VFj"..., 512) = 512
sendmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\350N\367_7\323\246\377\34=O\300\307\363\2274\206\351&\3212\377\3674\263Bg_5\247T\306"..., 512}], msg_controllen=64, [{cmsg_len=20, cmsg_level=SOL_ALG, cmsg_type=3, ...}, {cmsg_len=40, cmsg_level=SOL_ALG, cmsg_type=2, ...}], msg_flags=0}, 0) = 512
read(7, "\16O\25{\236\352`\262\224\307H\330\7k9)?\30l\202\234\232v\244B\261\364\262.\245\243\210"..., 512) = 512
close(6)                                = 0
close(7)                                = 0
munmap(0x7f7679fcd000, 258048)          = 0
stat("/dev/mapper/vg_vortex-LogVol03", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDWR|O_EXCL) = 6
ioctl(6, BLKROGET, 0)                   = 0
ioctl(6, BLKGETSIZE64, 104857600000)    = 0
close(6)                                = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY) = 6
ioctl(6, BLKRAGET, 256)                 = 0
close(6)                                = 0
open("/dev/urandom", O_RDONLY)          = 6
read(6, "NL", 2)                        = 2
semget(0xd4d4c4e, 1, IPC_CREAT|IPC_EXCL|0600) = 229380
semctl(229380, 0, SETVAL, 0x1)          = 0
semctl(229380, 0, GETVAL, 0x7f7679730d4a) = 1
close(6)                                = 0
semop(229380, {{0, 1, 0}}, 1)           = 0
semctl(229380, 0, GETVAL, 0x7f7679730ce7) = 2
ioctl(5, DM_DEV_CREATE, 0x20dd820)      = 0
ioctl(5, DM_TABLE_LOAD, 0x20dd560)      = 0
ioctl(5, DM_DEV_SUSPEND, 0x20dd430)     = 0
semget(0xd4d4c4e, 1, 0)                 = 229380
semctl(229380, 0, GETVAL, 0x7f7679730d17) = 2
semop(229380, {{0, -1, IPC_NOWAIT}}, 1) = 0
semop(229380, {{0, 0, 0}}, 1)           = -1 EINTR (Interrupted system call)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
semop(229380, {{0, 0, 0}}, 1

The device is opened correctly and it can be mounted.

Here are the last bits of the strace output for luksClose:

stat("/dev/mapper/control", {st_mode=S_IFCHR|0600, st_rdev=makedev(10, 236), ...}) = 0
open("/dev/mapper/control", O_RDWR)     = 3
ioctl(3, DM_TABLE_STATUS, 0x9b8690)     = 0
readlink("/sys/dev/block/253:5", "../../devices/virtual/block/dm-5", 4095) = 32
ioctl(3, DM_TABLE_STATUS, 0x9bc6a0)     = 0
stat("/dev/mapper/vg_vortex-LogVol03", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY|O_DIRECT) = 4
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
ioctl(4, BLKSSZGET, 512)                = 0
fstatfs(4, {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=484700, f_bfree=484700, f_bavail=484700, f_files=484700, f_ffree=483639, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=34}) = 0
read(4, "LUKS\272\276\0\1aes\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
close(4)                                = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY|O_DIRECT) = 4
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
ioctl(4, BLKSSZGET, 512)                = 0
fstatfs(4, {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=484700, f_bfree=484700, f_bavail=484700, f_files=484700, f_ffree=483639, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=34}) = 0
read(4, "LUKS\272\276\0\1aes\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
close(4)                                = 0
ioctl(3, DM_TABLE_STATUS, 0x9b8ca0)     = 0
readlink("/sys/dev/block/253:5", "../../devices/virtual/block/dm-5", 4095) = 32
ioctl(3, DM_TABLE_STATUS, 0x9c0720)     = 0
stat("/dev/mapper/vg_vortex-LogVol03", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY|O_DIRECT) = 4
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
ioctl(4, BLKSSZGET, 512)                = 0
fstatfs(4, {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=484700, f_bfree=484700, f_bavail=484700, f_files=484700, f_ffree=483639, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=34}) = 0
read(4, "LUKS\272\276\0\1aes\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
close(4)                                = 0
open("/dev/urandom", O_RDONLY)          = 4
open("/dev/random", O_RDONLY|O_NONBLOCK) = 5
access("/etc/gcrypt/fips_enabled", F_OK) = -1 ENOENT (No such file or directory)
open("/proc/sys/crypto/fips_enabled", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/gcrypt/hwf.deny", O_RDONLY)  = -1 ENOENT (No such file or directory)
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa5f7972000
getuid()                                = 0
mlock(0x7fa5f7972000, 16384)            = 0
uname({sysname="Linux", nodename="vortex", ...}) = 0
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY|O_SYNC|O_DIRECT) = 6
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY) = 7
fstat(7, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
ioctl(7, BLKSSZGET, 512)                = 0
close(7)                                = 0
fstatfs(6, {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=484700, f_bfree=484700, f_bavail=484700, f_files=484700, f_ffree=483639, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=34}) = 0
read(6, "LUKS\272\276\0\1aes\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
open("/dev/mapper/vg_vortex-LogVol03", O_RDONLY) = 7
fstat(7, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 5), ...}) = 0
ioctl(7, BLKGETSIZE64, 104857600000)    = 0
close(7)                                = 0
close(6)                                = 0
ioctl(3, DM_TABLE_STATUS, 0x9b8bc0)     = 0
open("/dev/urandom", O_RDONLY)          = 6
read(6, "\352\345", 2)                  = 2
semget(0xd4de5ea, 1, IPC_CREAT|IPC_EXCL|0600) = 196611
semctl(196611, 0, SETVAL, 0x1)          = 0
semctl(196611, 0, GETVAL, 0x7fa5f7072d4a) = 1
close(6)                                = 0
semop(196611, {{0, 1, 0}}, 1)           = 0
semctl(196611, 0, GETVAL, 0x7fa5f7072ce7) = 2
ioctl(3, DM_DEV_REMOVE, 0x9b8bc0)       = 0
semget(0xd4de5ea, 1, 0)                 = 196611
semctl(196611, 0, GETVAL, 0x7fa5f7072d17) = 2
semop(196611, {{0, -1, IPC_NOWAIT}}, 1) = 0
semop(196611, {{0, 0, 0}}, 1)           = -1 EINTR (Interrupted system call)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
semop(196611, {{0, 0, 0}}, 1

The device is closed correctly, however the cryptsetup process has to
be killed again to get the shell prompt back.

Previous versions (such as 1.6.8 and earlier ones) are not affected by
this bug.

Any idea ?

Regards,

Guido


More information about the dm-crypt mailing list