Skip to content

objtool/arm64: Port klp-build to arm64

Josh Poimboeuf linux-arm-kernel live-patching lkml 4 versions – Applied

Status from this message: The following commit has been merged into the objtool/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest22 patches 14 repliesApplied
  2. v321 patches 21 repliesSuperseded
  3. v212 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v114 patches19 repliesApplied

Changes in v4 from the cover letter

- Replace "objtool: Allow empty alternatives" with "arm64: Remove unnecessary empty alternatives" [Peter]
- Add "objtool/klp: Fix .kcfi_traps special section extraction" [Joe]
- Fix vmlinux.o objtool options leaking in from Makefile.lib [Sashiko]
- Tighten jump-to-end-of-function check [Sashiko]
- Drop unneeded linux/kconfig.h include [Sashiko]
- Fix bisectability issue with is_mapping_sym()/is_data_mapping_sym() [Sashiko]
- Add missing ALLOW_ERROR_INJECTION() to arm64 syscall macro [Sashiko]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/22objtool/klp: Fix .kcfi_traps special section extractiontools/objtool/include/objtool/elf.h tools/objtool/klp-diff.c+25 -21 reply
2/22klp-build: Reject patches to init/*.cscripts/livepatch/klp-build+1 -10 replies
3/22arm64: Annotate intra-function callsarch/arm64/kernel/entry.S arch/arm64/kernel/proton-pack.c+9 -50 replies
4/22arm64: Fix EFI linking with -fdata-sectionsarch/arm64/kernel/vmlinux.lds.S+1 -10 replies
5/22arm64: Rename TRAMP_VALIAS -> TRAMP_VALIAS_ASM in asm-offsetsarch/arm64/kernel/asm-offsets.c arch/arm64/kernel/entry.S+5 -50 replies
6/22arm64: vdso: Discard .discard.* sectionsarch/arm64/kernel/vdso/vdso.lds.S+1 -01 reply
7/22arm64: Annotate special section entriesarch/arm64/include/asm/alternative-macros.h arch/arm64/include/asm/asm-bug.h arch/arm64/include/asm/asm-extable.h +6 more+62 -160 replies
8/22arm64: Remove unnecessary empty alternativesarch/arm64/include/asm/assembler.h+2 -20 replies
9/22crypto: arm64: Move data to .rodatalib/crypto/arm64/sha2-armv8.pl+12 -60 replies
10/22objtool: Allow setting --mnop without --mcounttools/objtool/builtin-check.c+0 -50 replies
11/22kbuild: Only run objtool if there is at least one commandarch/x86/boot/startup/Makefile scripts/Makefile.build scripts/Makefile.lib +1 more+38 -381 reply
12/22objtool: Ignore jumps to the end of the function for checksum runstools/objtool/check.c+21 -171 reply
13/22objtool: Refactor elf_add_data() to use a growable data buffertools/objtool/elf.c tools/objtool/include/objtool/elf.h+71 -651 reply
14/22objtool: Reuse string referencestools/objtool/elf.c tools/objtool/include/objtool/elf.h tools/objtool/klp-diff.c+28 -82 replies
15/22objtool: Prevent kCFI hashes from being decoded as instructionstools/objtool/check.c tools/objtool/include/objtool/elf.h+37 -03 replies
16/22objtool/klp: Add arm64 support for prefix/PFE detectiontools/objtool/arch/x86/include/arch/elf.h tools/objtool/elf.c tools/objtool/include/objtool/elf.h +1 more+172 -110 replies
17/22objtool/klp: Filter arm64 mapping symbols in find_symbol_by_offset()tools/objtool/elf.c+1 -10 replies
18/22objtool/klp: Don't correlate arm64 mapping symbolstools/objtool/klp-diff.c+1 -01 reply
19/22objtool/klp: Clone inline alternative replacementstools/objtool/elf.c tools/objtool/include/objtool/elf.h tools/objtool/klp-diff.c +1 more+57 -140 replies
20/22objtool/klp: Introduce objtool for arm64arch/arm64/Kconfig tools/objtool/Makefile tools/objtool/arch/arm64/Build +5 more+262 -01 reply
21/22klp-build: Support cross-compilationscripts/livepatch/klp-build+21 -11 reply
22/22klp-build: Add arm64 syscall patching macroinclude/linux/livepatch_helpers.h+20 -01 reply

Reviews trailers per patch

17 of 22 patches have a Reviewed-by or Acked-by.

PatchSong LiuMiroslav BenesNathan ChancellorNicolas Schier
1/22A-b
2/22A-b A-b
3/22A-b R-b
4/22A-b R-b
5/22A-b R-b
6/22A-b
7/22
8/22
9/22
10/22A-b
11/22A-b R-b T-b R-b
12/22A-b
13/22A-b
14/22A-b
15/22A-b
16/22
17/22A-b
18/22A-b
19/22
20/22A-b
21/22A-b
22/22A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/22] objtool/arm64: Port klp-build to arm64

Based on tip/objtool/core + the following fixes:

- https://lore.kernel.org/[email protected]
- https://lore.kernel.org/ed4fe1f95071897859ec7fbe9176246cbd4962bf.1786138806.git.jpoimboe@kernel.org
- https://lore.kernel.org/1b5ccfa8095bdb1277f84af1c2c2e2205aca03ae.1785992188.git.jpoimboe@kernel.org

The full set (including the above fixes) can be found on the following branch:

git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git klp-build-arm64

v4:
- Replace "objtool: Allow empty alternatives" with "arm64: Remove unnecessary empty alternatives" [Peter]
- Add "objtool/klp: Fix .kcfi_traps special section extraction" [Joe]
- Fix vmlinux.o objtool options leaking in from Makefile.lib [Sashiko]
- Tighten jump-to-end-of-function check [Sashiko]
- Drop unneeded linux/kconfig.h include [Sashiko]
- Fix bisectability issue with is_mapping_sym()/is_data_mapping_sym() [Sashiko]
- Add missing ALLOW_ERROR_INJECTION() to arm64 syscall macro [Sashiko]

v3: https://lore.kernel.org/[email protected]
- Too many changes to list. Did a lot of testing and fixed a bunch of issues (many of which have already been merged in tip/objtool/core).

v2: https://lore.kernel.org/[email protected]
- patches 1-2 were merged, rebase on tip/master
- improve commit message for "objtool: Extricate checksum calculation from validate_branch()"
- add review tags

v1: https://lore.kernel.org/[email protected]

Port objtool and the klp-build tooling (for building livepatch modules) to arm64.

Note this doesn't bring all the objtool bells and whistles to arm64, nor any of the CFG reverse engineering. This only adds the bare minimum needed for 'objtool --checksum'.

And note that objtool still doesn't get enabled at all for normal arm64 kernel builds, so this doesn't affect any users other than those running klp-build directly.

Josh Poimboeuf (22):
objtool/klp: Fix .kcfi_traps special section extraction
klp-build: Reject patches to init/*.c
arm64: Annotate intra-function calls
arm64: Fix EFI linking with -fdata-sections
arm64: Rename TRAMP_VALIAS -> TRAMP_VALIAS_ASM in asm-offsets
arm64: vdso: Discard .discard.* sections
arm64: Annotate special section entries
arm64: Remove unnecessary empty alternatives
crypto: arm64: Move data to .rodata
objtool: Allow setting --mnop without --mcount
kbuild: Only run objtool if there is at least one command
objtool: Ignore jumps to the end of the function for checksum runs
objtool: Refactor elf_add_data() to use a growable data buffer
objtool: Reuse string references
objtool: Prevent kCFI hashes from being decoded as instructions objtool/klp: Add arm64 support for prefix/PFE detection objtool/klp: Filter arm64 mapping symbols in find_symbol_by_offset() objtool/klp: Don't correlate arm64 mapping symbols objtool/klp: Clone inline alternative replacements objtool/klp: Introduce objtool for arm64
klp-build: Support cross-compilation
klp-build: Add arm64 syscall patching macro

 arch/arm64/Kconfig                            |   2 +
 arch/arm64/include/asm/alternative-macros.h   |  27 +-
 arch/arm64/include/asm/asm-bug.h              |   2 +
 arch/arm64/include/asm/asm-extable.h          |  21 +-
 arch/arm64/include/asm/assembler.h            |   4 +-
 arch/arm64/include/asm/jump_label.h           |   2 +
 arch/arm64/kernel/asm-offsets.c               |   7 +-
 arch/arm64/kernel/entry.S                     |  10 +-
 arch/arm64/kernel/proton-pack.c               |  12 +-
 arch/arm64/kernel/vdso/vdso.lds.S             |   1 +
 arch/arm64/kernel/vmlinux.lds.S               |   2 +-
 arch/x86/boot/startup/Makefile                |   2 +-
 include/linux/annotate.h                      |  14 +-
 include/linux/livepatch_helpers.h             |  20 ++
 include/linux/objtool_types.h                 |   1 +
 lib/crypto/arm64/sha2-armv8.pl                |  18 +-
 scripts/Makefile.build                        |   4 +-
 scripts/Makefile.lib                          |  52 ++--
 scripts/Makefile.vmlinux_o                    |  18 +-
 scripts/livepatch/klp-build                   |  24 +-
 tools/include/linux/objtool_types.h           |   1 +
 tools/objtool/Makefile                        |   4 +
 tools/objtool/arch/arm64/Build                |   2 +
 tools/objtool/arch/arm64/decode.c             | 177 ++++++++++++
 .../arch/arm64/include/arch/cfi_regs.h        |  11 +
 tools/objtool/arch/arm64/include/arch/elf.h   |  15 ++
 .../objtool/arch/arm64/include/arch/special.h |  21 ++
 tools/objtool/arch/arm64/special.c            |  30 +++
 tools/objtool/arch/x86/include/arch/elf.h     |   2 +
 tools/objtool/builtin-check.c                 |   5 -
 tools/objtool/check.c                         |  52 ++--
 tools/objtool/elf.c                           | 170 +++++++-----
 tools/objtool/include/objtool/elf.h           |  48 +++-
 tools/objtool/klp-diff.c                      | 254 ++++++++++++++++--
 tools/objtool/klp-symid.c                     |   2 +-
 35 files changed, 843 insertions(+), 194 deletions(-)
 create mode 100644 tools/objtool/arch/arm64/Build
 create mode 100644 tools/objtool/arch/arm64/decode.c
 create mode 100644 tools/objtool/arch/arm64/include/arch/cfi_regs.h
 create mode 100644 tools/objtool/arch/arm64/include/arch/elf.h
 create mode 100644 tools/objtool/arch/arm64/include/arch/special.h
 create mode 100644 tools/objtool/arch/arm64/special.c
Signature · 1 line
2.54.0