From: Eric Biggers <ebiggers3@gmail.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: fstests@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: [PATCH v2] xfstests-bld: populate keyring with default key for test_dummy_encryption
Date: Mon, 30 Jan 2017 13:36:47 -0800 [thread overview]
Message-ID: <20170130213647.14843-1-ebiggers3@gmail.com> (raw)
From: Eric Biggers <ebiggers@google.com>
We can improve test coverage and simplify the test_dummy_encryption
kernel logic by requiring userspace to add a default master key to the
keyring. Update xfstests-bld to do this. This allows xfstests-bld to
test kernels with the corresponding kernel patch applied ("fscrypt: make
test_dummy_encryption require a keyring key"). It can still test older
kernels too; the key just doesn't get used in that case.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
kvm-xfstests/test-appliance/files/root/fs/ext4/config | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kvm-xfstests/test-appliance/files/root/fs/ext4/config b/kvm-xfstests/test-appliance/files/root/fs/ext4/config
index 66d2633..23e869c 100644
--- a/kvm-xfstests/test-appliance/files/root/fs/ext4/config
+++ b/kvm-xfstests/test-appliance/files/root/fs/ext4/config
@@ -36,6 +36,19 @@ function setup_mount_opts()
if test -n "$MNTOPTS" ; then
EXT_MOUNT_OPTIONS="$EXT_MOUNT_OPTIONS,$MNTOPTS"
fi
+ if echo "$EXT_MOUNT_OPTIONS" | grep -q test_dummy_encryption; then
+ # Create a new session keyring and add a default master key to it.
+ keyctl new_session > /dev/null
+ local mode='\x00\x00\x00\x00'
+ local raw="$(printf '\\x%02x' $(seq 0 63))"
+ if lscpu | grep -q '^Byte Order:[[:space:]]\+Little Endian$'; then
+ local size='\x40\x00\x00\x00'
+ else
+ local size='\x00\x00\x00\x40'
+ fi
+ echo -n -e "${mode}${raw}${size}" | \
+ keyctl padd logon ext4:4242424242424242 @s > /dev/null
+ fi
}
function get_mkfs_opts()
--
2.11.0.483.g087da7b7c-goog
next reply other threads:[~2017-01-30 21:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 21:36 Eric Biggers [this message]
2017-01-30 22:42 ` [PATCH v2] xfstests-bld: populate keyring with default key for test_dummy_encryption Theodore Ts'o
2017-01-30 23:03 ` Eric Biggers
2017-01-31 3:56 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170130213647.14843-1-ebiggers3@gmail.com \
--to=ebiggers3@gmail.com \
--cc=ebiggers@google.com \
--cc=fstests@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox