From: Thorsten Blum <blum@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>, Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH RESEND] arm64: patching: Annotate text_addrs, new_insns with __counted_by_ptr()
Date: Tue, 24 Nov 2026 18:43:54 +0100 [thread overview]
Message-ID: <awXM2h0A4UsEQ3go@kernel.org> (raw)
In-Reply-To: <awV_Wn0PivLnU2wp@arm.com>
On Tue, Nov 24, 2026 at 12:13:14PM +0000, Catalin Marinas wrote:
> On Wed, Nov 11, 2026 at 05:45:14PM +0100, Thorsten Blum wrote:
> > Add __counted_by_ptr() to aarch64_insn_patch::text_addrs and
> > aarch64_insn_patch::new_insns to enable access bounds checking via
> > CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
> [...]
> > struct aarch64_insn_patch {
> > - void **text_addrs;
> > - u32 *new_insns;
> > + void **text_addrs __counted_by_ptr(insn_cnt);
> > + u32 *new_insns __counted_by_ptr(insn_cnt);
>
> I'm not sure it buys us anything. The only accesses to these arrays are
> in aarch64_insn_patch_text_cb() in a loop already bounded by
> pp->insn_cnt. UBSAN just repeats the loop condition. There's no
> mem*/str* use of these pointers either, so FORTIFY_SOURCE doesn't
> matter.
>
> The annotation can't catch a wrong count from the caller since insn_cnt
> is taken directly from the cnt argument of aarch64_insn_patch_text().
>
> So, I don't think this patch is needed.
Fair points. It was meant as a hardening change to prevent future errors
and document the relationship, but since nothing is gained today, I'm
happy to drop it.
Thanks,
Thorsten
prev parent reply other threads:[~2026-11-24 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 16:45 [PATCH RESEND] arm64: patching: Annotate text_addrs, new_insns with __counted_by_ptr() Thorsten Blum
2026-11-24 12:13 ` Catalin Marinas
2026-11-24 17:43 ` Thorsten Blum [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=awXM2h0A4UsEQ3go@kernel.org \
--to=blum@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@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 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.