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]
Message-Id: <20220827175436.156464-1-xry111@xry111.site>
Date:   Sun, 28 Aug 2022 01:54:28 +0800
From:   Xi Ruoyao <xry111@...111.site>
To:     loongarch@...ts.linux.dev
Cc:     linux-kernel@...r.kernel.org, WANG Xuerui <kernel@...0n.name>,
        Huacai Chen <chenhuacai@...nel.org>,
        Youling Tang <tangyouling@...ngson.cn>,
        Jinyang He <hejinyang@...ngson.cn>,
        Xi Ruoyao <xry111@...111.site>
Subject: [PATCH 0/8] LoongArch: Support toolchain with new relocation types

The version 2.00 of LoongArch ELF ABI specification introduced new
relocation types, and the development tree of Binutils and GCC has
started to use them.  If the kernel is built with the latest snapshot of
Binutils or GCC, it will fail to load the modules because of unrecognized
relocation types in modules.

Add support for GOT and new relocation types for the module loader, so
the kernel (with modules) can be built with the "normal" code model and
function properly.

This series does not break the compatibility with old toolchain using
stack-based relocation types, so with the patches applied the kernel can
be be built with both old and new toolchains.

Tested by building the kernel with the following combinations:

- GCC 12 and Binutils 2.39
- GCC 12 and Binutils trunk
- GCC trunk and Binutils trunk

and running the builds with 35 in-tree modules loaded, and loading one
module with 20 GOT loads and a per-CPU variable (loaded addresses
verified by comparing with /proc/kallsyms).

This superseds "LoongArch: Support new relocation types" series.  I
don't make it a "v5" because too much things have changed so it's better
to treat this as a new series.

Xi Ruoyao (8):
  LoongArch: Add CONFIG_CC_HAS_EXPLICIT_RELOCS
  LoongArch: Only use -Wa,-mla-* options for
    !CONFIG_CC_HAS_EXPLICIT_RELOCS
  LoongArch: Define ELF relocation types added in v2.00 ABI
  LoongArch: Support R_LARCH_B26 in modules
  LoongArch: Support R_LARCH_ABS* in modules
  LoongArch: Use model("extreme") attribute for per-CPU variables in
    module if CONFIG_CC_HAS_EXPLICIT_RELOCS
  LoongArch: Support R_LARCH_PCALA* in modules
  LoongArch: Support R_LARCH_GOT_PC* in modules

 arch/loongarch/Kconfig                  |   3 +
 arch/loongarch/Makefile                 |  15 ++-
 arch/loongarch/include/asm/elf.h        |  37 +++++++
 arch/loongarch/include/asm/module.h     |  23 ++++
 arch/loongarch/include/asm/module.lds.h |   1 +
 arch/loongarch/include/asm/percpu.h     |  13 +++
 arch/loongarch/kernel/head.S            |  10 +-
 arch/loongarch/kernel/module-sections.c |  56 +++++++++-
 arch/loongarch/kernel/module.c          | 138 +++++++++++++++++++++++-
 9 files changed, 285 insertions(+), 11 deletions(-)

-- 
2.37.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ