generic: test encryption key revocation during concurrent I/O
PATCH 1/1 generic: test encryption key revocation during concurrent I/O
From: Eric Biggers <[email protected]>
Add a test which revokes a keyring key while other processes are performing I/O on an encrypted file that was "unlocked" using that key. This crashes unpatched kernels with filesystem encryption enabled, so place it in the "dangerous" group.
[The patch to fix this is titled "fscrypt: remove broken support for detecting keyring key revocation" but hasn't been merged yet; we may want to wait a bit before merging this test.]
--- common/encrypt | 8 ++++ tests/generic/500 | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/500.out | 2 + tests/generic/group | 1 + 4 files changed, 120 insertions(+) create mode 100755 tests/generic/500 create mode 100644 tests/generic/500.out
common/encrypt +8 -0
@@ -144,3 +144,11 @@ _unlink_encryption_key() local keyid=$($KEYCTL_PROG search @s logon $FSTYP:$keydesc) $KEYCTL_PROG unlink $keyid >>$seqres.full } + +# Revoke an encryption key from the keyring, given its key descriptor. +_revoke_encryption_key() +{ + local keydesc=$1 + local keyid=$($KEYCTL_PROG search @s logon $FSTYP:$keydesc) + $KEYCTL_PROG revoke $keyid >>$seqres.full +}
tests/generic/500 new file +109 -0
109 lines not on this page · raw message
tests/generic/500.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 500 +Didn't crash!
tests/generic/group +1 -0
@@ -420,3 +420,4 @@ 415 auto clone 416 auto enospc 417 auto quick shutdown log +500 auto quick encrypt dangerous
Signature · 1 line
2.12.0.367.g23dc2f6d3c-goog
Quoted 10 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a test which revokes a keyring key while other processes are performing I/O on an encrypted file that was "unlocked" using that key. This crashes unpatched kernels with filesystem encryption enabled, so place it in the "dangerous" group.
[The patch to fix this is titled "fscrypt: remove broken support for detecting keyring key revocation" but hasn't been merged yet; we may want to wait a bit before merging this test.]
Agreed.
Quoted 6 lines
Cc Theodore Ts'o <[email protected]>Cc Jaegeuk Kim <[email protected]>Cc Richard Weinberger <[email protected]>Cc Michael Halcrow <[email protected]>Signed-off-by Eric Biggers <[email protected]>
This looks good to me, and it crashed my 4.11-rc2 test host very quickly. Just one minor comment below.
Quoted 8 lines
--- common/encrypt | 8 ++++ tests/generic/500 | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/500.out | 2 + tests/generic/group | 1 + 4 files changed, 120 insertions(+) create mode 100755 tests/generic/500 create mode 100644 tests/generic/500.out
...
tests/generic/500 line 51
Quoted 5 lines
tests/generic/500 new file +5
-0+# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs ext4 f2fs
supported fs should be generic if it's in generic dir. If it only supports some specific filesystems, then it should go to shared dir.
Thanks,
Eryu
Quoted 9 lines · Eryu Guan
tests/generic/500 line 51
Quoted 5 lines
tests/generic/500 new file +5
-0+# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs ext4 f2fssupported fs should be generic if it's in generic dir. If it only supports some specific filesystems, then it should go to shared dir.
Indeed, it's supposed to be '_supported_fs generic'.
Thanks for reviewing!
- Eric