geli: fix parallel execution of tests
The trick is not to destroy an md(4) device during a test. That can create a "double-free" situation, because we also destroy md devices during test cleanup. MFC after: 2 weeks
This commit is contained in:
parent
1482e17120
commit
7edc58b100
@ -4,6 +4,7 @@
|
||||
class="eli"
|
||||
base=$(atf_get ident)
|
||||
[ -z "$base" ] && base=`basename $0` # for TAP compatibility
|
||||
MAX_SECSIZE=8192
|
||||
TEST_MDS_FILE=md.devs
|
||||
|
||||
attach_md()
|
||||
@ -21,6 +22,11 @@ attach_md()
|
||||
for_each_geli_config() {
|
||||
func=$1
|
||||
|
||||
# Double the sector size to allow for the HMACs' storage space.
|
||||
osecsize=$(( $MAX_SECSIZE * 2 ))
|
||||
# geli needs 512B for the label.
|
||||
bytes=`expr $osecsize \* $sectors + 512`b
|
||||
md=$(attach_md -t malloc -s $bytes)
|
||||
for cipher in aes-xts:128 aes-xts:256 \
|
||||
aes-cbc:128 aes-cbc:192 aes-cbc:256 \
|
||||
3des-cbc:192 \
|
||||
@ -33,16 +39,9 @@ for_each_geli_config() {
|
||||
keylen=${cipher##*:}
|
||||
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \
|
||||
hmac/sha384 hmac/sha512; do
|
||||
for secsize in 512 1024 2048 4096 8192; do
|
||||
# Double the requested sector size to allow
|
||||
# for the HMACs' storage space.
|
||||
osecsize=$(( $secsize * 2 ))
|
||||
# geli needs 512B for the label.
|
||||
bytes=`expr $osecsize \* $sectors + 512`b
|
||||
md=$(attach_md -t malloc -s $bytes)
|
||||
for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do
|
||||
${func} $cipher $aalgo $secsize
|
||||
geli detach ${md} 2>/dev/null
|
||||
mdconfig -d -u ${md} 2>/dev/null
|
||||
done
|
||||
done
|
||||
done
|
||||
@ -54,6 +53,9 @@ for_each_geli_config() {
|
||||
for_each_geli_config_nointegrity() {
|
||||
func=$1
|
||||
|
||||
# geli needs 512B for the label.
|
||||
bytes=`expr $MAX_SECSIZE \* $sectors + 512`b
|
||||
md=$(attach_md -t malloc -s $bytes)
|
||||
for cipher in aes-xts:128 aes-xts:256 \
|
||||
aes-cbc:128 aes-cbc:192 aes-cbc:256 \
|
||||
3des-cbc:192 \
|
||||
@ -64,13 +66,9 @@ for_each_geli_config_nointegrity() {
|
||||
camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
|
||||
ealgo=${cipher%%:*}
|
||||
keylen=${cipher##*:}
|
||||
for secsize in 512 1024 2048 4096 8192; do
|
||||
# geli needs 512B for the label.
|
||||
bytes=`expr $secsize \* $sectors + 512`b
|
||||
md=$(attach_md -t malloc -s $bytes)
|
||||
for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do
|
||||
${func} $cipher $secsize
|
||||
geli detach ${md} 2>/dev/null
|
||||
mdconfig -d -u ${md} 2>/dev/null
|
||||
done
|
||||
done
|
||||
}
|
||||
|
@ -9,19 +9,18 @@ init_test()
|
||||
keylen=${cipher##*:}
|
||||
|
||||
atf_check -s exit:0 -e ignore \
|
||||
geli init -B none -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md}
|
||||
geli init -B none -e $ealgo -l $keylen -P -K keyfile
|
||||
-s $secsize ${md}
|
||||
atf_check geli attach -p -k keyfile ${md}
|
||||
|
||||
secs=`diskinfo /dev/${md}.eli | awk '{print $4}'`
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} \
|
||||
status=none
|
||||
|
||||
atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none
|
||||
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5`
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null | md5`
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5`
|
||||
md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
|
||||
if [ ${md_rnd} != ${md_ddev} ]; then
|
||||
@ -45,7 +44,8 @@ init_body()
|
||||
sectors=32
|
||||
|
||||
atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
|
||||
atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none
|
||||
atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \
|
||||
status=none
|
||||
for_each_geli_config_nointegrity init_test
|
||||
}
|
||||
init_cleanup()
|
||||
@ -235,16 +235,16 @@ init_a_test()
|
||||
ealgo=${cipher%%:*}
|
||||
keylen=${cipher##*:}
|
||||
|
||||
atf_check -s exit:0 -e ignore geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md}
|
||||
atf_check -s exit:0 -e ignore \
|
||||
geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \
|
||||
-s $secsize ${md}
|
||||
atf_check geli attach -p -k keyfile ${md}
|
||||
|
||||
secs=`diskinfo /dev/${md}.eli | awk '{print $4}'`
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none
|
||||
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none
|
||||
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5`
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5`
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
|
||||
if [ ${md_rnd} != ${md_ddev} ]; then
|
||||
@ -265,7 +265,8 @@ init_a_body()
|
||||
sectors=100
|
||||
|
||||
atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
|
||||
atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none
|
||||
atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \
|
||||
status=none
|
||||
for_each_geli_config init_a_test
|
||||
true
|
||||
}
|
||||
@ -348,7 +349,7 @@ init_i_P_body()
|
||||
|
||||
atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
|
||||
|
||||
atf_check -s exit:1 -e "match:Options -i and -P are mutually exclusive"\
|
||||
atf_check -s not-exit:0 -e "match:Options -i and -P are mutually exclusive"\
|
||||
geli init -B none -i 64 -P -K keyfile $md
|
||||
}
|
||||
init_i_P_cleanup()
|
||||
|
@ -10,16 +10,14 @@ onetime_test()
|
||||
atf_check -s exit:0 -o ignore -e ignore \
|
||||
geli onetime -e $ealgo -l $keylen -s $secsize ${md}
|
||||
|
||||
secs=`diskinfo /dev/${md}.eli | awk '{print $4}'`
|
||||
atf_check dd if=/dev/random of=rnd bs=${secsize} count=${sectors} status=none
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none
|
||||
|
||||
atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none
|
||||
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5`
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5`
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5`
|
||||
md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
|
||||
if [ ${md_rnd} != ${md_ddev} ]; then
|
||||
@ -41,6 +39,7 @@ onetime_body()
|
||||
. $(atf_get_srcdir)/conf.sh
|
||||
sectors=100
|
||||
|
||||
dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none
|
||||
for_each_geli_config_nointegrity onetime_test
|
||||
}
|
||||
onetime_cleanup()
|
||||
@ -60,13 +59,11 @@ onetime_a_test()
|
||||
atf_check -s exit:0 -o ignore -e ignore \
|
||||
geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize ${md}
|
||||
|
||||
secs=`diskinfo /dev/${md}.eli | awk '{print $4}'`
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none
|
||||
|
||||
atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none
|
||||
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5`
|
||||
md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5`
|
||||
md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
|
||||
atf_check_equal 0 $?
|
||||
|
||||
if [ ${md_rnd} != ${md_ddev} ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user