From: sashiko-bot@kernel.org
To: "Dylan Hatch" <dylanbhatch@google.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Weinan Liu" <wnliu@google.com>,
"Jens Remus" <jremus@linux.ibm.com>,
linux-kbuild@vger.kernel.org, linux-crypto@vger.kernel.org,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Indu Bhagat" <ibhagatgnu@gmail.com>,
"Prasanna Kumar T S M" <ptsm@linux.microsoft.com>,
live-patching@vger.kernel.org
Subject: Re: [RFC PATCH 02/12] arm64: factor .eh_frame parser out of patch-scs.c into <asm/eh_frame.h>
Date: Wed, 18 Nov 2026 04:36:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-220105@kernel.org> (raw)
In-Reply-To: <20261117043504.1021063-3-dylanbhatch@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] arm64: integer underflow in CIE bounds check in
eh_frame_next_fde()
--
commit 0cead277c4697d2464f308f0fb23b8a3a16a0749
Author: Dylan Hatch <dylanbhatch@google.com>
arm64: factor .eh_frame parser out of patch-scs.c into <asm/eh_frame.h>
This commit moves the DWARF .eh_frame CIE/FDE iterator and opcode stepper
out of arch/arm64/kernel/pi/patch-scs.c into a shared <asm/eh_frame.h>
header.
> diff --git a/arch/arm64/include/asm/eh_frame.h b/arch/arm64/include/asm/eh_frame.h
> new file mode 100644
> index 0000000000000..6c17fed1860f1
> --- /dev/null
> +++ b/arch/arm64/include/asm/eh_frame.h
[ ... ]
> +static __always_inline int eh_frame_next_fde(struct eh_frame_fde_iter *it)
> +{
> + while (it->size > 4) {
> + const struct eh_frame *frame = (const void *)it->p;
> + const struct eh_frame *cie;
> + const u8 *cie_ptr;
> + size_t min_size;
> + int step, ret;
[ ... ]
> + cie_ptr = (const u8 *)&frame->cie_id_or_pointer;
> + if (frame->cie_id_or_pointer > (u32)(cie_ptr - it->start))
> + return EDYNSCS_INVALID_CIE_HEADER;
> +
> + cie = (const void *)(cie_ptr - frame->cie_id_or_pointer);
> + if (cie != it->cie) {
> + if (cie->cie_id_or_pointer != 0 ||
> + cie->size == 0 || cie->size == U32_MAX ||
> + cie->size > (u32)(cie_ptr - (const u8 *)cie -
> + sizeof(cie->size)))
> + return EDYNSCS_INVALID_CIE_HEADER;
> + ret = eh_frame_parse_cie(cie, it);
[Severity: Medium]
Can the cie->size bounds check in eh_frame_next_fde() underflow when
frame->cie_id_or_pointer is 1, 2, or 3?
Since cie is cie_ptr - frame->cie_id_or_pointer, the distance
cie_ptr - (const u8 *)cie equals frame->cie_id_or_pointer. Subtracting
sizeof(cie->size) (4) when frame->cie_id_or_pointer < 4 wraps to
0xfffffffd..0xffffffff, bypassing the upper-bound check on cie->size and
allowing eh_frame_parse_cie() to read past the end of a malformed
.eh_frame buffer.
Also, even when frame->cie_id_or_pointer >= 4, subtracting
sizeof(cie->size) from cie_ptr - (const u8 *)cie bounds the end of the CIE
against cie_ptr ((const u8 *)frame + 4) rather than (const u8 *)frame,
which allows the CIE to overlap frame->size.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117043504.1021063-1-dylanbhatch@google.com?part=2
next prev parent reply other threads:[~2026-11-18 4:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 4:34 [RFC PATCH 00/12] arm64, unwind: add .lr_unwind unwinder for reliable stacktrace Dylan Hatch
2026-11-17 4:34 ` [RFC PATCH 01/12] arm64, unwind: build with .eh_frame and add gen_lr_unwind skeleton Dylan Hatch
2026-11-18 4:36 ` sashiko-bot
2026-11-17 4:34 ` [RFC PATCH 02/12] arm64: factor .eh_frame parser out of patch-scs.c into <asm/eh_frame.h> Dylan Hatch
2026-11-18 4:36 ` sashiko-bot [this message]
2026-11-17 4:34 ` [RFC PATCH 03/12] arm64: eh_frame: track CFA and x29/x30 register state in CFI parser Dylan Hatch
2026-11-17 4:34 ` [RFC PATCH 04/12] arm64, unwind: parse .eh_frame into .lr_unwind entries in gen_lr_unwind Dylan Hatch
2026-11-17 4:34 ` [RFC PATCH 05/12] scripts/gen_lr_unwind: emit .lr_unwind_fde and .lr_unwind_ranges Dylan Hatch
2026-11-17 4:34 ` [RFC PATCH 06/12] scripts/gen_lr_unwind: add --dump option to inspect .lr_unwind tables Dylan Hatch
2026-11-17 4:34 ` [RFC PATCH 07/12] scripts/sorttable: sort .lr_unwind_fde by start_offset Dylan Hatch
2026-11-17 4:35 ` [RFC PATCH 08/12] arm64, unwind: add in-kernel .lr_unwind lookup and validation Dylan Hatch
2026-11-17 4:35 ` [RFC PATCH 09/12] arm64/module, unwind: add .lr_unwind support for modules Dylan Hatch
2026-11-17 4:35 ` [RFC PATCH 10/12] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-11-17 4:35 ` [RFC PATCH 11/12] arm64, crypto/lib: annotate leaf functions with CFI info Dylan Hatch
2026-11-17 4:35 ` [RFC PATCH 12/12] unwind: arm64: use .lr_unwind to unwind interrupt frames Dylan Hatch
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-220105@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=dylanbhatch@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=ibhagatgnu@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=jremus@linux.ibm.com \
--cc=justinstitt@google.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nsc@kernel.org \
--cc=ptsm@linux.microsoft.com \
--cc=rostedt@goodmis.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=will@kernel.org \
--cc=wnliu@google.com \
/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.