mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4)
@ 2023-07-11 16:08 Christophe Leroy
  2023-07-11 16:08 ` [PATCH v4 01/15] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" Christophe Leroy
                   ` (16 more replies)
  0 siblings, 17 replies; 20+ messages in thread
From: Christophe Leroy @ 2023-07-11 16:08 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Josh Poimboeuf,
	Peter Zijlstra, Sathvika Vasireddy, Naveen N Rao
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev

This series adds UACCESS validation for PPC32. It includes
a dozen of changes to objtool core.

It applies on top of series "Cleanup/Optimise KUAP (v3)"
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=363368&state=*

It is almost mature, performs code analysis for all PPC32.

In this version objtool switch table lookup has been enhanced to
handle nested switch tables.

Most object files are correctly decoded, only a few
'unreachable instruction' warnings remain due to more complex
fonctions which include back and forth jumps or branches.

It allowed to detect some UACCESS mess in a few files. They've been
fixed through other patches.

Changes in v4:
- Split series in two parts, the powerpc uaccess rework is submitted
separately, see https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=363368&state=*
- Support of UACCESS on all PPC32 including book3s/32 which was missing in v3.
- More elaborated switch tables lookup.
- Patches 2, 7, 8, 9, 10, 11 are new
- Patch 11 in series v3 is now removed.

Changes in v3:
- Rebased on top of a merge of powerpc tree and tip/objtool/core tree
- Simplified support for relative switch tables based on relocation type
- Taken comments from Peter

Christophe Leroy (15):
  Revert "powerpc/bug: Provide better flexibility to
    WARN_ON/__WARN_FLAGS() with asm goto"
  objtool: Move back misplaced comment
  objtool: Allow an architecture to disable objtool on ASM files
  objtool: Fix JUMP_ENTRY_SIZE for bi-arch like powerpc
  objtool: Add INSN_RETURN_CONDITIONAL
  objtool: Add support for relative switch tables
  objtool: Merge mark_func_jump_tables() and add_func_jump_tables()
  objtool: Track general purpose register used for switch table base
  objtool: Find end of switch table directly
  objtool: When looking for switch tables also follow conditional and
    dynamic jumps
  objtool: .rodata.cst{2/4/8/16} are not switch tables
  objtool: Add support for more complex UACCESS control
  objtool: Prepare noreturns.h for more architectures
  powerpc/bug: Annotate reachable after warning trap
  powerpc: Implement UACCESS validation on PPC32

 arch/Kconfig                                  |   5 +
 arch/powerpc/Kconfig                          |   2 +
 arch/powerpc/include/asm/book3s/32/kup.h      |   2 +
 arch/powerpc/include/asm/book3s/64/kup.h      |   2 +-
 arch/powerpc/include/asm/bug.h                |  77 ++-------
 arch/powerpc/include/asm/nohash/32/kup-8xx.h  |   4 +-
 arch/powerpc/include/asm/nohash/kup-booke.h   |   4 +-
 arch/powerpc/kernel/misc_32.S                 |   2 +-
 arch/powerpc/kernel/traps.c                   |   9 +-
 arch/powerpc/kexec/core_32.c                  |   4 +-
 arch/powerpc/mm/nohash/kup.c                  |   2 +
 include/linux/objtool.h                       |  14 ++
 scripts/Makefile.build                        |   4 +
 tools/objtool/arch/powerpc/decode.c           | 155 +++++++++++++++++-
 .../arch/powerpc/include/arch/noreturns.h     |  11 ++
 .../arch/powerpc/include/arch/special.h       |   2 +-
 tools/objtool/arch/powerpc/special.c          |  39 ++++-
 .../objtool/arch/x86/include/arch/noreturns.h |  20 +++
 tools/objtool/arch/x86/special.c              |   8 +-
 tools/objtool/check.c                         | 154 ++++++++++++-----
 tools/objtool/include/objtool/arch.h          |   1 +
 tools/objtool/include/objtool/check.h         |   6 +-
 tools/objtool/include/objtool/special.h       |   3 +-
 tools/objtool/noreturns.h                     |  14 +-
 tools/objtool/special.c                       |  55 +++----
 25 files changed, 425 insertions(+), 174 deletions(-)
 create mode 100644 tools/objtool/arch/powerpc/include/arch/noreturns.h
 create mode 100644 tools/objtool/arch/x86/include/arch/noreturns.h

-- 
2.41.0


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

end of thread, other threads:[~2023-07-21  5:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11 16:08 [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4) Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 01/15] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 02/15] objtool: Move back misplaced comment Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 03/15] objtool: Allow an architecture to disable objtool on ASM files Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 04/15] objtool: Fix JUMP_ENTRY_SIZE for bi-arch like powerpc Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 05/15] objtool: Add INSN_RETURN_CONDITIONAL Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 06/15] objtool: Add support for relative switch tables Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 07/15] objtool: Merge mark_func_jump_tables() and add_func_jump_tables() Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 08/15] objtool: Track general purpose register used for switch table base Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 09/15] objtool: Find end of switch table directly Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 10/15] objtool: When looking for switch tables also follow conditional and dynamic jumps Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 11/15] objtool: .rodata.cst{2/4/8/16} are not switch tables Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 12/15] objtool: Add support for more complex UACCESS control Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 13/15] objtool: Prepare noreturns.h for more architectures Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 14/15] powerpc/bug: Annotate reachable after warning trap Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 15/15] powerpc: Implement UACCESS validation on PPC32 Christophe Leroy
2023-07-12 14:23 ` [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4) Peter Zijlstra
2023-07-12 16:29   ` Christophe Leroy
2023-07-20 13:50 ` (subset) " Michael Ellerman
2023-07-21  5:00   ` Michael Ellerman

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

Powered by JetHome