From: Nathan Chancellor <nathan@kernel.org>
To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com
Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, morbo@google.com,
justinstitt@google.com, linux-s390@vger.kernel.org,
llvm@lists.linux.dev, patches@lists.linux.dev,
Ulrich Weigand <ulrich.weigand@de.ibm.com>,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] s390/boot: Add 'alloc' to info.bin .vmlinux.info section flags
Date: Fri, 16 Feb 2024 12:55:53 -0700 [thread overview]
Message-ID: <20240216-s390-fix-boot-with-llvm-objcopy-v1-1-0ac623daf42b@kernel.org> (raw)
When attempting to boot a kernel compiled with OBJCOPY=llvm-objcopy,
there is a crash right at boot:
Out of memory allocating 6d7800 bytes 8 aligned in range 0:20000000
Reserved memory ranges:
0000000000000000 a394c3c30d90cdaf DECOMPRESSOR
Usable online memory ranges (info source: sclp read info [3]):
0000000000000000 0000000020000000
Usable online memory total: 20000000 Reserved: a394c3c30d90cdaf Free: 0
Call Trace:
(sp:0000000000033e90 [<0000000000012fbc>] physmem_alloc_top_down+0x5c/0x104)
sp:0000000000033f00 [<0000000000011d56>] startup_kernel+0x3a6/0x77c
sp:0000000000033f60 [<00000000000100f4>] startup_normal+0xd4/0xd4
GNU objcopy does not have any issues. Looking at differences between the
object files in each build reveals info.bin does not get properly
populated with llvm-objcopy, which results in an empty .vmlinux.info
section.
$ file {gnu,llvm}-objcopy/arch/s390/boot/info.bin
gnu-objcopy/arch/s390/boot/info.bin: data
llvm-objcopy/arch/s390/boot/info.bin: empty
$ llvm-readelf --section-headers {gnu,llvm}-objcopy/arch/s390/boot/vmlinux | rg 'File:|\.vmlinux\.info|\.decompressor\.syms'
File: gnu-objcopy/arch/s390/boot/vmlinux
[12] .vmlinux.info PROGBITS 0000000000034000 035000 000078 00 WA 0 0 1
[13] .decompressor.syms PROGBITS 0000000000034078 035078 000b00 00 WA 0 0 1
File: llvm-objcopy/arch/s390/boot/vmlinux
[12] .vmlinux.info PROGBITS 0000000000034000 035000 000000 00 WA 0 0 1
[13] .decompressor.syms PROGBITS 0000000000034000 035000 000b00 00 WA 0 0 1
Ulrich points out that llvm-objcopy only copies sections marked as alloc
with a binary output target, whereas the .vmlinux.info section is only
marked as load. Add 'alloc' in addition to 'load', so that both objcopy
implementations work properly:
$ file {gnu,llvm}-objcopy/arch/s390/boot/info.bin
gnu-objcopy/arch/s390/boot/info.bin: data
llvm-objcopy/arch/s390/boot/info.bin: data
$ llvm-readelf --section-headers {gnu,llvm}-objcopy/arch/s390/boot/vmlinux | rg 'File:|\.vmlinux\.info|\.decompressor\.syms'
File: gnu-objcopy/arch/s390/boot/vmlinux
[12] .vmlinux.info PROGBITS 0000000000034000 035000 000078 00 WA 0 0 1
[13] .decompressor.syms PROGBITS 0000000000034078 035078 000b00 00 WA 0 0 1
File: llvm-objcopy/arch/s390/boot/vmlinux
[12] .vmlinux.info PROGBITS 0000000000034000 035000 000078 00 WA 0 0 1
[13] .decompressor.syms PROGBITS 0000000000034078 035078 000b00 00 WA 0 0 1
Closes: https://github.com/ClangBuiltLinux/linux/issues/1996
Link: https://github.com/llvm/llvm-project/commit/3c02cb7492fc78fb678264cebf57ff88e478e14f
Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
No fixes tag because I have not tested to see if there are other issues
on older kernel versions yet (so I don't think prioritizing a backport
is necessary yet) but I think commit 5a2e1853d689 ("s390: avoid vmlinux
segments overlap") introduced this.
---
arch/s390/boot/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index ace0bda1ad24..d40135efdec4 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -94,7 +94,7 @@ OBJCOPYFLAGS_syms.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .
$(obj)/syms.o: $(obj)/syms.bin FORCE
$(call if_changed,objcopy)
-OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load
+OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=alloc,load
$(obj)/info.bin: vmlinux FORCE
$(call if_changed,objcopy)
---
base-commit: 03325e9b64c48313527f0373c4688d393b1edaf3
change-id: 20240216-s390-fix-boot-with-llvm-objcopy-019a7638e5bf
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
next reply other threads:[~2024-02-16 19:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 19:55 Nathan Chancellor [this message]
2024-02-19 11:32 ` [PATCH] s390/boot: Add 'alloc' to info.bin .vmlinux.info section flags Heiko Carstens
2024-02-19 23:16 ` Nathan Chancellor
2024-02-20 19:15 ` Heiko Carstens
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=20240216-s390-fix-boot-with-llvm-objcopy-v1-1-0ac623daf42b@kernel.org \
--to=nathan@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=justinstitt@google.com \
--cc=linux-s390@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=patches@lists.linux.dev \
--cc=svens@linux.ibm.com \
--cc=ulrich.weigand@de.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.