From patchwork Mon Jan 30 21:36:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9546111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6211360415 for ; Mon, 30 Jan 2017 21:37:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 682E6283EB for ; Mon, 30 Jan 2017 21:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59DE420499; Mon, 30 Jan 2017 21:37:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BEFE20499 for ; Mon, 30 Jan 2017 21:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754502AbdA3VhC (ORCPT ); Mon, 30 Jan 2017 16:37:02 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33151 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754380AbdA3VhB (ORCPT ); Mon, 30 Jan 2017 16:37:01 -0500 Received: by mail-pf0-f193.google.com with SMTP id e4so24191211pfg.0 for ; Mon, 30 Jan 2017 13:37:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hxZzN5Mbg4AM0DAxq9OSWN1GJCdoBPIw0KmFBJIocTk=; b=K4QY9auyFYeZ/8s3l++rEWYGTM1o1K7gtgr+WkPrEPMMtudqKBdh8R1CWwwBq4WFW3 Y2ueacb5DD3nWxVwtpm5gXT2SKR3VwHNSjmYTU39Ty2hQz3j/TQ1Oh/w3mgTcEb9fx5+ lgD8y8+HZOF8HCIV1g3KT/7PPHuYZrQSaCjj2SQWXiWoJMrJvWwBprx2tfi5NdKqVGR+ MwwITb2fUhNc56ehd7WFldqekoTurFuyo63NR/L5vR2fI+UQObkea6h+wUzvw0YbLurr 7CxJ8vNRkomA7kLq/dY5u0zyC6K/GKoTFfFzLdFCA90gNtFm4SPekLjngit0PlBjLce8 5zgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hxZzN5Mbg4AM0DAxq9OSWN1GJCdoBPIw0KmFBJIocTk=; b=L+cf8+gfUgOWjqkr6oDc3rHUnHJ+iwWlbtAD4SwAXrRbyY4W/g0jpooPrkcHX+zxP2 0AXRjWvZRGInrPgrnu9ltU0apLtcQsrOWj64Be+H1wn4djjKf3uVgzsYcnOR5GWS+rrz suM9p2Xh+Rnw4ZO60O3FmtRSaQGkkALt6hwGcRX5btH9vdOAPW4Ut+ZumMjZoMBRRoVl WMY8AuzypqO6vagrSXnAPLKsynJ2fQCSpP0VmQxM1y/rJWZ5OSGb3z3VtpwH/W+DJIXu KiYo+Kcas0bLDJziMWdsm1jqEvivQPjDS1dM8TZ+w5tEdr9gUuxfU9+51QzCJiU1aSre FOPQ== X-Gm-Message-State: AIkVDXL2pNaYsOESeDwqawdhVP5zsY6scTXtWtB+zZt26yZwkSEFC2iettCUuF/wznPewg== X-Received: by 10.98.200.207 with SMTP id i76mr25035437pfk.38.1485812221120; Mon, 30 Jan 2017 13:37:01 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.119.30.131]) by smtp.gmail.com with ESMTPSA id y23sm34971805pfi.66.2017.01.30.13.37.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jan 2017 13:37:00 -0800 (PST) From: Eric Biggers To: Theodore Ts'o Cc: fstests@vger.kernel.org, Eric Biggers Subject: [PATCH v2] xfstests-bld: populate keyring with default key for test_dummy_encryption Date: Mon, 30 Jan 2017 13:36:47 -0800 Message-Id: <20170130213647.14843-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers 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 --- 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()