[PATCH v5] arm64/module: Use text-poke API for late relocations.

Dylan Hatch dylanbhatch at google.com
Fri May 30 17:11:00 PDT 2025


Hi Will,

On Fri, May 30, 2025 at 7:13 AM Will Deacon <will at kernel.org> wrote:
>
> and this would be:
>
>         WRITE_PLACE(place, cpu_to_le32(insn), me);
>

I'm seeing this part give a build error:

arch/arm64/kernel/module.c:158:2: error: cannot take the address of an
rvalue of type '__le32' (aka 'unsigned int')
  158 |         WRITE_PLACE(place, cpu_to_le32(insn), me);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kernel/module.c:56:28: note: expanded from macro 'WRITE_PLACE'
   56 |                 aarch64_insn_copy(place, &(val),
sizeof(*place));       \
      |                                          ^ ~~~

I can't think of a clean way to get around this and still keep a
combined write helper. Setting an intermediate __le32 in the
reloc_insn_* functions would work but we were trying to avoid that.
Setting an intermediate value inside WRITE_PLACE would also work but
then (I think) it won't work for the data relocations because we'd be
converting a signed into unsigned value. Making WRITE_PLACE a function
instead of a macro also fixes the rvalue problem but then the args
'place' and 'val' have to be of a fixed type so we can't do the
typecasting on 'place' and 'val' has the same signed/unsigned value
problem.

Do you have a suggestion here? In the meantime I can send a v6 that
uses an intermediate __le32 for the instruction relocations.

Thanks,
Dylan



More information about the linux-arm-kernel mailing list