From: Jan Kiszka <jan.kiszka@siemens.com>
To: Ard Biesheuvel <ardb@kernel.org>, Palmer Dabbelt <palmer@rivosinc.com>
Cc: linux-efi <linux-efi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] riscv/efistub: Ensure GP-relative addressing is not used
Date: Fri, 12 Jan 2024 19:37:29 +0100 [thread overview]
Message-ID: <42c63cb9-87d0-49db-9af8-95771b186684@siemens.com> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
The cflags for the RISC-V efistub were missing -mno-relax, thus were
under the risk that the compiler could use GP-relative addressing. That
happened for _edata with binutils-2.41 and kernel 6.1, causing the
relocation to fail due to an invalid kernel_size in handle_kernel_image.
It was not yet observed with newer versions, but that may just be luck.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Something like this should go to stable as well, but we will need
rebased patches.
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 06964a3c130f..d561d7de46a9 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -28,7 +28,7 @@ cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \
-DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \
-DEFI_HAVE_STRCMP -fno-builtin -fpic \
$(call cc-option,-mno-single-pic-base)
-cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE
+cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax
cflags-$(CONFIG_LOONGARCH) += -fpie
cflags-$(CONFIG_EFI_PARAMS_FROM_FDT) += -I$(srctree)/scripts/dtc/libfdt
--
2.35.3
next reply other threads:[~2024-01-12 18:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 18:37 Jan Kiszka [this message]
2024-01-12 18:51 ` [PATCH] riscv/efistub: Ensure GP-relative addressing is not used Ard Biesheuvel
2024-01-12 18:56 ` Palmer Dabbelt
2024-01-13 10:35 ` Jan Kiszka
2024-01-15 17:34 ` Ard Biesheuvel
2024-01-16 5:21 ` Jan Kiszka
2024-01-16 8:36 ` Ard Biesheuvel
2024-01-16 13:44 ` Jan Kiszka
2024-01-16 13:47 ` Ard Biesheuvel
2024-01-16 13:56 ` Jan Kiszka
2024-01-16 13:58 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42c63cb9-87d0-49db-9af8-95771b186684@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=palmer@rivosinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).