From: Jarkko Sakkinen <jarkko@kernel.org>
To: adrimg3196@gmail.com
Cc: linux-kernel@vger.kernel.org, keyrings@vger.kernel.org,
dhowells@redhat.com
Subject: Re: [PATCH] KEYS: Fix key_reject_and_link() race with keyring restriction
Date: Thu, 8 Oct 2026 20:58:47 +0300 [thread overview]
Message-ID: <asfZ176MFPXkUIGq@kernel.org> (raw)
In-Reply-To: <CACO1+RSZuymnONwwmmRj=2ji=hNP4MTyOZOPKvR-Rr1OXQtJ0A@mail.gmail.com>
On Thu, Oct 08, 2026 at 03:51:32AM -0700, adrimg3196@gmail.com wrote:
> The restrict_link check in key_reject_and_link() is done before taking
> the keyring semaphore, racing with a concurrent keyring_restrict()
> that installs the restriction while holding the semaphore in write
> mode.
>
> This is the same pattern that commit dd3ea3fc ("KEYS: Fix add_key()
> race with keyring restriction") just fixed in __key_create_or_update()
> by moving the restrict_link snapshot to after the semaphore is taken.
>
> Move the check under __key_link_lock() so a restriction installed
> concurrently cannot be bypassed when linking a negative key.
>
> Signed-off-by: Adrian Martinez <adrimg3196@gmail.com>
> ---
> security/keys/key.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
Something went wrong I guess? That's fine. I'm just pointing out
that there's no code change.
Br, Jarkko
prev parent reply other threads:[~2026-10-08 17:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 10:51 adrimg3196
2026-10-08 17:58 ` Jarkko Sakkinen [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=asfZ176MFPXkUIGq@kernel.org \
--to=jarkko@kernel.org \
--cc=adrimg3196@gmail.com \
--cc=dhowells@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®