From: Eric Biggers <ebiggers@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
kernel-team@android.com,
Gaurav Kashyap <quic_gaurkash@quicinc.com>,
Israel Rukshin <israelr@nvidia.com>
Subject: Re: [PATCH v5 3/3] fscrypt: add support for hardware-wrapped keys
Date: Thu, 10 Mar 2022 21:18:42 -0800 [thread overview]
Message-ID: <YirbspMr5CAnlWAC@sol.localdomain> (raw)
In-Reply-To: <c1da8aec-7bb9-dd88-7500-a09d29bbc1e4@acm.org>
On Thu, Mar 03, 2022 at 05:03:10PM -0800, Bart Van Assche wrote:
> On 2/27/22 23:05, Eric Biggers wrote:
> > diff --git a/include/uapi/linux/fscrypt.h b/include/uapi/linux/fscrypt.h
> > index 9f4428be3e362..884c5bf526a05 100644
> > --- a/include/uapi/linux/fscrypt.h
> > +++ b/include/uapi/linux/fscrypt.h
> > @@ -20,6 +20,7 @@
> > #define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04
> > #define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 0x08
> > #define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
> > +#define FSCRYPT_POLICY_FLAG_HW_WRAPPED_KEY 0x20
> > /* Encryption algorithms */
> > #define FSCRYPT_MODE_AES_256_XTS 1
> > @@ -115,7 +116,7 @@ struct fscrypt_key_specifier {
> > */
> > struct fscrypt_provisioning_key_payload {
> > __u32 type;
> > - __u32 __reserved;
> > + __u32 flags;
> > __u8 raw[];
> > };
> > @@ -124,7 +125,9 @@ struct fscrypt_add_key_arg {
> > struct fscrypt_key_specifier key_spec;
> > __u32 raw_size;
> > __u32 key_id;
> > - __u32 __reserved[8];
> > +#define FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED 0x00000001
> > + __u32 flags;
> > + __u32 __reserved[7];
> > __u8 raw[];
> > };
>
> Is it allowed to use _Static_assert() in UAPI header files? There are
> already some static_assert() checks under include/linux to verify the size
> of certain data structures. gcc supports _Static_assert() since version 4.6.
> That is older than the minimum required gcc version to build the kernel.
>
Are you requesting static assertions that verify that the size of each fscrypt
UAPI struct is a certain value? Kernel UAPIs generally don't bother with that
sort of thing, but it does seem like a good idea. I'll add them as a cleanup,
but it's orthogonal to this patch series.
To answer your direct question, I believe that _Static_assert generally can't be
used in UAPI header files, as it's a C11 feature and UAPI headers are included
by arbitrary userspace programs. These assertions will need to be in
kernel-only code, either in a kernel-only file such as include/linux/fscrypt.h,
or in an #ifdef __KERNEL__ section of the UAPI header. Also, the kernel already
conventionally uses BUILD_BUG_ON() for static assertions.
- Eric
prev parent reply other threads:[~2022-03-11 5:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 7:05 [PATCH v5 0/3] Support for hardware-wrapped inline encryption keys Eric Biggers
2022-02-28 7:05 ` [PATCH v5 1/3] block: add basic hardware-wrapped key support Eric Biggers
2022-03-04 0:53 ` Bart Van Assche
2022-03-04 1:07 ` Eric Biggers
2022-02-28 7:05 ` [PATCH v5 2/3] block: add ioctls to create and prepare hardware-wrapped keys Eric Biggers
2022-03-04 0:57 ` Bart Van Assche
2022-02-28 7:05 ` [PATCH v5 3/3] fscrypt: add support for " Eric Biggers
2022-03-04 1:03 ` Bart Van Assche
2022-03-11 5:18 ` Eric Biggers [this message]
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=YirbspMr5CAnlWAC@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=bvanassche@acm.org \
--cc=israelr@nvidia.com \
--cc=kernel-team@android.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=quic_gaurkash@quicinc.com \
/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