Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816566/?format=api
{ "id": 816566, "url": "http://patchwork.ozlabs.org/api/patches/816566/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20170920224605.22030-11-ebiggers3@gmail.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.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": true, "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-ext4/patch/20170920224605.22030-11-ebiggers3@gmail.com/mbox/", "series": [ { "id": 4249, "url": "http://patchwork.ozlabs.org/api/series/4249/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=4249", "date": "2017-09-20T22:45:40", "name": "fscrypt: add some higher-level helper functions", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4249/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816566/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816566/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-ext4-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GLyIydD1\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyFL572VPz9sPk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 08:49:33 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752112AbdITWt1 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 18:49:27 -0400", "from mail-pg0-f66.google.com ([74.125.83.66]:34714 \"EHLO\n\tmail-pg0-f66.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751931AbdITWrD (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Wed, 20 Sep 2017 18:47:03 -0400", "by mail-pg0-f66.google.com with SMTP id u18so2378867pgo.1;\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; c=relaxed/relaxed;\n\td=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=hlAkalL0ONHlrDqVm7EPHlA+usmgbRbzz1BwEDozitvDf7KnBu2Bq+520XrRInNrp9\n\tYPuUSZI+KrHq0RtbGdfaCgMMtQ1hGf6pyNJ5m6U78e8U21d6f7KP/nByb8hZm4l5HaNb\n\twSFbH5AcLbm1QZyaaXi3A8wg/yKBJrtIKAs2OiUYDgj6X3+vLOmQPXSHyHlm2mPBfZdF\n\tuf1gpVcdW4mpbjodX0oS2uBXg3jKnwGx4g2Dpk2YYO8kvw7bYMzzUyPD4XjD7r6PgS/Y\n\t2KR0SR7rt1E4q8h1nnpB5P4KA12vwTUsI50IOZw5iWEYuLbCaZOj5AmRzuqVxiXOQ9ee\n\tPXNg==", "X-Gm-Message-State": "AHPjjUjz6p8xQClkVOKg6eZg0sgPm04sOar5SItcUk3rvEl+w9Kfrc95\n\tP/Boxe1FjNmkAg+zEUmZAi12RRSEUOQ=", "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", "Cc": "linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-mtd@lists.infradead.org, \"Theodore Y . Ts'o\" <tytso@mit.edu>,\n\tJaegeuk Kim <jaegeuk@kernel.org>, Michael Halcrow <mhalcrow@google.com>,\n\tEric Biggers <ebiggers@google.com>", "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>", "Sender": "linux-ext4-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-ext4.vger.kernel.org>", "X-Mailing-List": "linux-ext4@vger.kernel.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" ] }