From: Baokun Li <libaokun@linux.alibaba.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fscrypt@vger.kernel.org, tytso@mit.edu, jaegeuk@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v3] fscrypt: Fix missing barrier in fscrypt_find_mode_key()
Date: Sat, 24 Oct 2026 17:53:07 +0800 [thread overview]
Message-ID: <d9bca9b2-e051-4c06-93eb-255d5e33844d@linux.alibaba.com> (raw)
In-Reply-To: <20261023193821.GA3091192@google.com>
On 2026/10/24 03:38, Eric Biggers wrote:
> On Sat, Oct 24, 2026 at 12:07:47AM +0800, Baokun Li wrote:
>> dm-inlinecrypt reaches its key only through srcu_dereference(md->map),
>> with no acquire anywhere on the I/O path.
>
> The above seems like a stray sentence that should be deleted.
>
Okay.
>> Suggested-by: Eric Biggers <ebiggers@kernel.org>
>> Link: https://patch.msgid.link/20261014161153.GC322435@quark
>
> Nit: lore.kernel.org instead of patch.msgid.link, since it links to a
> discussion (in response to a patch) rather than directly to a patch.
>
That makes sense; I hadn't noticed that difference before.
>> diff --git a/fs/crypto/keysetup.c b/fs/crypto/keysetup.c
>> index 892044ebcaca..984ef43982a3 100644
>> --- a/fs/crypto/keysetup.c
>> +++ b/fs/crypto/keysetup.c
>> @@ -205,8 +205,14 @@ fscrypt_find_mode_key(struct fscrypt_master_key *mk, u8 hkdf_context,
>> if (node->hkdf_context == hkdf_context &&
>> node->mode_num == mode_num &&
>> node->data_unit_bits == ci->ci_data_unit_bits &&
>> - fscrypt_is_key_prepared(&node->key, ci))
>> + fscrypt_is_key_prepared(&node->key, ci)) {
>> + /*
>> + * Pairs with list_add_tail_rcu() in
>> + * setup_per_mode_enc_key().
>> + */
>> + smp_acquire__after_ctrl_dep();
>> return &node->key;
>> + }
>> }
>
> I think a better comment would be:
>
> /*
> * Upgrade the RCU dereference to a full ACQUIRE, so
> * that blk-crypto global state is seen as initialized.
> */
>
> That helps convey why the pre-existing RCU dereference isn't enough.
>
Yeah, that looks much clearer.
> Other than that this patch looks good. I can fix all the above when
> applying, if you agree, or you can just resend. Thanks!
>
Thank you for your review!
I'll send v2 right away.
Cheers,
Baokun
prev parent reply other threads:[~2026-10-24 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 16:07 [PATCH v3] fscrypt: Fix missing barrier in fscrypt_find_mode_key() Baokun Li
2026-10-23 19:38 ` Eric Biggers
2026-10-24 9:53 ` Baokun Li [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=d9bca9b2-e051-4c06-93eb-255d5e33844d@linux.alibaba.com \
--to=libaokun@linux.alibaba.com \
--cc=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.