From: Joe Lawrence <joe.lawrence@redhat.com>
To: linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Naveen N Rao <naveen@kernel.org>
Subject: [PATCH v2 0/3] powerpc/ftrace: Fix livepatch module OOL ftrace corruption
Date: Fri, 12 Sep 2025 10:27:37 -0400 [thread overview]
Message-ID: <20250912142740.3581368-1-joe.lawrence@redhat.com> (raw)
This patch series fixes a couple of bugs in the powerpc64 out-of-line
(OOL) ftrace support for modules, and follows up with a patch to
simplify the module .stubs allocation code. An analysis of the module
stub area corruption that prompted this work can be found in the v1
thread [1].
The first two patches fix bugs introduced by commit eec37961a56a
("powerpc64/ftrace: Move ftrace sequence out of line"). The first,
suggested by Naveen, ensures that a NOP'd ftrace call site has its
ftrace_ops record updated correctly. The second patch corrects a loop in
setup_ftrace_ool_stubs() to ensure all required stubs are reserved, not
just the first. Together, these bugs lead to potential corruption of the
OOL ftrace stubs area for livepatch modules.
The final patch replaces the sentinel-based allocation in the module
.stubs section with an explicit counter. This improves clarity and helps
prevent similar problems in the future.
Changes since v1: https://lore.kernel.org/live-patching/df7taxdxpbo4qfn7lniggj5o4ili6kweg4nytyb2fwwwgmnyo4@halp5gf244nn/T/
- Split into parts: bug fix x2, code cleanup
- Call ftrace_rec_set_nop_ops() from ftrace_init_nop() [Naveen]
- Update commit msg on cleanup patch [Naveen]
Joe Lawrence (3):
powerpc/ftrace: ensure ftrace record ops are always set for NOPs
powerpc64/modules: correctly iterate over stubs in
setup_ftrace_ool_stubs
powerpc64/modules: replace stub allocation sentinel with an explicit
counter
arch/powerpc/include/asm/module.h | 1 +
arch/powerpc/kernel/module_64.c | 26 ++++++++------------------
arch/powerpc/kernel/trace/ftrace.c | 10 ++++++++--
3 files changed, 17 insertions(+), 20 deletions(-)
--
2.51.0
next reply other threads:[~2025-09-12 14:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 14:27 Joe Lawrence [this message]
2025-09-12 14:27 ` [PATCH v2 1/3] powerpc/ftrace: ensure ftrace record ops are always set for NOPs Joe Lawrence
2025-09-12 14:27 ` [PATCH v2 2/3] powerpc64/modules: correctly iterate over stubs in setup_ftrace_ool_stubs Joe Lawrence
2025-09-12 14:27 ` [PATCH v2 3/3] powerpc64/modules: replace stub allocation sentinel with an explicit counter Joe Lawrence
2025-09-15 5:43 ` [PATCH v2 0/3] powerpc/ftrace: Fix livepatch module OOL ftrace corruption Naveen N Rao
2025-09-22 5:44 ` Madhavan Srinivasan
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=20250912142740.3581368-1-joe.lawrence@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=live-patching@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox