From patchwork Mon Oct 9 19:15:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 823430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uZ8iGi6u"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hfb8kL22"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y9qn10qMGz9t44 for ; Tue, 10 Oct 2017 06:19:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=fe8TEVyNdJMZnEKWoM9F7f8ebipfecb8PnZEPzo9vwA=; b=uZ8 iGi6uBXEWtWFgwSJ8keWC+yXhbzJKhXcvZmhZHeNkoBB5wUHc9HqQZbEB8gg9NJexrwAbwl4Q4lBT 0xexSnCFYVsx7QXl2Jeq7DMK6HoXOL9Tut0E1/tTyUC1y6lilnkcnxvDz4w7e0wbTNS4mHrh7pnoc 4eje2ZVnCZ5kCdutijZN39BORbV5nJmJn+HeEEt6lXRo2MCLvDSfg6ZsYjpgtW7Wg4qVgoiGUYP03 fJTjdshcbCr54GE2ljslhpujiHwfBwBtiHYfUNRZ4FbXcuvSvw61/T5hHgH/J08FKmh/j2z9CC+gC xX+lnAFlvD3lxlkavybE3YYKonXGaPQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e1daB-0000IP-LA; Mon, 09 Oct 2017 19:19:19 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e1da8-0000Co-SS for linux-mtd@lists.infradead.org; Mon, 09 Oct 2017 19:19:18 +0000 Received: by mail-pf0-x242.google.com with SMTP id z11so12490450pfk.3 for ; Mon, 09 Oct 2017 12:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4zhFCSaKEwFPOSAhdBfw8QjN8niZTuBro9Rp59MlSpw=; b=hfb8kL22eAW7GE+RynEfDPAnl8+zMBbETLKVam5lauyjHwnCPWQOs+GfceVq+rKGcE FWz3vIRjIj44Fi0MIAX+W43FdbWG967o/ZPW2s22XRcS/p9FZ6VWhnqXq5mbt6x6pguO l3EL5Gs98+J7+DX3k7WK4m8fodILJAGOapfltnjYrub2kpoZCHbTnxid1tIxKrcPByit cGaCc9ph2ze+A6ZYSr6S01WtDTNZcHTwoO0GjPNS/4WVnd0vQWf3xAkLiN7cuQh5cBQH 1eS8OIjJfEoomX+NIjlR3o9u1B8ywRZd9BdpDQaf7g8LYqdsk4hl9AQA40SR8uBvIMNV WWlw== 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=4zhFCSaKEwFPOSAhdBfw8QjN8niZTuBro9Rp59MlSpw=; b=ffPDsbwgG8LRN6LxG2Yx6WuZqMtFkKTtxFhi5Gfq9srIDHX0Z1PSDr58beSchGlMwZ +qIl++Og+fG1Ajp70+l3BcjPl7yyYd+yUIp7wZh4l5na3U2nShr7phmEB4548G6St4O+ +OztDP5kA7kbfVzZmm+LYZ9JdW4FcsDXtYV0lxceXrb8r8jInK1BXqHuZpWbC73Fm73r 0wg8S9Kez8fIuso6ILaPElBa/7xkSEbThFTLQzBUlb5w23JhsqOdgWZ2n6jBbn+AJB0Y 4TfKEY003yrLv6Je/BJasx4QiumcgdGhJpWcuHlWb2jjn9ARqpI6/xVYwvJwIpEEB8vN Dxbw== X-Gm-Message-State: AMCzsaVoLmwpqZqgSawySMK9bCuqHz1uYDWWdxCklhO2OWdXh+VH4BUV eJ/bkDFTj8Hu0bwZQ1TFo70= X-Google-Smtp-Source: AOwi7QCVmlN06Q2mqpPcx5LBMIHaKqCLXvSPh4MiFjre8tI9k42YSBhrJrHcj9DMVW0nJKQUMaqtKw== X-Received: by 10.99.114.92 with SMTP id c28mr10077285pgn.342.1507576735652; Mon, 09 Oct 2017 12:18:55 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id n29sm17039819pgf.44.2017.10.09.12.18.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 12:18:55 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Subject: [PATCH v2 00/11] fscrypt: add some higher-level helper functions Date: Mon, 9 Oct 2017 12:15:33 -0700 Message-Id: <20171009191544.43656-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.14.2.920.gcf0c67979c-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171009_121916_959102_CAB619E3 X-CRM114-Status: GOOD ( 14.94 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c00:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ebiggers3[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ebiggers3[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Biggers , linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Eric Biggers This series prepares to reduce code duplication among ext4, f2fs, and ubifs by introducing a S_ENCRYPTED inode flag (so we don't have to call back into the filesystem to test the filesystem-specific inode flag), then introducing new helper functions that are called at the beginning of the open, link, rename, lookup, and setattr operations. In the future we maybe should even call these new helpers from the VFS so that each individual filesystem doesn't have to do it. But that's not possible currently because fs/crypto/ can be built as a module. The patches to switch the filesystems over to use the helper functions were included in v1 of this patchset. They are not included now since I'm planning to get them picked up by the individual filesystem maintainers after this goes in. Changes since v1: - Added Dave Chinner's patch to make fscrypt.h include fscrypt_supp.h or fscrypt_notsupp.h, then reorganized the helpers so that most are defined in fscrypt.h. - As noted above, for now omitted the patches to switch the individual filesystems over to the new helpers. Dave Chinner (1): fscrypt: clean up include file mess Eric Biggers (10): fs, fscrypt: add an S_ENCRYPTED inode flag fscrypt: switch from ->is_encrypted() to IS_ENCRYPTED() fscrypt: remove ->is_encrypted() fscrypt: remove unneeded empty fscrypt_operations structs fscrypt: new helper function - fscrypt_require_key() fscrypt: new helper function - fscrypt_file_open() fscrypt: new helper function - fscrypt_prepare_link() fscrypt: new helper function - fscrypt_prepare_rename() fscrypt: new helper function - fscrypt_prepare_lookup() fscrypt: new helper function - fscrypt_prepare_setattr() fs/crypto/Makefile | 2 +- fs/crypto/crypto.c | 2 +- fs/crypto/fname.c | 3 +- fs/crypto/fscrypt_private.h | 3 +- fs/crypto/hooks.c | 112 +++++++++++++++ fs/crypto/keyinfo.c | 2 +- fs/crypto/policy.c | 6 +- fs/ext4/ext4.h | 8 +- fs/ext4/inode.c | 7 +- fs/ext4/super.c | 15 +- fs/f2fs/f2fs.h | 9 +- fs/f2fs/inode.c | 5 +- fs/f2fs/super.c | 7 +- fs/ubifs/crypto.c | 1 - fs/ubifs/ioctl.c | 5 +- fs/ubifs/super.c | 8 +- fs/ubifs/ubifs.h | 18 +-- fs/ubifs/xattr.c | 1 + include/linux/fs.h | 2 + include/linux/fscrypt.h | 293 ++++++++++++++++++++++++++++++++++++++++ include/linux/fscrypt_common.h | 141 ------------------- include/linux/fscrypt_notsupp.h | 39 +++++- include/linux/fscrypt_supp.h | 17 ++- 23 files changed, 505 insertions(+), 201 deletions(-) create mode 100644 fs/crypto/hooks.c create mode 100644 include/linux/fscrypt.h delete mode 100644 include/linux/fscrypt_common.h