Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816600/?format=api
{ "id": 816600, "url": "http://patchwork.ozlabs.org/api/patches/816600/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-11-ebiggers3@gmail.com/", "project": { "id": 3, "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api", "name": "Linux MTD development", "link_name": "linux-mtd", "list_id": "linux-mtd.lists.infradead.org", "list_email": "linux-mtd@lists.infradead.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170920224605.22030-11-ebiggers3@gmail.com>", "list_archive_url": null, "date": "2017-09-20T22:45:50", "name": "[10/25] fscrypt: new helper function - fscrypt_prepare_setattr()", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "144c4b019d578b82ebd336e99e69983ad9a785f8", "submitter": { "id": 65202, "url": "http://patchwork.ozlabs.org/api/people/65202/?format=api", "name": "Eric Biggers", "email": "ebiggers3@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-11-ebiggers3@gmail.com/mbox/", "series": [ { "id": 4250, "url": "http://patchwork.ozlabs.org/api/series/4250/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=4250", "date": "2017-09-20T22:45:45", "name": "fscrypt: add some higher-level helper functions", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4250/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816600/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816600/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"KWB1+OIf\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"rnHWdruK\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GLyIydD1\"; dkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyFxJ4n8Rz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 09:16:36 +1000 (AEST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1duoEG-00037i-Sx; Wed, 20 Sep 2017 23:16:28 +0000", "from casper.infradead.org ([2001:8b0:10b:1236::1])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1duoAs-0006j8-HI\n\tfor linux-mtd@bombadil.infradead.org; Wed, 20 Sep 2017 23:12:58 +0000", "from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242])\n\tby casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dunm8-0004se-C7\n\tfor linux-mtd@lists.infradead.org; Wed, 20 Sep 2017 22:47:25 +0000", "by mail-pg0-x242.google.com with SMTP id i130so2381408pgc.0\n\tfor <linux-mtd@lists.infradead.org>;\n\tWed, 20 Sep 2017 15:47:03 -0700 (PDT)", "from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81])\n\tby smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.47.01\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Sep 2017 15:47:01 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:\n\tIn-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=xEwzjuRRucmk19CNuOrjZ1kRSSMMwEs2HQrKZiU4gLg=;\n\tb=KWB1+OIfs7rWJFq4lzpK/KQPGg\n\t8pPkRGW3Eo2cYYaFQliq7XQUEwJcAeHQ5rojegznCA53nR41vIIOZy2cYtvOxEmhbiho8m2W0Hmhr\n\ty2RplhtKUK3h+3CZK9B7LPGZgFsNUsKMcVar3JFtAGRpfezicCnaopFvcRF2a6se8gjzXXdIDkb0P\n\tQOyIo1nlUtOjbk92YzWjY0OyN6/8Wt07enNfRbR2Rq293LM+45EODqLrsPg+f9h8CCNq1mQ9w9wxi\n\t4bmtbohdgUbKFpACN4gvAKCoY6DhgIHg60nP2pxEljkPPQ3AMliT9WKkys3qJ63OiOaontkM2oKW7\n\tYzOIqU7A==;", "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=casper.20170209;\n\th=References:In-Reply-To:Message-Id:Date:\n\tSubject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:\n\tList-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=CXOIAKtWON/V/TY53npXTAfo3/xiUczbtICqD1BkKUE=;\n\tb=rnHWdruK7jnxjMj+zYS6dxBKy\n\ttSX632FSSaW+AYbXUzxeKZZSTjaFNK5BCCTnta1QyLZBiSo8KbcxUjCvFtvMkFGnkDJB6RdhpXLdb\n\tuKNWi+F1Mxihpg6v0ZM+gjI2NBCKlZLF+wHvdpgIKKjXmmvaLI4BvNBZIac93lNgy/wFYobzJfo0v\n\tTDQSKxDtSXp8FKzDWCiomAv2/1HuYYBhAWSygaw0YAKNIsJQuX1DffnVfvKpnXZpLDtVI293PP48S\n\t6lDteJ4GcGlK0tbytK7xFbjguIirfwNOj2yXxybbLYM9T2+wo9kEUO2RHipnwwgBQRzBUqm/5iX8m\n\to8v7azlpw==;", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=CXOIAKtWON/V/TY53npXTAfo3/xiUczbtICqD1BkKUE=;\n\tb=GLyIydD1lNvj2+I4MU5s2IxOd+DPck3Z3BMuZ1tctVMoIFjOJeb3ZOn9YedrRFNA/D\n\tCwJoc4xiiRhoPdLX7TmZ9JLRPwDGzJg7xHhwJ96j34jchFA0JCmv8jRYSKq0YlmA0a0P\n\tpiQMi/2p+l59t/K38IFB/Yfn8Pqi43DY45cTnnZBuRfbJT15c7XYoN+xkT5UPPBD4tCt\n\tbDVBoqzZFdEBhZ3FK/koHWHpJjGMAjNtZqVbl3CTmXYHzZ+GxOf3dW5HKAb0bOrhSnu2\n\t6ascTFV7m3A/J3qusNd2sTmI8GUJk3v0EGRXB4CIePRaMAkJasFjsZ3qwonXa7YP9p3J\n\tQLTQ==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=CXOIAKtWON/V/TY53npXTAfo3/xiUczbtICqD1BkKUE=;\n\tb=Yd8EcFN0yBf/vjmCh0jc1jR+seotqX1JqZFCJhMtFS8kuYplKB1sET44p2CQB/TnTf\n\t8mjZlk+RXPMo6kr5M3thZ9h0olBbTWwO04QXvD7cKChkQge5J5z1Wt04iQPAIpXUs3gr\n\t8HXbF7KiRTiwkLKtikRCHONuPB1pmt/4kockWeXUHYewWphYQSWSa/6WCizeM702XLdX\n\tcxdIu7tABm7zmvRmxhAA/0+u28FI2J+Tl2M42BQBMDtJ6Dbb0guEjZyt4OPmwbGQ6bjA\n\t8fZ6TeZHx9LuX3LqV7XebL4Ziumh4WpNlaC0EnrEbgP5Fj4EuJKvnfGXYBYLR2ZJF2uL\n\td5ew==", "X-Gm-Message-State": "AHPjjUh7zT2BhDwkF3JzivQgvyKEqhmGNnpeKve3GYz2eLNyaocvauZZ\n\tZvzj+bjB9DRkPwMWGwPzd0w=", "X-Google-Smtp-Source": "AOwi7QB31rzc3THPqVCbTPvbx8PuoattTFuqT5wSpHHJSIzN6IiXU/Gmde6i6mqJHP5qBcsH6CgMDw==", "X-Received": "by 10.99.53.206 with SMTP id c197mr3677053pga.440.1505947622479; \n\tWed, 20 Sep 2017 15:47:02 -0700 (PDT)", "From": "Eric Biggers <ebiggers3@gmail.com>", "To": "linux-fscrypt@vger.kernel.org", "Subject": "[PATCH 10/25] fscrypt: new helper function -\n\tfscrypt_prepare_setattr()", "Date": "Wed, 20 Sep 2017 15:45:50 -0700", "Message-Id": "<20170920224605.22030-11-ebiggers3@gmail.com>", "X-Mailer": "git-send-email 2.14.1.821.g8fa685d3b7-goog", "In-Reply-To": "<20170920224605.22030-1-ebiggers3@gmail.com>", "References": "<20170920224605.22030-1-ebiggers3@gmail.com>", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20170920_234724_549570_D151D190 ", "X-CRM114-Status": "GOOD ( 16.72 )", "X-Spam-Score": "-1.8 (-)", "X-Spam-Report": "SpamAssassin version 3.4.1 on casper.infradead.org summary:\n\tContent analysis details: (-1.8 points, 5.0 required)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2607:f8b0:400e:c05:0:0:0:242 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS SPF: sender matches SPF record\n\t0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends\n\tin digit (ebiggers3[at]gmail.com)\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (ebiggers3[at]gmail.com)\n\t-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain\n\t0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature", "X-BeenThere": "linux-mtd@lists.infradead.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>", "List-Post": "<mailto:linux-mtd@lists.infradead.org>", "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>", "Cc": "\"Theodore Y . Ts'o\" <tytso@mit.edu>, Eric Biggers <ebiggers@google.com>, \n\tMichael Halcrow <mhalcrow@google.com>,\n\tlinux-f2fs-devel@lists.sourceforge.net, \n\tlinux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org,\n\tJaegeuk Kim <jaegeuk@kernel.org>, linux-ext4@vger.kernel.org", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>", "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "From: Eric Biggers <ebiggers@google.com>\n\nIntroduce a helper function for filesystems to call when processing\n->setattr() on a possibly-encrypted inode. It handles enforcing that an\nencrypted file can only be truncated if its encryption key is available.\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\n---\n include/linux/fscrypt_notsupp.h | 8 ++++++++\n include/linux/fscrypt_supp.h | 25 +++++++++++++++++++++++++\n 2 files changed, 33 insertions(+)", "diff": "diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h\nindex e9b437605f9c..b0dd2d1756b2 100644\n--- a/include/linux/fscrypt_notsupp.h\n+++ b/include/linux/fscrypt_notsupp.h\n@@ -218,4 +218,12 @@ static inline int fscrypt_prepare_lookup(struct inode *dir,\n \treturn 0;\n }\n \n+static inline int fscrypt_prepare_setattr(struct dentry *dentry,\n+\t\t\t\t\t struct iattr *attr)\n+{\n+\tif (IS_ENCRYPTED(d_inode(dentry)) && (attr->ia_valid & ATTR_SIZE))\n+\t\treturn -EOPNOTSUPP;\n+\treturn 0;\n+}\n+\n #endif\t/* _LINUX_FSCRYPT_NOTSUPP_H */\ndiff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h\nindex 2b99bc01c59b..bdd01e02435b 100644\n--- a/include/linux/fscrypt_supp.h\n+++ b/include/linux/fscrypt_supp.h\n@@ -270,4 +270,29 @@ static inline int fscrypt_prepare_lookup(struct inode *dir,\n \treturn 0;\n }\n \n+/**\n+ * fscrypt_prepare_setattr - prepare to change a possibly-encrypted inode's attributes\n+ * @dentry: dentry through which the inode is being changed\n+ * @attr: attributes to change\n+ *\n+ * Prepare for ->setattr() on a possibly-encrypted inode. On an encrypted file,\n+ * most attribute changes are allowed even without the encryption key. However,\n+ * without the encryption key we do have to forbid truncates. This is needed\n+ * because the size being truncated to may not be a multiple of the filesystem\n+ * block size, and in that case we'd have to decrypt the final block, zero the\n+ * portion past i_size, and re-encrypt it. (We *could* allow truncating to a\n+ * filesystem block boundary, but it's simpler to just forbid all truncates ---\n+ * and we already forbid all other contents modifications without the key.)\n+ *\n+ * Return: 0 on success, -ENOKEY if the key is missing, or another -errno code\n+ * if a problem occurred while setting up the encryption key.\n+ */\n+static inline int fscrypt_prepare_setattr(struct dentry *dentry,\n+\t\t\t\t\t struct iattr *attr)\n+{\n+\tif (IS_ENCRYPTED(d_inode(dentry)) && (attr->ia_valid & ATTR_SIZE))\n+\t\treturn fscrypt_require_key(d_inode(dentry));\n+\treturn 0;\n+}\n+\n #endif\t/* _LINUX_FSCRYPT_SUPP_H */\n", "prefixes": [ "10/25" ] }