From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: Daniel Rosenberg <drosen@google.com>,
Jeff Layton <jlayton@kernel.org>,
linux-f2fs-devel@lists.sourceforge.net,
linux-mtd@lists.infradead.org, ceph-devel@vger.kernel.org,
linux-ext4@vger.kernel.org
Subject: [f2fs-dev] [PATCH v2 09/11] fscrypt: make "#define fscrypt_policy" user-only
Date: Sun, 13 Sep 2020 01:36:18 -0700 [thread overview]
Message-ID: <20200913083620.170627-10-ebiggers@kernel.org> (raw)
In-Reply-To: <20200913083620.170627-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
The fscrypt UAPI header defines fscrypt_policy to fscrypt_policy_v1,
for source compatibility with old userspace programs.
Internally, the kernel doesn't want that compatibility definition.
Instead, fscrypt_private.h #undefs it and re-defines it to a union.
That works for now. However, in order to add
fscrypt_operations::get_dummy_policy(), we'll need to forward declare
'union fscrypt_policy' in include/linux/fscrypt.h. That would cause
build errors because "fscrypt_policy" is used in ioctl numbers.
To avoid this, modify the UAPI header to make the fscrypt_policy
compatibility definition conditional on !__KERNEL__, and make the ioctls
use fscrypt_policy_v1 instead of fscrypt_policy.
Note that this doesn't change the actual ioctl numbers.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/crypto/fscrypt_private.h | 1 -
include/uapi/linux/fscrypt.h | 6 +++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
index 355f6d9377517..ac3352086ee44 100644
--- a/fs/crypto/fscrypt_private.h
+++ b/fs/crypto/fscrypt_private.h
@@ -97,7 +97,6 @@ static inline const u8 *fscrypt_context_nonce(const union fscrypt_context *ctx)
return NULL;
}
-#undef fscrypt_policy
union fscrypt_policy {
u8 version;
struct fscrypt_policy_v1 v1;
diff --git a/include/uapi/linux/fscrypt.h b/include/uapi/linux/fscrypt.h
index 7875709ccfebf..e5de603369381 100644
--- a/include/uapi/linux/fscrypt.h
+++ b/include/uapi/linux/fscrypt.h
@@ -45,7 +45,6 @@ struct fscrypt_policy_v1 {
__u8 flags;
__u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
};
-#define fscrypt_policy fscrypt_policy_v1
/*
* Process-subscribed "logon" key description prefix and payload format.
@@ -156,9 +155,9 @@ struct fscrypt_get_key_status_arg {
__u32 __out_reserved[13];
};
-#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy)
+#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy_v1)
#define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
-#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy)
+#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy_v1)
#define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */
#define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg)
#define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
@@ -170,6 +169,7 @@ struct fscrypt_get_key_status_arg {
/* old names; don't add anything new here! */
#ifndef __KERNEL__
+#define fscrypt_policy fscrypt_policy_v1
#define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE
#define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4
#define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8
--
2.28.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2020-09-13 8:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 8:36 [f2fs-dev] [PATCH v2 00/11] fscrypt: improve file creation flow Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 01/11] fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 02/11] ext4: factor out ext4_xattr_credits_for_new_inode() Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 03/11] ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context() Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 04/11] f2fs: " Eric Biggers
2020-09-14 17:26 ` Jaegeuk Kim
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 05/11] ubifs: " Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 06/11] fscrypt: remove fscrypt_inherit_context() Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 07/11] fscrypt: require that fscrypt_encrypt_symlink() already has key Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 08/11] fscrypt: stop pretending that key setup is nofs-safe Eric Biggers
2020-09-13 8:36 ` Eric Biggers [this message]
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 10/11] fscrypt: move fscrypt_prepare_symlink() out-of-line Eric Biggers
2020-09-13 8:36 ` [f2fs-dev] [PATCH v2 11/11] fscrypt: handle test_dummy_encryption in more logical way Eric Biggers
2020-09-14 17:31 ` Jaegeuk Kim
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=20200913083620.170627-10-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=drosen@google.com \
--cc=jlayton@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).