From: Catalin Marinas <catalin.marinas@arm.com>
To: Rui Qi <qirui.001@bytedance.com>
Cc: will@kernel.org, mark.rutland@arm.com, ardb@kernel.org,
song@kernel.org, dylanbhatch@google.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 3/3] arm64: module: Use text-poke for late PLT/veneer emission
Date: Tue, 3 Nov 2026 17:19:22 +0000 [thread overview]
Message-ID: <auoXmvKObg3IWWTD@arm.com> (raw)
In-Reply-To: <20261010085055.2200241-2-qirui.001@bytedance.com>
On Sat, Oct 10, 2026 at 04:50:55PM +0800, Rui Qi wrote:
> diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
> index 7afd370da9f4..fa89ed014bd1 100644
> --- a/arch/arm64/kernel/module-plts.c
> +++ b/arch/arm64/kernel/module-plts.c
> @@ -9,6 +9,29 @@
> #include <linux/module.h>
> #include <linux/moduleloader.h>
> #include <linux/sort.h>
> +#include <linux/text-patching.h>
> +
> +/*
> + * The .plt section is marked ROX once the module is fully formed, so
> + * late (livepatch) relocations that emit PLT entries cannot use direct
> + * assignment. Mirror WRITE_PLACE() and route the write through the
> + * text-poke API when the module is already loaded.
> + *
> + * Return: 0 on success, -EINVAL if the text-poke write failed.
> + */
> +static int plt_entry_write(struct plt_entry *plt,
> + struct plt_entry *entry, struct module *mod)
> +{
> + if (mod->state == MODULE_STATE_UNFORMED) {
> + *plt = *entry;
> + return 0;
> + }
> +
> + if (!aarch64_insn_copy(plt, entry, sizeof(*plt)))
> + return -EINVAL;
> +
> + return 0;
> +}
As your comment says, this is fairly similar to WRITE_PLACE(). Can we
have a single macro that's used in both places (and maybe give it an
arm64 specific name if it ends up in a header)?
Also do we need the !NULL check? plt and entry should be 4-byte aligned
already, so it's an unnecessary check. WRITE_PLACE() doesn't do this
either.
--
Catalin
next prev parent reply other threads:[~2026-11-03 17:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 8:47 [PATCH 0/3] arm64: Fix text-poke byte-order and late PLT/veneer ROX handling Rui Qi
2026-10-10 8:47 ` [PATCH 1/3] arm64/module: Fix big-endian breakage in late data relocations Rui Qi
2026-10-10 8:50 ` [PATCH 2/3] arm64: patching: Fix instruction byte order in aarch64_insn_set() Rui Qi
2026-10-10 8:50 ` [PATCH 3/3] arm64: module: Use text-poke for late PLT/veneer emission Rui Qi
2026-11-03 17:19 ` Catalin Marinas [this message]
2026-10-15 16:57 ` [PATCH 2/3] arm64: patching: Fix instruction byte order in aarch64_insn_set() Catalin Marinas
2026-10-16 6:18 ` Rui Qi
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=auoXmvKObg3IWWTD@arm.com \
--to=catalin.marinas@arm.com \
--cc=ardb@kernel.org \
--cc=dylanbhatch@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=qirui.001@bytedance.com \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--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.