Linux Security Modules development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2] keys: fix crash on big_key read or revoke after a failed update
Date: Tue, 24 Nov 2026 03:03:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-230434@kernel.org> (raw)
In-Reply-To: <20261124025759.39344-1-bsdhenrymartin@gmail.com>

> big_key_update() reserves quota with the raw payload length and then
> destroys the old payload before instantiating the new one.  For a payload
> of N < 16 bytes that reserve releases 16-N bytes, so the reserve of 16
> done by generic_key_instantiate() charges them again and can fail with
> -EDQUOT once the payload is already destroyed.  big_key_destroy() keeps
> payload->length but clears path and data, so the key stays positive with
> a stale length that KEYCTL_READ and KEYCTL_REVOKE then follow:
> 
> kernel BUG at fs/open.c:1145!
> Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
> RIP: 0010:dentry_open+0x7b/0x90
>  big_key_read+0x141/0x280
> 
> Instantiate the new payload first and destroy the old one only on success;
> a positive key's reservation is already 16 bytes, so it cannot fail.
> 
> This issue was discovered by Tencent CodeBuddy Security.
> Cc: stable@vger.kernel.org
> Fixes: b6f61c314649 ("keys: Implement update for the big_key type")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124025759.39344-1-bsdhenrymartin@gmail.com?part=1

      reply	other threads:[~2026-11-24  3:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  2:57 [PATCH v2] keys: fix crash on big_key read or revoke after a failed update Henry Martin
2026-11-24  3:03 ` sashiko-bot [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=sashiko-outbox-230434@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