[RFC PATCH v3 00/13] objtool: add base support for arm64

Chen Zhongjin chenzhongjin at huawei.com
Thu Apr 7 05:01:28 PDT 2022


Hi,

This series enables objtool to start doing stack validation on arm64
kernel builds.

The work for objtool has been stopped for a while. Julien and
Raphael worked for this [1] but it seems now nobody is carrying it
on.

To re-bring it to people's vision, this v3 update just makes some
simply changes including rebasing to mainline, code cleanning and
one bug fix.

Previous patch had finished the decoder part of objtool. It passed
my building test with allyesconfig and only few of objfile report
error. Julien had some unorganized commits in his repo [2], mainly
about changes to arm64 code to eliminate some of these errors.

While fixing these problems in next version, I'm also planning to
implement the orc unwinder for arm64, then we can completely test
everything on arm64.

[1] https://lkml.org/lkml/2021/3/3/1135
[2] https://github.com/julien-thierry/linux.git
---
Changs v2 -> v3:
- [04] rebase Julien's version to mainstream and solve conflicts.
- [05, 06, 08] Merge dumplicate "*type = INSN_OTHER".
- [08, 09, 10] When meeting unrecognized instructions such as  datas
	in .text code or 0x0 padding insns, last version used
	"loc->ignorable" to mark and remove them from objtool insn list.

	However there are two problems to do so:
	1. when meeting insns can't be decoded or excluded, objtool will
	just stop.
	2. deleting every insn can cause problems in fellow procedure.

	So I changed "record_invalid_insn" that we can delete one insn or
	just set it ignored. Now check will throw an error and going on when
	meeting undecodable instructions. Also, to prevent the confusion
	between "loc->ignorable" and "insn->ignore" I changed "ignore" to
	"delete".

Changs v1 -> v2:
- Drop gcc plugin in favor of -fno-jump-tables
- miscelaneous fixes and cleanups

--->
Julien Thierry (12):
  tools: Add some generic functions and headers
  tools: arm64: Make aarch64 instruction decoder available to tools
  tools: bug: Remove duplicate definition
  objtool: arm64: Add base definition for arm64 backend
  objtool: arm64: Decode add/sub instructions
  objtool: arm64: Decode jump and call related instructions
  objtool: arm64: Decode other system instructions
  objtool: arm64: Decode load/store instructions
  objtool: arm64: Decode LDR instructions
  objtool: arm64: Accept non-instruction data in code sections
  objtool: arm64: Handle supported relocations in alternatives
  objtool: arm64: Ignore replacement section for alternative callback

Raphael Gault (1):
  objtool: arm64: Enable stack validation for arm64

 arch/arm64/Kconfig                            |    1 +
 arch/arm64/Makefile                           |    4 +
 tools/arch/arm64/include/asm/insn.h           |  565 +++++++
 tools/arch/arm64/lib/insn.c                   | 1464 +++++++++++++++++
 tools/include/asm-generic/bitops/__ffs.h      |   11 +
 tools/include/linux/bug.h                     |    6 +-
 tools/include/linux/kernel.h                  |   21 +
 tools/include/linux/printk.h                  |   40 +
 tools/objtool/Makefile                        |    5 +
 tools/objtool/arch/arm64/Build                |    8 +
 tools/objtool/arch/arm64/decode.c             |  500 ++++++
 .../arch/arm64/include/arch/cfi_regs.h        |   14 +
 tools/objtool/arch/arm64/include/arch/elf.h   |    8 +
 .../arch/arm64/include/arch/endianness.h      |    9 +
 .../objtool/arch/arm64/include/arch/special.h |   22 +
 tools/objtool/arch/arm64/special.c            |   36 +
 tools/objtool/arch/x86/decode.c               |    5 +
 tools/objtool/check.c                         |    6 +
 tools/objtool/include/objtool/arch.h          |    3 +
 tools/objtool/sync-check.sh                   |    5 +
 20 files changed, 2728 insertions(+), 5 deletions(-)
 create mode 100644 tools/arch/arm64/include/asm/insn.h
 create mode 100644 tools/arch/arm64/lib/insn.c
 create mode 100644 tools/include/linux/printk.h
 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/endianness.h
 create mode 100644 tools/objtool/arch/arm64/include/arch/special.h
 create mode 100644 tools/objtool/arch/arm64/special.c

-- 
2.17.1




More information about the linux-arm-kernel mailing list