From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v3 1/2] keys: Protect key_user lifetime during ownership changes
Date: Sun, 27 Sep 2026 16:36:10 +0000 [thread overview]
Message-ID: <20260927163611.1007C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927162528.943886-2-nicoyip.dev@gmail.com>
> keyctl_chown_key() replaces key->user under key->sem and drops the
> reference to the previous owner after releasing the semaphore. Readers
> which do not hold that semaphore can still be using the previous owner
> when key_user_put() frees it.
>
> For example, namespace filtering in /proc/keys can race with chown:
>
> /proc/keys reader keyctl_chown_key()
> user = key->user
> key->user = newowner
> key_user_put(old)
> kfree(old)
> read user->uid
>
> An earlier instrumented run reported:
> [ ... ]
> outside the new critical sections for the separate accounting fix.
>
> Fixes: 5801649d8b83 ("[PATCH] keys: let keyctl_chown() change a key's owner")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927162528.943886-1-nicoyip.dev@gmail.com?part=1
next prev parent reply other threads:[~2026-09-27 16:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 16:25 [PATCH v3 0/2] keys: Fix ownership lifetime and accounting races Chengfeng Ye
2026-09-27 16:25 ` [PATCH v3 1/2] keys: Protect key_user lifetime during ownership changes Chengfeng Ye
2026-09-27 16:36 ` sashiko-bot [this message]
2026-09-29 21:19 ` Jarkko Sakkinen
2026-10-05 0:58 ` Jarkko Sakkinen
2026-09-27 16:25 ` [PATCH v3 2/2] keys: Serialize ownership transfers with key accounting Chengfeng Ye
2026-09-27 16:33 ` sashiko-bot
2026-09-29 21:20 ` Jarkko Sakkinen
2026-10-05 2:17 ` Jarkko Sakkinen
2026-10-05 2:49 ` Jarkko Sakkinen
2026-10-05 5:53 ` Chengfeng Ye
2026-10-05 6:39 ` Jarkko Sakkinen
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=20260927163611.1007C1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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