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] certs: x509: duplicate cert->tbs when sig->algo_takes_data is set
Date: Sun, 20 Sep 2026 23:59:30 +0000	[thread overview]
Message-ID: <20260920235931.4613F1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260920235249.260530-1-benquike@gmail.com>

> In x509_get_sig_params(), when sig->algo_takes_data is true, sig->m is
> assigned (u8 *)cert->tbs with sig->m_free = false. However, cert->tbs
> points into the temporary ASN.1 buffer (prep->data) passed to
> x509_cert_parse(), while cert->sig is retained in
> prep->payload.data[asym_auth] by x509_key_preparse() after prep->data
> is freed by the caller. Subsequent signature verification on the key's
> public_key_signature dereferences the freed TBS buffer.
> 
> Duplicate cert->tbs with kmemdup() and set sig->m_free = true so sig->m
> remains valid for the lifetime of struct public_key_signature.
> 
> Tested in QEMU against Linux 7.3.0-rc3 with KASAN enabled by adding an
> ML-DSA-44 (OID 2.16.840.1.101.3.4.3.17) X.509 certificate via
> add_key("asymmetric", ...) and linking it into a signature-restricted
> keyring via keyctl(KEYCTL_LINK), which triggers the following KASAN
> [ ... ]
> 
> Fixes: f3eccecd782d ("pkcs7: Allow the signing algo to do whatever digestion it wants itself")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

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


  reply	other threads:[~2026-09-20 23:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 22:34 [PATCH] netlabel: calipso, x509: clean up ADDRSELECT on DOI removal and check AKID len Hui Peng
2026-09-20  1:21 ` Paul Moore
2026-09-20 23:52   ` [PATCH v2] certs: x509: duplicate cert->tbs when sig->algo_takes_data is set Hui Peng
2026-09-20 23:59     ` sashiko-bot [this message]
2026-09-25 15:50     ` Ignat Korchagin
2026-09-20 22:34 ` [PATCH] netlabel: calipso, x509: clean up ADDRSELECT on DOI removal and check AKID len sashiko-bot

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=20260920235931.4613F1F000FF@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