* [GIT PULL] urgent EFI fix for v4.9
@ 2016-10-18 15:53 Ard Biesheuvel
2016-10-18 15:53 ` [PATCH] efi/arm: Fix absolute relocation detection for older toolchains Ard Biesheuvel
2016-10-19 12:51 ` [GIT PULL] urgent EFI fix for v4.9 Ingo Molnar
0 siblings, 2 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2016-10-18 15:53 UTC (permalink / raw)
To: mingo, Thomas Gleixner, H . Peter Anvin
Cc: Ard Biesheuvel, linux-kernel, linux-efi, Jon Hunter, Matt Fleming
Please merge the single fix below: it addresses a build issue on ARM with
less recent toolchain versions, which surfaced now that EFI has been added
to multi_v7_defconfig, the de facto generic defconfig for the most recent
cores.
The following changes since commit b67be92feb486f800d80d72c67fd87b47b79b18e:
Merge tag 'pwm/for-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm (2016-10-12 11:11:05 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-urgent
for you to fetch changes up to 0d5b726f1009d05657ec71c716ba6529dcc98d2b:
efi/arm: Fix absolute relocation detection for older toolchains (2016-10-14 10:57:59 +0100)
----------------------------------------------------------------
* Fix a build issue in the ARM version of libstub with slightly older
toolchains
----------------------------------------------------------------
Ard Biesheuvel (1):
efi/arm: Fix absolute relocation detection for older toolchains
drivers/firmware/efi/libstub/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] efi/arm: Fix absolute relocation detection for older toolchains
2016-10-18 15:53 [GIT PULL] urgent EFI fix for v4.9 Ard Biesheuvel
@ 2016-10-18 15:53 ` Ard Biesheuvel
2016-10-19 12:51 ` [tip:efi/urgent] " tip-bot for Ard Biesheuvel
2016-10-19 12:51 ` [GIT PULL] urgent EFI fix for v4.9 Ingo Molnar
1 sibling, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2016-10-18 15:53 UTC (permalink / raw)
To: mingo, Thomas Gleixner, H . Peter Anvin
Cc: Ard Biesheuvel, linux-kernel, linux-efi
When building the ARM kernel with CONFIG_EFI=y, the following build
error may occur when using a less recent version of binutils (2.23 or
older):
STUBCPY drivers/firmware/efi/libstub/lib-sort.stub.o
00000000 R_ARM_ABS32 sort
00000004 R_ARM_ABS32 __ksymtab_strings
drivers/firmware/efi/libstub/lib-sort.stub.o: absolute symbol references
not allowed in the EFI stub
(and when building with debug symbols, the list above is much longer, and
contains all the internal references between the .debug sections and the
actual code)
This issue is caused by the fact that objcopy v2.23 or earlier does not
support wildcards in its -R and -j options, which means the following
line from the Makefile:
STUBCOPY_FLAGS-y := -R .debug* -R *ksymtab* -R *kcrctab*
fails to take effect, leaving harmless absolute relocations in the binary
that are indistinguishable from relocations that may cause crashes at
runtime due to the fact that these relocations are resolved at link time
using the virtual address of the kernel, which is always different from
the address at which the EFI firmware loads and invokes the stub.
So, as a workaround, disable debug symbols explicitly when building the
stub for ARM, and strip the ksymtab and kcrctab symbols for the only
exported symbol we currently reuse in the stub, which is 'sort'.
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/firmware/efi/libstub/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index c06945160a41..5e23e2d305e7 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -11,7 +11,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
-mno-mmx -mno-sse
cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS))
-cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \
+cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) -g0 \
-fno-builtin -fpic -mno-single-pic-base
cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt
@@ -79,5 +79,6 @@ quiet_cmd_stubcopy = STUBCPY $@
# decompressor. So move our .data to .data.efistub, which is preserved
# explicitly by the decompressor linker script.
#
-STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
+STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub \
+ -R ___ksymtab+sort -R ___kcrctab+sort
STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [GIT PULL] urgent EFI fix for v4.9
2016-10-18 15:53 [GIT PULL] urgent EFI fix for v4.9 Ard Biesheuvel
2016-10-18 15:53 ` [PATCH] efi/arm: Fix absolute relocation detection for older toolchains Ard Biesheuvel
@ 2016-10-19 12:51 ` Ingo Molnar
1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2016-10-19 12:51 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Thomas Gleixner, H . Peter Anvin, linux-kernel, linux-efi,
Jon Hunter, Matt Fleming
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> Please merge the single fix below: it addresses a build issue on ARM with
> less recent toolchain versions, which surfaced now that EFI has been added
> to multi_v7_defconfig, the de facto generic defconfig for the most recent
> cores.
>
> The following changes since commit b67be92feb486f800d80d72c67fd87b47b79b18e:
>
> Merge tag 'pwm/for-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm (2016-10-12 11:11:05 -0700)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-urgent
>
> for you to fetch changes up to 0d5b726f1009d05657ec71c716ba6529dcc98d2b:
>
> efi/arm: Fix absolute relocation detection for older toolchains (2016-10-14 10:57:59 +0100)
>
> ----------------------------------------------------------------
> * Fix a build issue in the ARM version of libstub with slightly older
> toolchains
>
> ----------------------------------------------------------------
> Ard Biesheuvel (1):
> efi/arm: Fix absolute relocation detection for older toolchains
>
> drivers/firmware/efi/libstub/Makefile | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied, thanks Ard!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:efi/urgent] efi/arm: Fix absolute relocation detection for older toolchains
2016-10-18 15:53 ` [PATCH] efi/arm: Fix absolute relocation detection for older toolchains Ard Biesheuvel
@ 2016-10-19 12:51 ` tip-bot for Ard Biesheuvel
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Ard Biesheuvel @ 2016-10-19 12:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, hpa, jonathanh, ard.biesheuvel, linux-kernel, torvalds,
matt, tglx, peterz
Commit-ID: b0dddf6c147e6fe61374d625c4bb2b7c52018639
Gitweb: http://git.kernel.org/tip/b0dddf6c147e6fe61374d625c4bb2b7c52018639
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
AuthorDate: Tue, 18 Oct 2016 16:53:11 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Oct 2016 14:49:44 +0200
efi/arm: Fix absolute relocation detection for older toolchains
When building the ARM kernel with CONFIG_EFI=y, the following build
error may occur when using a less recent version of binutils (2.23 or
older):
STUBCPY drivers/firmware/efi/libstub/lib-sort.stub.o
00000000 R_ARM_ABS32 sort
00000004 R_ARM_ABS32 __ksymtab_strings
drivers/firmware/efi/libstub/lib-sort.stub.o: absolute symbol references not allowed in the EFI stub
(and when building with debug symbols, the list above is much longer, and
contains all the internal references between the .debug sections and the
actual code)
This issue is caused by the fact that objcopy v2.23 or earlier does not
support wildcards in its -R and -j options, which means the following
line from the Makefile:
STUBCOPY_FLAGS-y := -R .debug* -R *ksymtab* -R *kcrctab*
fails to take effect, leaving harmless absolute relocations in the binary
that are indistinguishable from relocations that may cause crashes at
runtime due to the fact that these relocations are resolved at link time
using the virtual address of the kernel, which is always different from
the address at which the EFI firmware loads and invokes the stub.
So, as a workaround, disable debug symbols explicitly when building the
stub for ARM, and strip the ksymtab and kcrctab symbols for the only
exported symbol we currently reuse in the stub, which is 'sort'.
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1476805991-7160-2-git-send-email-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index c069451..5e23e2d 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -11,7 +11,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
-mno-mmx -mno-sse
cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS))
-cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \
+cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) -g0 \
-fno-builtin -fpic -mno-single-pic-base
cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt
@@ -79,5 +79,6 @@ quiet_cmd_stubcopy = STUBCPY $@
# decompressor. So move our .data to .data.efistub, which is preserved
# explicitly by the decompressor linker script.
#
-STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
+STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub \
+ -R ___ksymtab+sort -R ___kcrctab+sort
STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-19 14:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 15:53 [GIT PULL] urgent EFI fix for v4.9 Ard Biesheuvel
2016-10-18 15:53 ` [PATCH] efi/arm: Fix absolute relocation detection for older toolchains Ard Biesheuvel
2016-10-19 12:51 ` [tip:efi/urgent] " tip-bot for Ard Biesheuvel
2016-10-19 12:51 ` [GIT PULL] urgent EFI fix for v4.9 Ingo Molnar
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 NNTP newsgroup(s).