|
|
28ab1c |
From c6d8832f86bc2ef7fbab6f703479816dd6078902 Mon Sep 17 00:00:00 2001
|
|
|
28ab1c |
From: Pingfan Liu <piliu@redhat.com>
|
|
|
28ab1c |
Date: Fri, 9 Jul 2021 11:55:16 +0800
|
|
|
28ab1c |
Subject: [PATCH] fix(squash): keep ld cache under initdir
|
|
|
28ab1c |
|
|
|
28ab1c |
When running kdump on PowerPC, the following bug is hit:
|
|
|
28ab1c |
[ 0.391629] Freeing unused kernel memory: 5568K
|
|
|
28ab1c |
[ 0.391634] This architecture does not have kernel memory protection.
|
|
|
28ab1c |
/bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
|
|
|
28ab1c |
[ 0.392214] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
|
|
|
28ab1c |
[ 0.392214]
|
|
|
28ab1c |
[ 0.392223] CPU: 6 PID: 1 Comm: init Not tainted 4.18.0-319.el8.ppc64le #1
|
|
|
28ab1c |
[ 0.392228] Call Trace:
|
|
|
28ab1c |
[ 0.392234] [c00000000c703c10] [c000000008ecb94c] dump_stack+0xb0/0xf4 (unreliable)
|
|
|
28ab1c |
[ 0.392243] [c00000000c703c50] [c000000008167324] panic+0x148/0x3c4
|
|
|
28ab1c |
[ 0.392249] [c00000000c703cf0] [c000000008170474] do_exit+0xcd4/0xd40
|
|
|
28ab1c |
[ 0.392255] [c00000000c703dc0] [c0000000081705b0] do_group_exit+0x60/0x110
|
|
|
28ab1c |
[ 0.392261] [c00000000c703e00] [c000000008170684] sys_exit_group+0x24/0x30
|
|
|
28ab1c |
[ 0.392268] [c00000000c703e20] [c00000000800b408] system_call+0x5c/0x70
|
|
|
28ab1c |
|
|
|
28ab1c |
This is due to the non-conventional library path:
|
|
|
28ab1c |
ldd /bin/bash
|
|
|
28ab1c |
linux-vdso64.so.1 (0x00007fffbdc90000)
|
|
|
28ab1c |
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fffbda80000)
|
|
|
28ab1c |
libdl.so.2 => /lib64/libdl.so.2 (0x00007fffbda50000)
|
|
|
28ab1c |
libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffbd830000)
|
|
|
28ab1c |
^^^
|
|
|
28ab1c |
/lib64/ld64.so.2 (0x00007fffbdcb0000)
|
|
|
28ab1c |
|
|
|
28ab1c |
ldd finds the path by libc.so.6 -> /usr/lib64/libc.so.6 ->
|
|
|
28ab1c |
/usr/lib64/glibc-hwcaps/power9/libc-2.28.so and cache the result. So
|
|
|
28ab1c |
when dracut_install, it only saw
|
|
|
28ab1c |
'/usr/lib64/glibc-hwcaps/power9/libc-2.28.so' and blind to
|
|
|
28ab1c |
'/usr/lib64/libc.so.6'
|
|
|
28ab1c |
|
|
|
28ab1c |
In the final kdumpimg, the symlink /usr/lib64/libc.so.6 is not created,
|
|
|
28ab1c |
hence ld.so can not find the /usr/lib64/glibc-hwcaps/power9/libc-2.28.so
|
|
|
28ab1c |
|
|
|
28ab1c |
On the other hand, during the process of building kdumpimg, all of dynamic library info
|
|
|
28ab1c |
have been cached in ld.so.cache. Hence this bug can be simplely resolved
|
|
|
28ab1c |
by keeping ld cache under $initdir/etc.
|
|
|
28ab1c |
|
|
|
28ab1c |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
28ab1c |
---
|
|
|
28ab1c |
v3 -> v4:
|
|
|
28ab1c |
use inst() instead of copy
|
|
|
28ab1c |
v2 -> v3:
|
|
|
28ab1c |
fix format by shfmt -s -w modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
v1 -> v2:
|
|
|
28ab1c |
cp -r /etc/ld.so* instead of move, since after switch-root, initdir
|
|
|
28ab1c |
can not be seen any longer
|
|
|
28ab1c |
|
|
|
28ab1c |
(cherry picked from commit dc21638c3f0acbb54417f3bfb6294ad5514bf2db)
|
|
|
28ab1c |
|
|
|
28ab1c |
Resolves: #1959336
|
|
|
28ab1c |
---
|
|
|
28ab1c |
modules.d/99squash/module-setup.sh | 5 +++++
|
|
|
28ab1c |
1 file changed, 5 insertions(+)
|
|
|
28ab1c |
|
|
|
28ab1c |
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
index 8c9982c0..14790ce8 100644
|
|
|
28ab1c |
--- a/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
+++ b/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
@@ -28,6 +28,11 @@ installpost() {
|
|
|
28ab1c |
[[ "$squash_dir" == "$i"/* ]] || mv "$i" "$squash_dir"/
|
|
|
28ab1c |
done
|
|
|
28ab1c |
|
|
|
28ab1c |
+ # initdir also needs ld.so.* to make ld.so work
|
|
|
28ab1c |
+ inst /etc/ld.so.cache
|
|
|
28ab1c |
+ inst /etc/ld.so.conf
|
|
|
28ab1c |
+ inst_dir /etc/ld.so.conf.d/
|
|
|
28ab1c |
+
|
|
|
28ab1c |
# Create mount points for squash loader
|
|
|
28ab1c |
mkdir -p "$initdir"/squash/
|
|
|
28ab1c |
mkdir -p "$squash_dir"/squash/
|
|
|
28ab1c |
|