Live Patching
 help / color / mirror / Atom feed
* [PATCH 0/8] LoongArch: Add livepatch build (KLP) support
@ 2026-06-04  6:53 George Guo
  2026-06-04  6:53 ` [PATCH 1/8] " George Guo
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: George Guo @ 2026-06-04  6:53 UTC (permalink / raw)
  To: chenhuacai, jpoimboe, peterz, jikos, mbenes, pmladek
  Cc: kernel, joe.lawrence, rostedt, ardb, nathan,
	nick.desaulniers+lkml, yangtiezhu, jiaxun.yang, xry111, liukexin,
	loongarch, live-patching, llvm, linux-kernel, George Guo

From: George Guo <guodongtai@kylinos.cn>

This series adds LoongArch support for the klp-build livepatch tooling,
enabling automated livepatch module generation using objtool on
LoongArch.

It is based on Josh Poimboeuf's klp-build series [1] (see base-commit
below) and extends it with the LoongArch-specific objtool and build
pieces, plus a few LoongArch toolchain/relocation fixes required to make
livepatch modules load and run correctly.

Overview:

 - Patch 1 wires up LoongArch klp-build (objtool-based livepatch module
   generation).
 - Patches 2-3 add the objtool bits LoongArch needs: arch_adjusted_addend()
   and the special section entry sizes (.altinstructions, __ex_table,
   __bug_table, __jump_table) so objtool can process livepatch modules.
 - Patches 4-5 fix kernel panics seen when loading livepatch modules,
   caused by LoongArch code-generation/relocation assumptions:
     * disable -mdirect-extern-access for klp builds (the module loader
       relies on GOT entries for external symbol references),
     * force -fPIC so same-compilation-unit symbol references relocate
       correctly.
 - Patch 6 fix EFI linking when building with -fdata-sections.
 - Patch 7 implements arch_jump_opcode_bytes() so klp checksums for
   jump/call instructions are position-independent, mirroring x86/arm64.
 - Patch 8 adds KLP_SYSCALL_DEFINEx() support for LoongArch.

Testing:
 - objtool builds cleanly for LoongArch.
 - Livepatch modules were generated and loaded on a LoongArch machine;
   the panics addressed by patches 4-5 no longer reproduce.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=klp-build-arm64

George Guo (8):
  LoongArch: Add livepatch build (KLP) support
  objtool/LoongArch: Add arch_adjusted_addend() for KLP support
  LoongArch: Add special section entry sizes for KLP support
  livepatch/klp-build: disable direct-extern-access for LoongArch to fix
    kernel panic
  LoongArch: fix kernel panic with -fPIC for same-compilation-unit
    symbol references
  LoongArch: Fix EFI linking with -fdata-sections
  objtool/klp: Add LoongArch jump opcode bytes support
  klp-build: Add LoongArch syscall patching macro

 arch/loongarch/Kconfig                       |  1 +
 arch/loongarch/include/asm/alternative-asm.h |  5 ++-
 arch/loongarch/include/asm/alternative.h     |  6 ++-
 arch/loongarch/include/asm/asm-extable.h     | 10 ++++-
 arch/loongarch/include/asm/bug.h             | 15 ++++++-
 arch/loongarch/include/asm/jump_label.h      |  9 +++-
 arch/loongarch/kernel/asm-offsets.c          | 36 +++++++++++++++
 arch/loongarch/kernel/head.S                 |  1 +
 arch/loongarch/kernel/vmlinux.lds.S          |  2 +-
 include/linux/livepatch_helpers.h            | 22 ++++++++++
 scripts/livepatch/klp-build                  | 16 ++++++-
 tools/objtool/Makefile                       |  3 +-
 tools/objtool/arch/loongarch/decode.c        | 46 ++++++++++++++++++++
 13 files changed, 161 insertions(+), 11 deletions(-)


base-commit: 85afaba140a4b9f20fe8c8a64b24fc85f022d981
-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-06-08 10:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  6:53 [PATCH 0/8] LoongArch: Add livepatch build (KLP) support George Guo
2026-06-04  6:53 ` [PATCH 1/8] " George Guo
2026-06-04  6:53 ` [PATCH 2/8] objtool/LoongArch: Add arch_adjusted_addend() for KLP support George Guo
2026-06-04  6:53 ` [PATCH 3/8] LoongArch: Add special section entry sizes " George Guo
2026-06-05  8:38   ` WangYuli
2026-06-08 10:33     ` George Guo
2026-06-04  6:53 ` [PATCH 4/8] livepatch/klp-build: disable direct-extern-access for LoongArch to fix kernel panic George Guo
2026-06-05  8:53   ` WangYuli
2026-06-04  6:53 ` [PATCH 5/8] LoongArch: fix kernel panic with -fPIC for same-compilation-unit symbol references George Guo
2026-06-05  8:10   ` Xi Ruoyao
2026-06-08 10:23     ` George Guo
2026-06-04  6:53 ` [PATCH 6/8] LoongArch: Fix EFI linking with -fdata-sections George Guo
2026-06-04  6:53 ` [PATCH 7/8] objtool/klp: Add LoongArch jump opcode bytes support George Guo
2026-06-04  6:53 ` [PATCH 8/8] klp-build: Add LoongArch syscall patching macro George Guo
2026-06-05  7:57 ` [PATCH 0/8] LoongArch: Add livepatch build (KLP) support WangYuli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox