From: sashiko-bot@kernel.org
To: "Gu Bowen" <gubowen5@huawei.com>,
"David Howells" <dhowells@redhat.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Ignat Korchagin" <ignat@linux.win>,
"Herbert Xu" <herbert@gondor.apana.org.au>
Cc: kexec@lists.infradead.org, lujialin4@huawei.com
Subject: Re: [PATCH -next] crypto: asymmetric_keys: verify_pefile: fix integer underflow in pefile_strip_sig_wrapper
Date: Mon, 02 Nov 2026 07:38:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-193032@kernel.org> (raw)
In-Reply-To: <20261102074934.2925339-1-gubowen5@huawei.com>
> The pefile_strip_sig_wrapper() function validates the win_certificate
> wrapper that precedes the PKCS#7 signature in a PE binary. It checks
> that the wrapper length does not exceed the certificate table size
> (``wrapper.length > ctx->sig_len``) but fails to verify that the
> wrapper length is at least ``sizeof(struct win_certificate)`` (8 bytes).
>
> When a crafted PE image supplies a wrapper with ``length`` in the range
> [1, 7], the subsequent arithmetic::
>
> ctx->sig_len = wrapper.length; /* e.g. 1 */
> ctx->sig_offset += sizeof(wrapper);
> ctx->sig_len -= sizeof(wrapper); /* 1 - 8 = 0xFFFFFFF9 (unsigned) */
>
> underflows the unsigned ``ctx->sig_len`` to a value near UINT_MAX. The
> following ``sig_len < 4`` sanity check is bypassed because 0xFFFFFFF9 is
> [ ... ]
> prevent the underflow.
>
> Fixes: 09dacbbda935 ("pefile: Strip the wrapper off of the cert data block")
> Cc: stable@vger.kernel.org
> Signed-off-by: Gu Bowen <gubowen5@huawei.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102074934.2925339-1-gubowen5@huawei.com?part=1
next prev parent reply other threads:[~2026-11-02 7:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 7:49 [PATCH -next] crypto: asymmetric_keys: verify_pefile: fix integer underflow in pefile_strip_sig_wrapper Gu Bowen
2026-11-02 7:38 ` sashiko-bot [this message]
2026-11-02 20:49 ` Ignat Korchagin
2026-11-03 2:39 ` Gu Bowen
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-193032@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dhowells@redhat.com \
--cc=gubowen5@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@linux.win \
--cc=kexec@lists.infradead.org \
--cc=lujialin4@huawei.com \
--cc=lukas@wunner.de \
--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 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.