lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 13 Nov 2020 00:03:17 +0100
From:   Vasily Gorbik <gor@...ux.ibm.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Miroslav Benes <mbenes@...e.cz>,
        Alexandre Chartre <alexandre.chartre@...cle.com>,
        Julien Thierry <jthierry@...hat.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH v5 0/5] objtool and cross compilation

The patch series is resent with additional patch for the instruction
decoder selftest, since it has been dropped from the tip/objtool/core
due to instruction decoder selftest build failure.

Previous version can be found here:
https://lore.kernel.org/lkml/cover.thread-b2a547.your-ad-here.call-01601912612-ext-9766@work.hours/

rfc v4 - v5:
 - original patch 1 has been merged. It has been replaced with the patch
   which moves instruction decoder selftests to tools headers usage.
   This effectively fixes x86 kernel cross-compilation with
   CONFIG_X86_DECODER_SELFTEST=y. And posttests are run successfully at
   least on s390 (with entire patch series applied).
 - patch 2 has instruction decoder selftest fixup added.
 - also includes patch 5 for objtool header include paths rework.
 - patches 2-5 titles changed to those with which they were picked up
   into tip/objtool/core.

rfc v3 - rfc v4:
 - patch 4: objtool: fix x86 orc generation on big endian cross compiles
   - introduced "bswap_if_needed()" macro for multi-byte values
     conversion, which are read from / about to be written to a target
     native endianness ELF file.
 - patch 2: x86/insn: instruction decoder and big endian cross compiles
   - changed subject prefix from objtool to x86/insn
   - reformated leXX_to_cpu macro make it easier to read

rfc v2 - rfc v3:
 - reused __*_ENDIAN_BITFIELD and dropped unneeded byteswap if __KERNEL__
   is defined following David's suggestions,
 - re-splitted changes and made x86 instruction decoder a separate patch,
 - extra patch to add -Wno-nested-externs build flag to enable BUILD_BUG()
   usage,
 - added a safer and more readable leXX_to_cpu macro in x86 instruction
   decoder,
 - simplified includes. Switched to using leXX_to_cpu/cpu_to_leXX in
   the objtool and x86 instruction decoder since
   <linux/kernel.h> is included in the objtool already.

rfc v1 - rfc v2:
 - rebased onto tip/objtool/core
 - reformatted couple of lines

Currently objtool seems to be the only tool from all the build tools
needed for x86 build which breaks x86 cross compilation on big endian
systems.

But besides x86 cross compilation, endianness awareness is also needed
for big endian architectures objtool support in general.

We have working prototype of objtool support and orc unwinder for s390
made originally by Martin Schwidefsky. I'm trying to bring it in shape
again and refactor to share more code with "generic" part.

But first things first. This patch series points to endianness problems
which should be addressed. Recent "other architectures support" patches
currently moved only some problematic parts into x86 arch specific folder.
Besides that even though big endian stuff is only needed for the objtool
arch/x86/lib/insn.c and arch/x86/include/asm/insn.h are shared across
the kernel source and the tools, so changes are applied to both.

Martin Schwidefsky (2):
  x86/insn: Support big endian cross-compiles
  objtool: Fix reloc generation on big endian cross compiles

Vasily Gorbik (3):
  x86/tools: Use tools headers for instruction decoder selftests
  objtool: Fix x86 orc generation on big endian cross compiles
  objtool: Rework header include paths

 arch/x86/include/asm/insn.h                   |  33 ++++++
 arch/x86/include/asm/orc_types.h              |  10 ++
 arch/x86/lib/insn.c                           | 101 ++++++++----------
 arch/x86/tools/Makefile                       |   8 +-
 arch/x86/tools/insn_sanity.c                  |   4 -
 tools/arch/x86/include/asm/insn.h             |  33 ++++++
 tools/arch/x86/include/asm/orc_types.h        |  10 ++
 tools/arch/x86/lib/insn.c                     | 101 ++++++++----------
 tools/objtool/.gitignore                      |   2 +-
 tools/objtool/Makefile                        |   1 +
 tools/objtool/arch/x86/decode.c               |   8 +-
 .../arch/x86/include/{ => arch}/cfi_regs.h    |   0
 .../x86/include/{arch_elf.h => arch/elf.h}    |   0
 .../arch/x86/include/arch/endianness.h        |   9 ++
 .../{arch_special.h => arch/special.h}        |   0
 tools/objtool/arch/x86/special.c              |   4 +-
 tools/objtool/builtin-check.c                 |   4 +-
 tools/objtool/builtin-orc.c                   |   4 +-
 tools/objtool/check.c                         |  19 ++--
 tools/objtool/elf.c                           |  40 +++----
 tools/objtool/{ => include/objtool}/arch.h    |   4 +-
 tools/objtool/{ => include/objtool}/builtin.h |   0
 tools/objtool/{ => include/objtool}/cfi.h     |   2 +-
 tools/objtool/{ => include/objtool}/check.h   |   4 +-
 tools/objtool/{ => include/objtool}/elf.h     |   0
 tools/objtool/include/objtool/endianness.h    |  38 +++++++
 tools/objtool/{ => include/objtool}/objtool.h |   2 +-
 tools/objtool/{ => include/objtool}/special.h |   4 +-
 tools/objtool/{ => include/objtool}/warn.h    |   2 +-
 tools/objtool/objtool.c                       |   6 +-
 tools/objtool/orc_dump.c                      |   9 +-
 tools/objtool/orc_gen.c                       |   7 +-
 tools/objtool/special.c                       |  14 +--
 tools/objtool/weak.c                          |   2 +-
 34 files changed, 306 insertions(+), 179 deletions(-)
 rename tools/objtool/arch/x86/include/{ => arch}/cfi_regs.h (100%)
 rename tools/objtool/arch/x86/include/{arch_elf.h => arch/elf.h} (100%)
 create mode 100644 tools/objtool/arch/x86/include/arch/endianness.h
 rename tools/objtool/arch/x86/include/{arch_special.h => arch/special.h} (100%)
 rename tools/objtool/{ => include/objtool}/arch.h (96%)
 rename tools/objtool/{ => include/objtool}/builtin.h (100%)
 rename tools/objtool/{ => include/objtool}/cfi.h (96%)
 rename tools/objtool/{ => include/objtool}/check.h (96%)
 rename tools/objtool/{ => include/objtool}/elf.h (100%)
 create mode 100644 tools/objtool/include/objtool/endianness.h
 rename tools/objtool/{ => include/objtool}/objtool.h (96%)
 rename tools/objtool/{ => include/objtool}/special.h (94%)
 rename tools/objtool/{ => include/objtool}/warn.h (98%)

-- 
2.25.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ