* [PATCH AUTOSEL 6.1 06/29] efi/libstub: zboot.lds: Discard .discard sections [not found] <20240617132456.2588952-1-sashal@kernel.org> @ 2024-06-17 13:24 ` Sasha Levin 2024-06-17 13:24 ` [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures Sasha Levin 1 sibling, 0 replies; 5+ messages in thread From: Sasha Levin @ 2024-06-17 13:24 UTC (permalink / raw) To: linux-kernel, stable Cc: Nathan Chancellor, Huacai Chen, Ard Biesheuvel, Sasha Levin, chenhuacai, linux-efi, llvm From: Nathan Chancellor <nathan@kernel.org> [ Upstream commit 5134acb15d9ef27aa2b90aad46d4e89fcef79fdc ] When building ARCH=loongarch defconfig + CONFIG_UNWINDER_ORC=y using LLVM, there is a warning from ld.lld when linking the EFI zboot image due to the use of unreachable() in number() in vsprintf.c: ld.lld: warning: drivers/firmware/efi/libstub/lib.a(vsprintf.stub.o):(.discard.unreachable+0x0): has non-ABS relocation R_LARCH_32_PCREL against symbol '' If the compiler cannot eliminate the default case for any reason, the .discard.unreachable section will remain in the final binary but the entire point of any section prefixed with .discard is that it is only used at compile time, so it can be discarded via /DISCARD/ in a linker script. The asm-generic vmlinux.lds.h includes .discard and .discard.* in the COMMON_DISCARDS macro but that is not used for zboot.lds, as it is not a kernel image linker script. Add .discard and .discard.* to /DISCARD/ in zboot.lds, so that any sections meant to be discarded at link time are not included in the final zboot image. This issue is not specific to LoongArch, it is just the first architecture to select CONFIG_OBJTOOL, which defines annotate_unreachable() as an asm statement to add the .discard.unreachable section, and use the EFI stub. Closes: https://github.com/ClangBuiltLinux/linux/issues/2023 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/firmware/efi/libstub/zboot.lds | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds index 93d33f68333b2..a7fffbad6d46a 100644 --- a/drivers/firmware/efi/libstub/zboot.lds +++ b/drivers/firmware/efi/libstub/zboot.lds @@ -34,6 +34,7 @@ SECTIONS } /DISCARD/ : { + *(.discard .discard.*) *(.modinfo .init.modinfo) } } -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures [not found] <20240617132456.2588952-1-sashal@kernel.org> 2024-06-17 13:24 ` [PATCH AUTOSEL 6.1 06/29] efi/libstub: zboot.lds: Discard .discard sections Sasha Levin @ 2024-06-17 13:24 ` Sasha Levin 2024-06-17 15:16 ` Guilherme G. Piccoli 1 sibling, 1 reply; 5+ messages in thread From: Sasha Levin @ 2024-06-17 13:24 UTC (permalink / raw) To: linux-kernel, stable Cc: Guilherme G. Piccoli, Kees Cook, Ard Biesheuvel, Sasha Levin, linux-hardening, linux-efi From: "Guilherme G. Piccoli" <gpiccoli@igalia.com> [ Upstream commit 7c23b186ab892088f76a3ad9dbff1685ffe2e832 ] Right now efi-pstore either returns 0 (success) or -EIO; but we do have a function to convert UEFI errors in different standard error codes, helping to narrow down potential issues more accurately. So, let's use this helper here. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/firmware/efi/efi-pstore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 3bddc152fcd43..8b2a9fc436a3f 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -107,7 +107,7 @@ static int efi_pstore_read_func(struct pstore_record *record, &size, record->buf); if (status != EFI_SUCCESS) { kfree(record->buf); - return -EIO; + return efi_status_to_err(status); } /* @@ -152,7 +152,7 @@ static ssize_t efi_pstore_read(struct pstore_record *record) return 0; if (status != EFI_SUCCESS) - return -EIO; + return efi_status_to_err(status); /* skip variables that don't concern us */ if (efi_guidcmp(guid, LINUX_EFI_CRASH_GUID)) @@ -190,7 +190,7 @@ static int efi_pstore_write(struct pstore_record *record) record->size, record->psi->buf, true); efivar_unlock(); - return status == EFI_SUCCESS ? 0 : -EIO; + return efi_status_to_err(status); }; static int efi_pstore_erase(struct pstore_record *record) @@ -201,7 +201,7 @@ static int efi_pstore_erase(struct pstore_record *record) PSTORE_EFI_ATTRIBUTES, 0, NULL); if (status != EFI_SUCCESS && status != EFI_NOT_FOUND) - return -EIO; + return efi_status_to_err(status); return 0; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures 2024-06-17 13:24 ` [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures Sasha Levin @ 2024-06-17 15:16 ` Guilherme G. Piccoli 0 siblings, 0 replies; 5+ messages in thread From: Guilherme G. Piccoli @ 2024-06-17 15:16 UTC (permalink / raw) To: Sasha Levin, Ard Biesheuvel, stable Cc: Kees Cook, linux-hardening, linux-kernel, linux-efi On 17/06/2024 10:24, Sasha Levin wrote: > From: "Guilherme G. Piccoli" <gpiccoli@igalia.com> > > [ Upstream commit 7c23b186ab892088f76a3ad9dbff1685ffe2e832 ] > > Right now efi-pstore either returns 0 (success) or -EIO; but we > do have a function to convert UEFI errors in different standard > error codes, helping to narrow down potential issues more accurately. > > So, let's use this helper here. > > Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> > Reviewed-by: Kees Cook <keescook@chromium.org> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org> > Signed-off-by: Sasha Levin <sashal@kernel.org> Following Ard's comment for the other releases, let's not backport this one. Thanks, Guilherme ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20240618124018.3303162-1-sashal@kernel.org>]
* [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures [not found] <20240618124018.3303162-1-sashal@kernel.org> @ 2024-06-18 12:39 ` Sasha Levin 2024-07-10 9:59 ` Pavel Machek 0 siblings, 1 reply; 5+ messages in thread From: Sasha Levin @ 2024-06-18 12:39 UTC (permalink / raw) To: linux-kernel, stable Cc: Guilherme G. Piccoli, Kees Cook, Ard Biesheuvel, Sasha Levin, linux-hardening, linux-efi From: "Guilherme G. Piccoli" <gpiccoli@igalia.com> [ Upstream commit 7c23b186ab892088f76a3ad9dbff1685ffe2e832 ] Right now efi-pstore either returns 0 (success) or -EIO; but we do have a function to convert UEFI errors in different standard error codes, helping to narrow down potential issues more accurately. So, let's use this helper here. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/firmware/efi/efi-pstore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 3bddc152fcd43..8b2a9fc436a3f 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -107,7 +107,7 @@ static int efi_pstore_read_func(struct pstore_record *record, &size, record->buf); if (status != EFI_SUCCESS) { kfree(record->buf); - return -EIO; + return efi_status_to_err(status); } /* @@ -152,7 +152,7 @@ static ssize_t efi_pstore_read(struct pstore_record *record) return 0; if (status != EFI_SUCCESS) - return -EIO; + return efi_status_to_err(status); /* skip variables that don't concern us */ if (efi_guidcmp(guid, LINUX_EFI_CRASH_GUID)) @@ -190,7 +190,7 @@ static int efi_pstore_write(struct pstore_record *record) record->size, record->psi->buf, true); efivar_unlock(); - return status == EFI_SUCCESS ? 0 : -EIO; + return efi_status_to_err(status); }; static int efi_pstore_erase(struct pstore_record *record) @@ -201,7 +201,7 @@ static int efi_pstore_erase(struct pstore_record *record) PSTORE_EFI_ATTRIBUTES, 0, NULL); if (status != EFI_SUCCESS && status != EFI_NOT_FOUND) - return -EIO; + return efi_status_to_err(status); return 0; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures 2024-06-18 12:39 ` Sasha Levin @ 2024-07-10 9:59 ` Pavel Machek 0 siblings, 0 replies; 5+ messages in thread From: Pavel Machek @ 2024-07-10 9:59 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Guilherme G. Piccoli, Kees Cook, Ard Biesheuvel, linux-hardening, linux-efi [-- Attachment #1: Type: text/plain, Size: 543 bytes --] Hi! > [ Upstream commit 7c23b186ab892088f76a3ad9dbff1685ffe2e832 ] > > Right now efi-pstore either returns 0 (success) or -EIO; but we > do have a function to convert UEFI errors in different standard > error codes, helping to narrow down potential issues more accurately. > > So, let's use this helper here. I don't believe we need this in stable. Best regards, Pavel -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-10 9:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240617132456.2588952-1-sashal@kernel.org>
2024-06-17 13:24 ` [PATCH AUTOSEL 6.1 06/29] efi/libstub: zboot.lds: Discard .discard sections Sasha Levin
2024-06-17 13:24 ` [PATCH AUTOSEL 6.1 07/29] efi: pstore: Return proper errors on UEFI failures Sasha Levin
2024-06-17 15:16 ` Guilherme G. Piccoli
[not found] <20240618124018.3303162-1-sashal@kernel.org>
2024-06-18 12:39 ` Sasha Levin
2024-07-10 9:59 ` Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox