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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Jul 2023 10:44:27 +0200
From:   Petr Tesarik <petrtesarik@...weicloud.com>
To:     Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Conor Dooley <conor.dooley@...rochip.com>,
        Li Huafei <lihuafei1@...wei.com>,
        Liao Chang <liaochang1@...wei.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Alyssa Ross <hi@...ssa.is>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Ricardo Ribalda <ribalda@...omium.org>,
        Kees Cook <keescook@...omium.org>,
        Heiko Stuebner <heiko@...ech.de>,
        Li Zhengyu <lizhengyu3@...wei.com>,
        linux-riscv@...ts.infradead.org (open list:RISC-V ARCHITECTURE),
        linux-kernel@...r.kernel.org (open list)
Cc:     Roberto Sassu <roberto.sassu@...weicloud.com>, petr@...arici.cz
Subject: [PATCH v1 3/3] riscv/purgatory: do not link with string.o

From: Petr Tesarik <petr.tesarik.ext@...wei.com>

Linking with this object file it makes kexec_file_load(2) fail with:

 kexec_image: Unknown rela relocation: 20
 kexec_image: Error loading purgatory ret=-8

This is R_RISCV_GOT_HI20, generated by the linker to handle references to
the global variable _ctype from strcasecmp() and strncasecmp().

Rather than implementing GOT for the purgatory, remove the object file,
because it is not needed by the purgatory code.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Petr Tesarik <petr.tesarik.ext@...wei.com>
Cc: Li Zhengyu <lizhengyu3@...wei.com>
Cc: stable@...r.kernel.org
---
 arch/riscv/purgatory/Makefile | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile
index dc20e166983e..497bb72b6ba8 100644
--- a/arch/riscv/purgatory/Makefile
+++ b/arch/riscv/purgatory/Makefile
@@ -1,15 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
 OBJECT_FILES_NON_STANDARD := y
 
-purgatory-y := purgatory.o sha256.o entry.o string.o ctype.o memcpy.o memset.o
+purgatory-y := purgatory.o sha256.o entry.o ctype.o memcpy.o memset.o
 purgatory-y += strcmp.o strlen.o strncmp.o
 
 targets += $(purgatory-y)
 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
 
-$(obj)/string.o: $(srctree)/lib/string.c FORCE
-	$(call if_changed_rule,cc_o_c)
-
 $(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
@@ -32,7 +29,6 @@ $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
-CFLAGS_string.o := -D__DISABLE_EXPORTS
 CFLAGS_ctype.o := -D__DISABLE_EXPORTS
 
 # When profile-guided optimization is enabled, llvm emits two different
@@ -83,9 +79,6 @@ CFLAGS_purgatory.o		+= $(PURGATORY_CFLAGS)
 CFLAGS_REMOVE_sha256.o		+= $(PURGATORY_CFLAGS_REMOVE)
 CFLAGS_sha256.o			+= $(PURGATORY_CFLAGS)
 
-CFLAGS_REMOVE_string.o		+= $(PURGATORY_CFLAGS_REMOVE)
-CFLAGS_string.o			+= $(PURGATORY_CFLAGS)
-
 CFLAGS_REMOVE_ctype.o		+= $(PURGATORY_CFLAGS_REMOVE)
 CFLAGS_ctype.o			+= $(PURGATORY_CFLAGS)
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ