1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Description: Don't fail test if cryptsetup fails for disabled module loading
Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Date: 2017-11-20
Bug-Debian: https://bugs.debian.org/881864
Forwarded: not-needed
On the Debian buildds and porter boxes, the crypt_format call in
libcryptsetup fails:
socket(AF_ALG, SOCK_SEQPACKET, 0) = -1 EAFNOSUPPORT (Address family not supported by protocol)
Reproducer using command line (run as non-root):
$ fallocate --length 8m test.img
$ echo foo | /usr/sbin/cryptsetup luksFormat test.img -
The actual reason is DSA disabled automatic module loading by
setting /proc/sys/kernel/modules_disabled to 1, for obvious reaons.
Make the tests non-fatal if they fail at that place, by using the
special exit code 77.
--- a/test.c
+++ b/test.c
@@ -147,6 +147,10 @@
r = crypt_format(cd, CRYPT_LUKS1, "aes", "xts-plain64",
NULL, NULL, 32, NULL);
+ if (r == -5) {
+ fprintf(stderr, "crypt_format failed, assuming AF_ALG,SOCK_SEQPACKET failure\n");
+ exit(77);
+ }
if (r < 0)
error(EXIT_FAILURE, -r, "%s:%d", __FILE__, __LINE__);
--- a/test-luksmeta
+++ b/test-luksmeta
@@ -14,7 +14,13 @@
trap 'onexit' EXIT
truncate -s 4M $tmp
-echo -n foo | /usr/sbin/cryptsetup luksFormat --type luks1 $tmp -
+PRE="$(md5sum $tmp)"
+echo -n foo | /usr/sbin/cryptsetup luksFormat --type luks1 $tmp - || true
+PST="$(md5sum $tmp)"
+if [ "$PRE" = "$PST" ] ; then
+ echo 'cryptsetup failed, assuming AF_ALG,SOCK_SEQPACKET failure'
+ exit 77
+fi
! ./luksmeta test -d $tmp
|