Compare commits
21 Commits
Author | SHA1 | Date |
---|---|---|
Dave Young | a1ad90ddfb | |
Baoquan He | c01c6ee155 | |
Dave Young | 8b655579b4 | |
Pratyush Anand | 34b35a88f5 | |
Dave Young | 05c2f08358 | |
Dave Young | 4baeadff5c | |
Dave Young | 0849844372 | |
Pratyush Anand | 3d7e34e4ee | |
Dave Young | d9cecb0526 | |
Pingfan Liu | 399961a670 | |
Dave Young | 90f32e6c81 | |
Dave Young | 1ce9d9be40 | |
Pratyush Anand | 91106c16b7 | |
Pratyush Anand | 5168828da0 | |
Pratyush Anand | a548f13168 | |
Pratyush Anand | 85c3b6ca87 | |
Dave Young | d3d077f0be | |
Dave Young | a4fa9bd19b | |
Dave Young | a481c24f6d | |
Dave Young | fdbbf88e6f | |
Dave Young | 7242e2decb |
|
@ -146,10 +146,6 @@ read_kdump_conf()
|
|||
# remove inline comments after the end of a directive.
|
||||
config_val=$(strip_comments $config_val)
|
||||
case "$config_opt" in
|
||||
dracut_args)
|
||||
config_val=$(get_dracut_args_target "$config_val")
|
||||
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
|
|
|
@ -450,11 +450,6 @@ kdump_install_conf() {
|
|||
ssh|nfs)
|
||||
kdump_install_net "$config_val"
|
||||
;;
|
||||
dracut_args)
|
||||
if [[ $(get_dracut_args_fstype "$config_val") = nfs* ]] ; then
|
||||
kdump_install_net "$(get_dracut_args_target "$config_val")"
|
||||
fi
|
||||
;;
|
||||
kdump_pre|kdump_post|extra_bins)
|
||||
dracut_install $config_val
|
||||
;;
|
||||
|
|
32
kdump-lib.sh
32
kdump-lib.sh
|
@ -23,8 +23,7 @@ is_ssh_dump_target()
|
|||
|
||||
is_nfs_dump_target()
|
||||
{
|
||||
grep -q "^nfs" /etc/kdump.conf || \
|
||||
[[ $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") = nfs* ]]
|
||||
grep -q "^nfs" /etc/kdump.conf
|
||||
}
|
||||
|
||||
is_raw_dump_target()
|
||||
|
@ -46,8 +45,7 @@ is_fs_dump_target()
|
|||
|
||||
is_user_configured_dump_target()
|
||||
{
|
||||
return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
|
||||
is_raw_dump_target || is_fs_dump_target)
|
||||
return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
|
||||
}
|
||||
|
||||
strip_comments()
|
||||
|
@ -176,7 +174,11 @@ get_mntpoint_from_path()
|
|||
|
||||
get_target_from_path()
|
||||
{
|
||||
echo $(df $1 | tail -1 | awk '{print $1}')
|
||||
local _target
|
||||
|
||||
_target=$(df $1 2>/dev/null | tail -1 | awk '{print $1}')
|
||||
[[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device)
|
||||
echo $_target
|
||||
}
|
||||
|
||||
get_fs_type_from_target()
|
||||
|
@ -408,23 +410,3 @@ is_wdt_mod_omitted() {
|
|||
|
||||
return $ret
|
||||
}
|
||||
|
||||
# If "dracut_args" contains "--mount" information, use it
|
||||
# directly without any check(users are expected to ensure
|
||||
# its correctness).
|
||||
is_mount_in_dracut_args()
|
||||
{
|
||||
grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf
|
||||
}
|
||||
|
||||
# If $1 contains dracut_args "--mount", return <filesystem type>
|
||||
get_dracut_args_fstype()
|
||||
{
|
||||
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3
|
||||
}
|
||||
|
||||
# If $1 contains dracut_args "--mount", return <device>
|
||||
get_dracut_args_target()
|
||||
{
|
||||
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
|
|||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never"
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
|
|
46
kdumpctl
46
kdumpctl
|
@ -236,18 +236,12 @@ check_config()
|
|||
{
|
||||
local nr
|
||||
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
[ $nr -gt 1 ] && {
|
||||
echo "More than one dump targets specified."
|
||||
return 1
|
||||
}
|
||||
|
||||
nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l)
|
||||
[ $nr -gt 1 ] && {
|
||||
echo "Multiple mount targets specified in one \"dracut_args\"."
|
||||
return 1
|
||||
}
|
||||
|
||||
while read config_opt config_val; do
|
||||
# remove inline comments after the end of a directive.
|
||||
config_val=$(strip_comments $config_val)
|
||||
|
@ -345,7 +339,8 @@ check_files_modified()
|
|||
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
|
||||
CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
|
||||
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
|
||||
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS /etc/fstab"
|
||||
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
|
||||
[[ -e /etc/fstab ]] && files="$files /etc/fstab"
|
||||
|
||||
check_exist "$files" && check_executable "$EXTRA_BINS"
|
||||
[ $? -ne 0 ] && return 2
|
||||
|
@ -371,11 +366,6 @@ check_dump_fs_modified()
|
|||
local _new_dev _new_mntpoint _new_fstype
|
||||
local _target _path _dracut_args
|
||||
|
||||
# No need to check in case of mount target specified via "dracut_args".
|
||||
if is_mount_in_dracut_args; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# No need to check in case of raw target.
|
||||
# Currently we do not check also if ssh/nfs target is specified
|
||||
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
|
||||
|
@ -389,9 +379,9 @@ check_dump_fs_modified()
|
|||
_new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d '"' -f 2)
|
||||
else
|
||||
_path=$(get_save_path)
|
||||
set -- $(df -T $_path 2>/dev/null | tail -1 | awk '{ print $1, $2}')
|
||||
_target=$(to_dev_name $1)
|
||||
_new_fstype=$2
|
||||
_target=$(get_target_from_path $_path)
|
||||
_target=$(to_dev_name $_target)
|
||||
_new_fstype=$(get_fs_type_from_target $_target)
|
||||
if [[ -z "$_target" || -z "$_new_fstype" ]];then
|
||||
echo "Dump path $_path does not exist"
|
||||
return 2
|
||||
|
@ -402,10 +392,6 @@ check_dump_fs_modified()
|
|||
_new_dev=$_target
|
||||
else
|
||||
_new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
|
||||
if ! findmnt $_target >/dev/null; then
|
||||
echo "Dump target $_target is probably not mounted."
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! findmnt $_target >/dev/null; then
|
||||
|
@ -542,26 +528,6 @@ check_rebuild()
|
|||
image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
|
||||
fi
|
||||
|
||||
#also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled.
|
||||
modified_files=$(get_pcs_cluster_modified_files $image_time)
|
||||
|
||||
EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2`
|
||||
CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2`
|
||||
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
|
||||
CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
|
||||
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
|
||||
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS /etc/fstab"
|
||||
|
||||
check_exist "$files" && check_executable "$EXTRA_BINS"
|
||||
[ $? -ne 0 ] && return 1
|
||||
|
||||
for file in $files; do
|
||||
time_stamp=`stat -c "%Y" $file`
|
||||
if [ "$time_stamp" -gt "$image_time" ]; then
|
||||
modified_files="$modified_files $file"
|
||||
fi
|
||||
done
|
||||
|
||||
check_system_modified
|
||||
ret=$?
|
||||
if [ $ret -eq 2 ]; then
|
||||
|
|
|
@ -345,24 +345,6 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the
|
|||
kdump service via '/sbin/systemctl restart kdump.service' to commit this change
|
||||
to your kdump initrd.
|
||||
|
||||
Special mount via "dracut_args"
|
||||
|
||||
You can utilize "dracut_args" to pass "--mount" to kdump, see dracut manpage
|
||||
about the format of "--mount" for details. If there is any "--mount" specified
|
||||
via "dracut_args", kdump will build it as the mount target without doing any
|
||||
validation (mounting or checking like mount options, fs size, save path, etc),
|
||||
so you must test it to ensure all the correctness. You cannot use other targets
|
||||
in /etc/kdump.conf if you use "--mount" in "dracut_args". You also cannot specify
|
||||
mutliple "--mount" targets via "dracut_args".
|
||||
|
||||
One use case of "--mount" in "dracut_args" is you do not want to mount dump target
|
||||
before kdump service startup, for example, to reduce the burden of the shared nfs
|
||||
server. Such as the example below:
|
||||
dracut_args --mount "192.168.1.1:/share /mnt/test nfs4 defaults"
|
||||
|
||||
NOTE:
|
||||
- <mountpoint> must be specified as an absolute path.
|
||||
|
||||
Remote system via ssh/scp
|
||||
|
||||
Dumping over ssh/scp requires setting up passwordless ssh keys for every
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,106 @@
|
|||
From patchwork Thu Oct 20 10:43:31 2016
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2] arm64: Add support for additional relocations in the kexec
|
||||
purgatory code
|
||||
From: Catalin Marinas <catalin.marinas@arm.com>
|
||||
X-Patchwork-Id: 9386541
|
||||
Message-Id: <1476960211-25594-1-git-send-email-catalin.marinas@arm.com>
|
||||
To: Simon Horman <horms@verge.net.au>
|
||||
Cc: Geoff Levand <geoff@infradead.org>, kexec@lists.infradead.org,
|
||||
linux-arm-kernel@lists.infradead.org
|
||||
Date: Thu, 20 Oct 2016 11:43:31 +0100
|
||||
|
||||
When compiling the kexec-tools with gcc6, the following additional
|
||||
reolcations are generated in the purgatory.ro file:
|
||||
|
||||
R_AARCH64_ADR_PREL_PG_HI21
|
||||
R_AARCH64_ADD_ABS_LO12_NC
|
||||
R_AARCH64_LDST64_ABS_LO12_NC
|
||||
|
||||
This patch modifies the arm64 machine_apply_elf_rel() function to handle
|
||||
these relocations.
|
||||
|
||||
Cc: Geoff Levand <geoff@infradead.org>
|
||||
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
|
||||
Reviewed-by: Geoff Levand <geoff@infradead.org>
|
||||
---
|
||||
|
||||
Changes for v2:
|
||||
- Fixed the type string to drop the "R_AARCH64_" prefix
|
||||
|
||||
kexec/arch/arm64/kexec-arm64.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 35 insertions(+)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index 2e8839a..e067a23 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -550,6 +550,14 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
# define R_AARCH64_ADR_PREL_LO21 274
|
||||
#endif
|
||||
|
||||
+#if !defined(R_AARCH64_ADR_PREL_PG_HI21)
|
||||
+# define R_AARCH64_ADR_PREL_PG_HI21 275
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(R_AARCH64_ADD_ABS_LO12_NC)
|
||||
+# define R_AARCH64_ADD_ABS_LO12_NC 277
|
||||
+#endif
|
||||
+
|
||||
#if !defined(R_AARCH64_JUMP26)
|
||||
# define R_AARCH64_JUMP26 282
|
||||
#endif
|
||||
@@ -558,10 +566,15 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
# define R_AARCH64_CALL26 283
|
||||
#endif
|
||||
|
||||
+#if !defined(R_AARCH64_LDST64_ABS_LO12_NC)
|
||||
+# define R_AARCH64_LDST64_ABS_LO12_NC 286
|
||||
+#endif
|
||||
+
|
||||
uint64_t *loc64;
|
||||
uint32_t *loc32;
|
||||
uint64_t *location = (uint64_t *)ptr;
|
||||
uint64_t data = *location;
|
||||
+ uint64_t imm;
|
||||
const char *type = NULL;
|
||||
|
||||
switch(r_type) {
|
||||
@@ -585,6 +598,19 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
*loc32 = cpu_to_le32(le32_to_cpu(*loc32)
|
||||
+ (((value - address) << 3) & 0xffffe0));
|
||||
break;
|
||||
+ case R_AARCH64_ADR_PREL_PG_HI21:
|
||||
+ type = "ADR_PREL_PG_HI21";
|
||||
+ imm = ((value & ~0xfff) - (address & ~0xfff)) >> 12;
|
||||
+ loc32 = ptr;
|
||||
+ *loc32 = cpu_to_le32(le32_to_cpu(*loc32)
|
||||
+ + ((imm & 3) << 29) + ((imm & 0x1ffffc) << (5 - 2)));
|
||||
+ break;
|
||||
+ case R_AARCH64_ADD_ABS_LO12_NC:
|
||||
+ type = "ADD_ABS_LO12_NC";
|
||||
+ loc32 = ptr;
|
||||
+ *loc32 = cpu_to_le32(le32_to_cpu(*loc32)
|
||||
+ + ((value & 0xfff) << 10));
|
||||
+ break;
|
||||
case R_AARCH64_JUMP26:
|
||||
type = "JUMP26";
|
||||
loc32 = ptr;
|
||||
@@ -597,6 +623,15 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
*loc32 = cpu_to_le32(le32_to_cpu(*loc32)
|
||||
+ (((value - address) >> 2) & 0x3ffffff));
|
||||
break;
|
||||
+ case R_AARCH64_LDST64_ABS_LO12_NC:
|
||||
+ if (value & 7)
|
||||
+ die("%s: ERROR Unaligned value: %lx\n", __func__,
|
||||
+ value);
|
||||
+ type = "LDST64_ABS_LO12_NC";
|
||||
+ loc32 = ptr;
|
||||
+ *loc32 = cpu_to_le32(le32_to_cpu(*loc32)
|
||||
+ + ((value & 0xff8) << (10 - 3)));
|
||||
+ break;
|
||||
default:
|
||||
die("%s: ERROR Unknown type: %lu\n", __func__, r_type);
|
||||
break;
|
|
@ -0,0 +1,96 @@
|
|||
From abdfe97736f89d9bc73662b9134604b0229a599e Mon Sep 17 00:00:00 2001
|
||||
From: Pratyush Anand <panand@redhat.com>
|
||||
Date: Wed, 21 Sep 2016 18:14:25 +0000
|
||||
Subject: [PATCH 3/3] arm64: Add support for binary image files
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
[Reworked and cleaned up]
|
||||
Signed-off-by: Geoff Levand <geoff@infradead.org>
|
||||
Tested-By: Pratyush Anand <panand@redhat.com>
|
||||
Tested-By: Matthias Brugger <mbrugger@suse.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/arm64/kexec-image-arm64.c | 49 ++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 44 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
|
||||
index 42d2ea7..960ed96 100644
|
||||
--- a/kexec/arch/arm64/kexec-image-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-image-arm64.c
|
||||
@@ -3,7 +3,9 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
+
|
||||
#include "kexec-arm64.h"
|
||||
+#include <limits.h>
|
||||
|
||||
int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
|
||||
{
|
||||
@@ -21,14 +23,53 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- fprintf(stderr, "kexec: ARM64 binary image files are currently NOT SUPPORTED.\n");
|
||||
- return -1;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int image_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||
off_t kernel_size, struct kexec_info *info)
|
||||
{
|
||||
- return -1;
|
||||
+ const struct arm64_image_header *header;
|
||||
+ unsigned long kernel_segment;
|
||||
+ int result;
|
||||
+
|
||||
+ header = (const struct arm64_image_header *)(kernel_buf);
|
||||
+
|
||||
+ if (arm64_process_image_header(header))
|
||||
+ return -1;
|
||||
+
|
||||
+ kernel_segment = arm64_locate_kernel_segment(info);
|
||||
+
|
||||
+ if (kernel_segment == ULONG_MAX) {
|
||||
+ dbgprintf("%s: Kernel segment is not allocated\n", __func__);
|
||||
+ result = -EFAILED;
|
||||
+ goto exit;
|
||||
+ }
|
||||
+
|
||||
+ dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
|
||||
+ dbgprintf("%s: text_offset: %016lx\n", __func__,
|
||||
+ arm64_mem.text_offset);
|
||||
+ dbgprintf("%s: image_size: %016lx\n", __func__,
|
||||
+ arm64_mem.image_size);
|
||||
+ dbgprintf("%s: phys_offset: %016lx\n", __func__,
|
||||
+ arm64_mem.phys_offset);
|
||||
+ dbgprintf("%s: vp_offset: %016lx\n", __func__,
|
||||
+ arm64_mem.vp_offset);
|
||||
+ dbgprintf("%s: PE format: %s\n", __func__,
|
||||
+ (arm64_header_check_pe_sig(header) ? "yes" : "no"));
|
||||
+
|
||||
+ /* load the kernel */
|
||||
+ add_segment_phys_virt(info, kernel_buf, kernel_size,
|
||||
+ kernel_segment + arm64_mem.text_offset,
|
||||
+ arm64_mem.image_size, 0);
|
||||
+
|
||||
+ result = arm64_load_other_segments(info, kernel_segment
|
||||
+ + arm64_mem.text_offset);
|
||||
+
|
||||
+exit:
|
||||
+ if (result)
|
||||
+ fprintf(stderr, "kexec: load failed.\n");
|
||||
+ return result;
|
||||
}
|
||||
|
||||
void image_arm64_usage(void)
|
||||
@@ -36,6 +77,4 @@ void image_arm64_usage(void)
|
||||
printf(
|
||||
" An ARM64 binary image, compressed or not, big or little endian.\n"
|
||||
" Typically an Image, Image.gz or Image.lzma file.\n\n");
|
||||
- printf(
|
||||
-" ARM64 binary image files are currently NOT SUPPORTED.\n\n");
|
||||
}
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
From 3a3c61cb7f129936e5752d1ccc304c183575a8b0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3a3c61cb7f129936e5752d1ccc304c183575a8b0.1477402102.git.panand@redhat.com>
|
||||
From: Pratyush Anand <panand@redhat.com>
|
||||
Date: Tue, 25 Oct 2016 18:55:49 +0530
|
||||
Subject: [PATCH] arm64: Add support of R_AARCH64_PREL32 relocation in
|
||||
purgatory
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index 218f0bc832cd..b12de4772412 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -720,6 +720,10 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
# define R_AARCH64_ABS64 257
|
||||
#endif
|
||||
|
||||
+#if !defined(R_AARCH64_PREL32)
|
||||
+# define R_AARCH64_PREL32 261
|
||||
+#endif
|
||||
+
|
||||
#if !defined(R_AARCH64_LD_PREL_LO19)
|
||||
# define R_AARCH64_LD_PREL_LO19 273
|
||||
#endif
|
||||
@@ -761,6 +765,11 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *UNUSED(sym),
|
||||
loc64 = ptr;
|
||||
*loc64 = cpu_to_elf64(ehdr, elf64_to_cpu(ehdr, *loc64) + value);
|
||||
break;
|
||||
+ case R_AARCH64_PREL32:
|
||||
+ type = "PREL32";
|
||||
+ loc32 = ptr;
|
||||
+ *loc32 = cpu_to_elf32(ehdr, elf32_to_cpu(ehdr, *loc32) + value - address);
|
||||
+ break;
|
||||
case R_AARCH64_LD_PREL_LO19:
|
||||
type = "LD_PREL_LO19";
|
||||
loc32 = ptr;
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
From ed15ba1b9977e506637ff1697821d97127b2c919 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ed15ba1b9977e506637ff1697821d97127b2c919.1491794671.git.panand@redhat.com>
|
||||
From: Pratyush Anand <panand@redhat.com>
|
||||
Date: Wed, 1 Mar 2017 11:19:42 +0530
|
||||
Subject: [PATCH] build_mem_phdrs(): check if p_paddr is invalid
|
||||
|
||||
Currently, all the p_paddr of PT_LOAD headers are assigned to 0, which
|
||||
is not correct and could be misleading, since 0 is a valid physical
|
||||
address.
|
||||
|
||||
Upstream kernel commit "464920104bf7 /proc/kcore: update physical
|
||||
address for kcore ram and text" fixed it and now invalid PT_LOAD is
|
||||
assigned as -1.
|
||||
|
||||
kexec/arch/i386/crashdump-x86.c:get_kernel_vaddr_and_size() uses kcore
|
||||
interface and so calls build_mem_phdrs() for kcore PT_LOAD headers.
|
||||
|
||||
This patch fixes build_mem_phdrs() to check if p_paddr is invalid.
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
Acked-by: Dave Young <dyoung@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/kexec-elf.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
|
||||
index 1d6320a2f0e6..be60bbd48486 100644
|
||||
--- a/kexec/kexec-elf.c
|
||||
+++ b/kexec/kexec-elf.c
|
||||
@@ -432,7 +432,8 @@ static int build_mem_phdrs(const char *buf, off_t len, struct mem_ehdr *ehdr,
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
- if ((phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
||||
+ if (phdr->p_paddr != (unsigned long long)-1 &&
|
||||
+ (phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
||||
/* The memory address wraps */
|
||||
if (probe_debug) {
|
||||
fprintf(stderr, "ELF address wrap around\n");
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
From 217bcc00c9309416a6c6cd0584196559d28a9259 Mon Sep 17 00:00:00 2001
|
||||
From: Geoff Levand <geoff@infradead.org>
|
||||
Date: Wed, 21 Sep 2016 18:14:25 +0000
|
||||
Subject: [PATCH 1/3] kexec: Add common device tree routines
|
||||
|
||||
Common device tree routines that can be shared between all arches
|
||||
that have device tree support.
|
||||
|
||||
Signed-off-by: Geoff Levand <geoff@infradead.org>
|
||||
Tested-By: Pratyush Anand <panand@redhat.com>
|
||||
Tested-By: Matthias Brugger <mbrugger@suse.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/Makefile | 4 ++
|
||||
kexec/dt-ops.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
kexec/dt-ops.h | 13 ++++++
|
||||
3 files changed, 162 insertions(+)
|
||||
create mode 100644 kexec/dt-ops.c
|
||||
create mode 100644 kexec/dt-ops.h
|
||||
|
||||
diff --git a/kexec/Makefile b/kexec/Makefile
|
||||
index e2aee84..cc3f08b 100644
|
||||
--- a/kexec/Makefile
|
||||
+++ b/kexec/Makefile
|
||||
@@ -73,6 +73,10 @@ dist += kexec/mem_regions.c kexec/mem_regions.h
|
||||
$(ARCH)_MEM_REGIONS =
|
||||
KEXEC_SRCS += $($(ARCH)_MEM_REGIONS)
|
||||
|
||||
+dist += kexec/dt-ops.c kexec/dt-ops.h
|
||||
+$(ARCH)_DT_OPS =
|
||||
+KEXEC_SRCS += $($(ARCH)_DT_OPS)
|
||||
+
|
||||
include $(srcdir)/kexec/arch/alpha/Makefile
|
||||
include $(srcdir)/kexec/arch/arm/Makefile
|
||||
include $(srcdir)/kexec/arch/i386/Makefile
|
||||
diff --git a/kexec/dt-ops.c b/kexec/dt-ops.c
|
||||
new file mode 100644
|
||||
index 0000000..915dbf5
|
||||
--- /dev/null
|
||||
+++ b/kexec/dt-ops.c
|
||||
@@ -0,0 +1,145 @@
|
||||
+#include <assert.h>
|
||||
+#include <errno.h>
|
||||
+#include <inttypes.h>
|
||||
+#include <libfdt.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include "kexec.h"
|
||||
+#include "dt-ops.h"
|
||||
+
|
||||
+static const char n_chosen[] = "/chosen";
|
||||
+
|
||||
+static const char p_bootargs[] = "bootargs";
|
||||
+static const char p_initrd_start[] = "linux,initrd-start";
|
||||
+static const char p_initrd_end[] = "linux,initrd-end";
|
||||
+
|
||||
+int dtb_set_initrd(char **dtb, off_t *dtb_size, off_t start, off_t end)
|
||||
+{
|
||||
+ int result;
|
||||
+ uint64_t value;
|
||||
+
|
||||
+ dbgprintf("%s: start %jd, end %jd, size %jd (%jd KiB)\n",
|
||||
+ __func__, (intmax_t)start, (intmax_t)end,
|
||||
+ (intmax_t)(end - start),
|
||||
+ (intmax_t)(end - start) / 1024);
|
||||
+
|
||||
+ value = cpu_to_fdt64(start);
|
||||
+
|
||||
+ result = dtb_set_property(dtb, dtb_size, n_chosen, p_initrd_start,
|
||||
+ &value, sizeof(value));
|
||||
+
|
||||
+ if (result)
|
||||
+ return result;
|
||||
+
|
||||
+ value = cpu_to_fdt64(end);
|
||||
+
|
||||
+ result = dtb_set_property(dtb, dtb_size, n_chosen, p_initrd_end,
|
||||
+ &value, sizeof(value));
|
||||
+
|
||||
+ if (result) {
|
||||
+ dtb_delete_property(*dtb, n_chosen, p_initrd_start);
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dtb_set_bootargs(char **dtb, off_t *dtb_size, const char *command_line)
|
||||
+{
|
||||
+ return dtb_set_property(dtb, dtb_size, n_chosen, p_bootargs,
|
||||
+ command_line, strlen(command_line) + 1);
|
||||
+}
|
||||
+
|
||||
+int dtb_set_property(char **dtb, off_t *dtb_size, const char *node,
|
||||
+ const char *prop, const void *value, int value_len)
|
||||
+{
|
||||
+ int result;
|
||||
+ int nodeoffset;
|
||||
+ void *new_dtb;
|
||||
+ int new_size;
|
||||
+
|
||||
+ value_len = FDT_TAGALIGN(value_len);
|
||||
+
|
||||
+ new_size = FDT_TAGALIGN(*dtb_size + fdt_node_len(node)
|
||||
+ + fdt_prop_len(prop, value_len));
|
||||
+
|
||||
+ new_dtb = malloc(new_size);
|
||||
+
|
||||
+ if (!new_dtb) {
|
||||
+ dbgprintf("%s: malloc failed\n", __func__);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ result = fdt_open_into(*dtb, new_dtb, new_size);
|
||||
+
|
||||
+ if (result) {
|
||||
+ dbgprintf("%s: fdt_open_into failed: %s\n", __func__,
|
||||
+ fdt_strerror(result));
|
||||
+ goto on_error;
|
||||
+ }
|
||||
+
|
||||
+ nodeoffset = fdt_path_offset(new_dtb, node);
|
||||
+
|
||||
+ if (nodeoffset == -FDT_ERR_NOTFOUND) {
|
||||
+ result = fdt_add_subnode(new_dtb, nodeoffset, node);
|
||||
+
|
||||
+ if (result) {
|
||||
+ dbgprintf("%s: fdt_add_subnode failed: %s\n", __func__,
|
||||
+ fdt_strerror(result));
|
||||
+ goto on_error;
|
||||
+ }
|
||||
+ } else if (nodeoffset < 0) {
|
||||
+ dbgprintf("%s: fdt_path_offset failed: %s\n", __func__,
|
||||
+ fdt_strerror(nodeoffset));
|
||||
+ goto on_error;
|
||||
+ }
|
||||
+
|
||||
+ result = fdt_setprop(new_dtb, nodeoffset, prop, value, value_len);
|
||||
+
|
||||
+ if (result) {
|
||||
+ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
|
||||
+ fdt_strerror(result));
|
||||
+ goto on_error;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Can't call free on dtb since dtb may have been mmaped by
|
||||
+ * slurp_file().
|
||||
+ */
|
||||
+
|
||||
+ result = fdt_pack(new_dtb);
|
||||
+
|
||||
+ if (result)
|
||||
+ dbgprintf("%s: Unable to pack device tree: %s\n", __func__,
|
||||
+ fdt_strerror(result));
|
||||
+
|
||||
+ *dtb = new_dtb;
|
||||
+ *dtb_size = fdt_totalsize(*dtb);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+on_error:
|
||||
+ free(new_dtb);
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int dtb_delete_property(char *dtb, const char *node, const char *prop)
|
||||
+{
|
||||
+ int result;
|
||||
+ int nodeoffset = fdt_path_offset(dtb, node);
|
||||
+
|
||||
+ if (nodeoffset < 0) {
|
||||
+ dbgprintf("%s: fdt_path_offset failed: %s\n", __func__,
|
||||
+ fdt_strerror(nodeoffset));
|
||||
+ return nodeoffset;
|
||||
+ }
|
||||
+
|
||||
+ result = fdt_delprop(dtb, nodeoffset, prop);
|
||||
+
|
||||
+ if (result)
|
||||
+ dbgprintf("%s: fdt_delprop failed: %s\n", __func__,
|
||||
+ fdt_strerror(nodeoffset));
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
diff --git a/kexec/dt-ops.h b/kexec/dt-ops.h
|
||||
new file mode 100644
|
||||
index 0000000..e70d15d
|
||||
--- /dev/null
|
||||
+++ b/kexec/dt-ops.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+#if !defined(KEXEC_DT_OPS_H)
|
||||
+#define KEXEC_DT_OPS_H
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+int dtb_set_initrd(char **dtb, off_t *dtb_size, off_t start, off_t end);
|
||||
+int dtb_set_bootargs(char **dtb, off_t *dtb_size, const char *command_line);
|
||||
+int dtb_set_property(char **dtb, off_t *dtb_size, const char *node,
|
||||
+ const char *prop, const void *value, int value_len);
|
||||
+
|
||||
+int dtb_delete_property(char *dtb, const char *node, const char *prop);
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
From 9f62cbddddfc93d78d9aafbddf3e1208cb242f7b Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Garnier <thgarnie@google.com>
|
||||
Date: Tue, 13 Sep 2016 15:10:05 +0800
|
||||
Subject: [PATCH] kexec/arch/i386: Add support for KASLR memory randomization
|
||||
|
||||
Multiple changes were made on KASLR (right now in linux-next). One of
|
||||
them is randomizing the virtual address of the physical mapping, vmalloc
|
||||
and vmemmap memory sections. It breaks kdump ability to read physical
|
||||
memory.
|
||||
|
||||
This change identifies if KASLR memories randomization is used by
|
||||
checking if the page_offset_base variable exists. It search for the
|
||||
correct PAGE_OFFSET value by looking at the loaded memory section and
|
||||
find the lowest aligned on PUD (the randomization level).
|
||||
|
||||
Related commits on linux-next:
|
||||
- 0483e1fa6e09d4948272680f691dccb1edb9677f: Base for randomization
|
||||
- 021182e52fe01c1f7b126f97fd6ba048dc4234fd: Enable for PAGE_OFFSET
|
||||
|
||||
Signed-off-by: Thomas Garnier <thgarnie@google.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/i386/crashdump-x86.c | 29 ++++++++++++++++++++++-------
|
||||
1 file changed, 22 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
|
||||
index bbc0f35..ab833d4 100644
|
||||
--- a/kexec/arch/i386/crashdump-x86.c
|
||||
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||
@@ -102,11 +102,10 @@ static int get_kernel_paddr(struct kexec_info *UNUSED(info),
|
||||
return -1;
|
||||
}
|
||||
|
||||
-/* Retrieve kernel _stext symbol virtual address from /proc/kallsyms */
|
||||
-static unsigned long long get_kernel_stext_sym(void)
|
||||
+/* Retrieve kernel symbol virtual address from /proc/kallsyms */
|
||||
+static unsigned long long get_kernel_sym(const char *symbol)
|
||||
{
|
||||
const char *kallsyms = "/proc/kallsyms";
|
||||
- const char *stext = "_stext";
|
||||
char sym[128];
|
||||
char line[128];
|
||||
FILE *fp;
|
||||
@@ -122,13 +121,13 @@ static unsigned long long get_kernel_stext_sym(void)
|
||||
while(fgets(line, sizeof(line), fp) != NULL) {
|
||||
if (sscanf(line, "%Lx %c %s", &vaddr, &type, sym) != 3)
|
||||
continue;
|
||||
- if (strcmp(sym, stext) == 0) {
|
||||
- dbgprintf("kernel symbol %s vaddr = %16llx\n", stext, vaddr);
|
||||
+ if (strcmp(sym, symbol) == 0) {
|
||||
+ dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
|
||||
return vaddr;
|
||||
}
|
||||
}
|
||||
|
||||
- fprintf(stderr, "Cannot get kernel %s symbol address\n", stext);
|
||||
+ fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -151,6 +150,8 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
|
||||
off_t size;
|
||||
uint32_t elf_flags = 0;
|
||||
uint64_t stext_sym;
|
||||
+ const unsigned long long pud_mask = ~((1 << 30) - 1);
|
||||
+ unsigned long long vaddr, lowest_vaddr = 0;
|
||||
|
||||
if (elf_info->machine != EM_X86_64)
|
||||
return 0;
|
||||
@@ -180,9 +181,23 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
|
||||
|
||||
end_phdr = &ehdr.e_phdr[ehdr.e_phnum];
|
||||
|
||||
+ /* Search for the real PAGE_OFFSET when KASLR memory randomization
|
||||
+ * is enabled */
|
||||
+ if (get_kernel_sym("page_offset_base") != 0) {
|
||||
+ for(phdr = ehdr.e_phdr; phdr != end_phdr; phdr++) {
|
||||
+ if (phdr->p_type == PT_LOAD) {
|
||||
+ vaddr = phdr->p_vaddr & pud_mask;
|
||||
+ if (lowest_vaddr == 0 || lowest_vaddr > vaddr)
|
||||
+ lowest_vaddr = vaddr;
|
||||
+ }
|
||||
+ }
|
||||
+ if (lowest_vaddr != 0)
|
||||
+ elf_info->page_offset = lowest_vaddr;
|
||||
+ }
|
||||
+
|
||||
/* Traverse through the Elf headers and find the region where
|
||||
* _stext symbol is located in. That's where kernel is mapped */
|
||||
- stext_sym = get_kernel_stext_sym();
|
||||
+ stext_sym = get_kernel_sym("_stext");
|
||||
for(phdr = ehdr.e_phdr; stext_sym && phdr != end_phdr; phdr++) {
|
||||
if (phdr->p_type == PT_LOAD) {
|
||||
unsigned long long saddr = phdr->p_vaddr;
|
||||
--
|
||||
2.10.1
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
From dbb99d938810b60035122a1bcc68c4d585a0e57f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <dbb99d938810b60035122a1bcc68c4d585a0e57f.1491799333.git.panand@redhat.com>
|
||||
From: Dave Young <dyoung@redhat.com>
|
||||
Date: Thu, 8 Dec 2016 10:52:22 +0800
|
||||
Subject: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
|
||||
|
||||
I got below error while tesing kexec -p:
|
||||
"Can't find kernel text map area from kcore"
|
||||
|
||||
The case is the pt_load start addr was same as stext_sym. The checking
|
||||
code should really be saddr <= stext_sym so that the right pt_load area
|
||||
includes stext_sym can be matched.
|
||||
|
||||
This was not reported by people previously because it will fail over to
|
||||
use hardcode X86_64__START_KERNEL_map to match the pt_load areas again
|
||||
in later code and it sometimes succeeds because of kernel address
|
||||
randomization.
|
||||
|
||||
With this change according to my test stext_sym checking can garantee
|
||||
falling into right pt_load area if we get correct stext_sym.
|
||||
|
||||
Signed-off-by: Dave Young <dyoung@redhat.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
---
|
||||
kexec/arch/i386/crashdump-x86.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
|
||||
index ab833d416320..88aeee33572b 100644
|
||||
--- a/kexec/arch/i386/crashdump-x86.c
|
||||
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||
@@ -205,7 +205,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
|
||||
unsigned long long size;
|
||||
|
||||
/* Look for kernel text mapping header. */
|
||||
- if (saddr < stext_sym && eaddr > stext_sym) {
|
||||
+ if (saddr <= stext_sym && eaddr > stext_sym) {
|
||||
saddr = _ALIGN_DOWN(saddr, X86_64_KERN_VADDR_ALIGN);
|
||||
elf_info->kern_vaddr_start = saddr;
|
||||
size = eaddr - saddr;
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
From acdbb1d6aee9207ccdea697326574e8d6142cd73 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <acdbb1d6aee9207ccdea697326574e8d6142cd73.1491806706.git.panand@redhat.com>
|
||||
From: Baoquan He <bhe@redhat.com>
|
||||
Date: Thu, 10 Nov 2016 15:30:57 +0900
|
||||
Subject: [PATCH] [PATCH v2 1/2] Adapt code to get value of phys_base
|
||||
|
||||
* Required for kernel 4.9
|
||||
|
||||
Kernel code only exports virtual address of phys_base now and it's helpless
|
||||
for Crash and Makedumpfile. Below patch which changes code to export value
|
||||
of phys_base has been posted to upstream. So adapt code to get it.
|
||||
|
||||
kexec: Change to export the value of phys_base instead of symbol address
|
||||
marc.info/?l=linux-kernel&m=147856863629624&w=2
|
||||
|
||||
Signed-off-by: Baoquan He <bhe@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 12 +++++-------
|
||||
makedumpfile.c | 5 ++---
|
||||
makedumpfile.h | 2 +-
|
||||
3 files changed, 8 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.0/arch/x86_64.c b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
index 3ef33ae4ef2d..010ea10e6fa8 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -62,6 +62,10 @@ get_phys_base_x86_64(void)
|
||||
* Get the relocatable offset
|
||||
*/
|
||||
info->phys_base = 0; /* default/traditional */
|
||||
+ if (NUMBER(phys_base) != NOT_FOUND_NUMBER) {
|
||||
+ info->phys_base = NUMBER(phys_base);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
|
||||
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
||||
if (virt_start >= __START_KERNEL_map) {
|
||||
@@ -187,12 +191,6 @@ vtop4_x86_64(unsigned long vaddr)
|
||||
{
|
||||
unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte;
|
||||
unsigned long pte_paddr, pte;
|
||||
- unsigned long phys_base;
|
||||
-
|
||||
- if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
|
||||
- phys_base = info->phys_base;
|
||||
- else
|
||||
- phys_base = 0;
|
||||
|
||||
if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) {
|
||||
ERRMSG("Can't get the symbol of init_level4_pgt.\n");
|
||||
@@ -202,7 +200,7 @@ vtop4_x86_64(unsigned long vaddr)
|
||||
/*
|
||||
* Get PGD.
|
||||
*/
|
||||
- page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
|
||||
+ page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + info->phys_base;
|
||||
page_dir += pml4_index(vaddr) * sizeof(unsigned long);
|
||||
if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) {
|
||||
ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir);
|
||||
diff --git a/makedumpfile-1.6.0/makedumpfile.c b/makedumpfile-1.6.0/makedumpfile.c
|
||||
index b916dfb8b189..a3f711e3e9bf 100644
|
||||
--- a/makedumpfile-1.6.0/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.0/makedumpfile.c
|
||||
@@ -1507,7 +1507,6 @@ get_symbol_info(void)
|
||||
SYMBOL_INIT(init_level4_pgt, "init_level4_pgt");
|
||||
SYMBOL_INIT(vmlist, "vmlist");
|
||||
SYMBOL_INIT(vmap_area_list, "vmap_area_list");
|
||||
- SYMBOL_INIT(phys_base, "phys_base");
|
||||
SYMBOL_INIT(node_online_map, "node_online_map");
|
||||
SYMBOL_INIT(node_states, "node_states");
|
||||
SYMBOL_INIT(node_memblk, "node_memblk");
|
||||
@@ -2134,7 +2133,6 @@ write_vmcoreinfo_data(void)
|
||||
WRITE_SYMBOL("init_level4_pgt", init_level4_pgt);
|
||||
WRITE_SYMBOL("vmlist", vmlist);
|
||||
WRITE_SYMBOL("vmap_area_list", vmap_area_list);
|
||||
- WRITE_SYMBOL("phys_base", phys_base);
|
||||
WRITE_SYMBOL("node_online_map", node_online_map);
|
||||
WRITE_SYMBOL("node_states", node_states);
|
||||
WRITE_SYMBOL("node_data", node_data);
|
||||
@@ -2261,6 +2259,7 @@ write_vmcoreinfo_data(void)
|
||||
|
||||
WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
|
||||
WRITE_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
|
||||
+ WRITE_NUMBER("phys_base", phys_base);
|
||||
|
||||
WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
|
||||
|
||||
@@ -2488,7 +2487,6 @@ read_vmcoreinfo(void)
|
||||
READ_SYMBOL("init_level4_pgt", init_level4_pgt);
|
||||
READ_SYMBOL("vmlist", vmlist);
|
||||
READ_SYMBOL("vmap_area_list", vmap_area_list);
|
||||
- READ_SYMBOL("phys_base", phys_base);
|
||||
READ_SYMBOL("node_online_map", node_online_map);
|
||||
READ_SYMBOL("node_states", node_states);
|
||||
READ_SYMBOL("node_data", node_data);
|
||||
@@ -2609,6 +2607,7 @@ read_vmcoreinfo(void)
|
||||
|
||||
READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
|
||||
READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
|
||||
+ READ_NUMBER("phys_base", phys_base);
|
||||
|
||||
READ_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
|
||||
|
||||
diff --git a/makedumpfile-1.6.0/makedumpfile.h b/makedumpfile-1.6.0/makedumpfile.h
|
||||
index 338c651388f0..422b6bed102b 100644
|
||||
--- a/makedumpfile-1.6.0/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.0/makedumpfile.h
|
||||
@@ -1394,7 +1394,6 @@ struct symbol_table {
|
||||
unsigned long long init_level4_pgt;
|
||||
unsigned long long vmlist;
|
||||
unsigned long long vmap_area_list;
|
||||
- unsigned long long phys_base;
|
||||
unsigned long long node_online_map;
|
||||
unsigned long long node_states;
|
||||
unsigned long long node_memblk;
|
||||
@@ -1718,6 +1717,7 @@ struct number_table {
|
||||
long SECTION_SIZE_BITS;
|
||||
long MAX_PHYSMEM_BITS;
|
||||
long HUGETLB_PAGE_DTOR;
|
||||
+ long phys_base;
|
||||
};
|
||||
|
||||
struct srcfile_table {
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
From: Pratyush Anand <panand@redhat.com>
|
||||
To: ats-kumagai@wm.jp.nec.com
|
||||
Subject: [PATCH Makedumpfile 1/4] x86_64: Calculate page_offset from pt_load
|
||||
Date: Mon, 24 Oct 2016 22:18:43 +0530
|
||||
Cc: Pratyush Anand <panand@redhat.com>, dyoung@redhat.com,
|
||||
kexec@lists.infradead.org, bhe@redhat.com
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
page_offset can always be calculated as 'virtual - physical' for a direct
|
||||
mapping area on x86. Therefore, remove the version dependent calculation
|
||||
and use this method.
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/x86_64.c b/arch/x86_64.c
|
||||
index ddf7be6bc57b..a96fd8ae00a1 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -44,6 +44,24 @@ get_xen_p2m_mfn(void)
|
||||
return NOT_FOUND_LONG_VALUE;
|
||||
}
|
||||
|
||||
+static int
|
||||
+get_page_offset_x86_64(void)
|
||||
+{
|
||||
+ int i;
|
||||
+ unsigned long long phys_start;
|
||||
+ unsigned long long virt_start;
|
||||
+
|
||||
+ for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
||||
+ if (virt_start >= __START_KERNEL_map) {
|
||||
+ info->page_offset = virt_start - phys_start;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ERRMSG("Can't get any pt_load to calculate page offset.\n");
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
int
|
||||
get_phys_base_x86_64(void)
|
||||
{
|
||||
@@ -159,10 +177,8 @@ get_versiondep_info_x86_64(void)
|
||||
else
|
||||
info->max_physmem_bits = _MAX_PHYSMEM_BITS_2_6_31;
|
||||
|
||||
- if (info->kernel_version < KERNEL_VERSION(2, 6, 27))
|
||||
- info->page_offset = __PAGE_OFFSET_ORIG;
|
||||
- else
|
||||
- info->page_offset = __PAGE_OFFSET_2_6_27;
|
||||
+ if (!get_page_offset_x86_64())
|
||||
+ return FALSE;
|
||||
|
||||
if (info->kernel_version < KERNEL_VERSION(2, 6, 31)) {
|
||||
info->vmalloc_start = VMALLOC_START_ORIG;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
||||
_______________________________________________
|
||||
kexec mailing list
|
||||
kexec@lists.infradead.org
|
||||
http://lists.infradead.org/mailman/listinfo/kexec
|
|
@ -0,0 +1,89 @@
|
|||
From: Pratyush Anand <panand@redhat.com>
|
||||
To: ats-kumagai@wm.jp.nec.com
|
||||
Subject: [PATCH Makedumpfile 3/4] x86_64: kill is_vmalloc_addr_x86_64()
|
||||
Date: Mon, 24 Oct 2016 22:18:45 +0530
|
||||
Cc: Pratyush Anand <panand@redhat.com>, dyoung@redhat.com,
|
||||
kexec@lists.infradead.org, bhe@redhat.com
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
From kernel documentation:
|
||||
ffffffff80000000 - ffffffff9fffffff (=512 MB) kernel text mapping, from phys 0
|
||||
ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space
|
||||
|
||||
So, it is only the module area which is lying above __START_KERNEL_map.
|
||||
However, kexec-tools only creates PT_LOAD segments for kernel text region
|
||||
and crash memory region. So, we can safely remove the check for
|
||||
!is_vmalloc_addr_x86_64() from get_phys_base_x86_64().
|
||||
|
||||
Since, this was the last usage of is_vmalloc_addr_x86_64(), so kill it as
|
||||
well.
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 14 +-------------
|
||||
makedumpfile.h | 3 +--
|
||||
2 files changed, 2 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/arch/x86_64.c b/arch/x86_64.c
|
||||
index fe2764a8bec2..597cdac36dfc 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -21,17 +21,6 @@
|
||||
extern struct vmap_pfns *gvmem_pfns;
|
||||
extern int nr_gvmem_pfns;
|
||||
|
||||
-int
|
||||
-is_vmalloc_addr_x86_64(ulong vaddr)
|
||||
-{
|
||||
- /*
|
||||
- * vmalloc, virtual memmap, and module space as VMALLOC space.
|
||||
- */
|
||||
- return ((vaddr >= VMALLOC_START && vaddr <= VMALLOC_END)
|
||||
- || (vaddr >= VMEMMAP_START && vaddr <= VMEMMAP_END)
|
||||
- || (vaddr >= MODULES_VADDR && vaddr <= MODULES_END));
|
||||
-}
|
||||
-
|
||||
static unsigned long
|
||||
get_xen_p2m_mfn(void)
|
||||
{
|
||||
@@ -75,8 +64,7 @@ get_phys_base_x86_64(void)
|
||||
info->phys_base = 0; /* default/traditional */
|
||||
|
||||
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
||||
- if ((virt_start >= __START_KERNEL_map) &&
|
||||
- !(is_vmalloc_addr_x86_64(virt_start))) {
|
||||
+ if (virt_start >= __START_KERNEL_map) {
|
||||
|
||||
info->phys_base = phys_start -
|
||||
(virt_start & ~(__START_KERNEL_map));
|
||||
diff --git a/makedumpfile.h b/makedumpfile.h
|
||||
index 13559651feb6..8a96da1f61bd 100644
|
||||
--- a/makedumpfile-1.6.0/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.0/makedumpfile.h
|
||||
@@ -859,7 +859,6 @@ unsigned long long vaddr_to_paddr_x86(unsigned long vaddr);
|
||||
#endif /* x86 */
|
||||
|
||||
#ifdef __x86_64__
|
||||
-int is_vmalloc_addr_x86_64(ulong vaddr);
|
||||
int get_phys_base_x86_64(void);
|
||||
int get_machdep_info_x86_64(void);
|
||||
int get_versiondep_info_x86_64(void);
|
||||
@@ -869,7 +868,7 @@ unsigned long long vtop4_x86_64(unsigned long vaddr);
|
||||
#define get_machdep_info() get_machdep_info_x86_64()
|
||||
#define get_versiondep_info() get_versiondep_info_x86_64()
|
||||
#define vaddr_to_paddr(X) vtop4_x86_64(X)
|
||||
-#define is_phys_addr(X) (!is_vmalloc_addr_x86_64(X))
|
||||
+#define is_phys_addr(X) stub_true_ul(X)
|
||||
#endif /* x86_64 */
|
||||
|
||||
#ifdef __powerpc64__ /* powerpc64 */
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
||||
_______________________________________________
|
||||
kexec mailing list
|
||||
kexec@lists.infradead.org
|
||||
http://lists.infradead.org/mailman/listinfo/kexec
|
|
@ -0,0 +1,58 @@
|
|||
From: Pratyush Anand <panand@redhat.com>
|
||||
To: ats-kumagai@wm.jp.nec.com
|
||||
Subject: [PATCH Makedumpfile 4/4] x86_64: kill some unused initialization
|
||||
Date: Mon, 24 Oct 2016 22:18:46 +0530
|
||||
Cc: Pratyush Anand <panand@redhat.com>, dyoung@redhat.com,
|
||||
kexec@lists.infradead.org, bhe@redhat.com
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
VMALLOC_START, VMALLOC_END, MODULES_VADDR and MODULES_END are mo more
|
||||
needed for x86_64 now. So, kill their initialization.
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 4 ----
|
||||
makedumpfile.h | 2 --
|
||||
2 files changed, 6 deletions(-)
|
||||
|
||||
diff --git a/arch/x86_64.c b/arch/x86_64.c
|
||||
index 597cdac36dfc..13990cef839b 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -169,13 +169,9 @@ get_versiondep_info_x86_64(void)
|
||||
return FALSE;
|
||||
|
||||
if (info->kernel_version < KERNEL_VERSION(2, 6, 31)) {
|
||||
- info->vmalloc_start = VMALLOC_START_ORIG;
|
||||
- info->vmalloc_end = VMALLOC_END_ORIG;
|
||||
info->vmemmap_start = VMEMMAP_START_ORIG;
|
||||
info->vmemmap_end = VMEMMAP_END_ORIG;
|
||||
} else {
|
||||
- info->vmalloc_start = VMALLOC_START_2_6_31;
|
||||
- info->vmalloc_end = VMALLOC_END_2_6_31;
|
||||
info->vmemmap_start = VMEMMAP_START_2_6_31;
|
||||
info->vmemmap_end = VMEMMAP_END_2_6_31;
|
||||
}
|
||||
diff --git a/makedumpfile.h b/makedumpfile.h
|
||||
index 8a96da1f61bd..338c651388f0 100644
|
||||
--- a/makedumpfile-1.6.0/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.0/makedumpfile.h
|
||||
@@ -575,8 +575,6 @@ int get_va_bits_arm64(void);
|
||||
#define __START_KERNEL_map (0xffffffff80000000)
|
||||
#define KERNEL_IMAGE_SIZE_ORIG (0x0000000008000000) /* 2.6.25, or former */
|
||||
#define KERNEL_IMAGE_SIZE_2_6_26 (0x0000000020000000) /* 2.6.26, or later */
|
||||
-#define MODULES_VADDR (__START_KERNEL_map + NUMBER(KERNEL_IMAGE_SIZE))
|
||||
-#define MODULES_END (0xfffffffffff00000)
|
||||
#define KVBASE PAGE_OFFSET
|
||||
#define _SECTION_SIZE_BITS (27)
|
||||
#define _MAX_PHYSMEM_BITS_ORIG (40)
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
||||
_______________________________________________
|
||||
kexec mailing list
|
||||
kexec@lists.infradead.org
|
||||
http://lists.infradead.org/mailman/listinfo/kexec
|
|
@ -0,0 +1,148 @@
|
|||
From: Pratyush Anand <panand@redhat.com>
|
||||
To: ats-kumagai@wm.jp.nec.com
|
||||
Subject: [PATCH Makedumpfile 2/4] x86_64: translate all VA to PA using page
|
||||
table values
|
||||
Date: Mon, 24 Oct 2016 22:18:44 +0530
|
||||
Cc: Pratyush Anand <panand@redhat.com>, dyoung@redhat.com,
|
||||
kexec@lists.infradead.org, bhe@redhat.com
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
Currently we translate some of the VA areas using linear mapping while some
|
||||
other(which can not be linearly mapped) using page table.
|
||||
|
||||
However, we will have entry of a page in the page table irrespective of its
|
||||
virtual region. So, we can always look into page table for any VA to PA
|
||||
translation. This approach will solve lot of complexity in makedumpfile. It
|
||||
will in turn remove dependency over variables like VMALLOC_START,
|
||||
MODULES_VADDR etc whose definition keeps changing in newer kernel version.
|
||||
|
||||
Moreover, I do not see any side effect of this approach in terms of
|
||||
execution timing. I tested with IBM x3950 X6 machine having 4136359 MB of
|
||||
memory. These are the results of makedumpfile execution time:
|
||||
|
||||
Without this patch:
|
||||
===================
|
||||
With -d 31:
|
||||
Trial 1: 237.59526248 S
|
||||
Trial 2: 235.236914962 S
|
||||
Trail 3: 237.678712045 S
|
||||
|
||||
With -d 1:
|
||||
Trial 1: 2548.905296877 S
|
||||
Trial 2: 2549.759881756 S
|
||||
|
||||
With this patch:
|
||||
===================
|
||||
With -d 31:
|
||||
Trial 1: 232.713841516 S
|
||||
Trial 2: 228.45697177 S
|
||||
Trail 3: 232.942262441 S
|
||||
|
||||
With -d 1:
|
||||
Trial 1: 2768.424565806 S
|
||||
Trial 2: 2749.622115455 S
|
||||
Trail 3: 2537.770359073 S
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 42 ++++++++----------------------------------
|
||||
makedumpfile.h | 4 ++--
|
||||
2 files changed, 10 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/arch/x86_64.c b/arch/x86_64.c
|
||||
index a96fd8ae00a1..fe2764a8bec2 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -203,6 +203,12 @@ vtop4_x86_64(unsigned long vaddr)
|
||||
{
|
||||
unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte;
|
||||
unsigned long pte_paddr, pte;
|
||||
+ unsigned long phys_base;
|
||||
+
|
||||
+ if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
|
||||
+ phys_base = info->phys_base;
|
||||
+ else
|
||||
+ phys_base = 0;
|
||||
|
||||
if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) {
|
||||
ERRMSG("Can't get the symbol of init_level4_pgt.\n");
|
||||
@@ -212,9 +218,9 @@ vtop4_x86_64(unsigned long vaddr)
|
||||
/*
|
||||
* Get PGD.
|
||||
*/
|
||||
- page_dir = SYMBOL(init_level4_pgt);
|
||||
+ page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
|
||||
page_dir += pml4_index(vaddr) * sizeof(unsigned long);
|
||||
- if (!readmem(VADDR, page_dir, &pml4, sizeof pml4)) {
|
||||
+ if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) {
|
||||
ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir);
|
||||
return NOT_PADDR;
|
||||
}
|
||||
@@ -285,38 +291,6 @@ vtop4_x86_64(unsigned long vaddr)
|
||||
return (pte & ENTRY_MASK) + PAGEOFFSET(vaddr);
|
||||
}
|
||||
|
||||
-unsigned long long
|
||||
-vaddr_to_paddr_x86_64(unsigned long vaddr)
|
||||
-{
|
||||
- unsigned long phys_base;
|
||||
- unsigned long long paddr;
|
||||
-
|
||||
- /*
|
||||
- * Check the relocatable kernel.
|
||||
- */
|
||||
- if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
|
||||
- phys_base = info->phys_base;
|
||||
- else
|
||||
- phys_base = 0;
|
||||
-
|
||||
- if (is_vmalloc_addr_x86_64(vaddr)) {
|
||||
- if ((paddr = vtop4_x86_64(vaddr)) == NOT_PADDR) {
|
||||
- ERRMSG("Can't convert a virtual address(%lx) to " \
|
||||
- "physical address.\n", vaddr);
|
||||
- return NOT_PADDR;
|
||||
- }
|
||||
- } else if (vaddr >= __START_KERNEL_map) {
|
||||
- paddr = vaddr - __START_KERNEL_map + phys_base;
|
||||
-
|
||||
- } else {
|
||||
- if (is_xen_memory())
|
||||
- paddr = vaddr - PAGE_OFFSET_XEN_DOM0;
|
||||
- else
|
||||
- paddr = vaddr - PAGE_OFFSET;
|
||||
- }
|
||||
- return paddr;
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* for Xen extraction
|
||||
*/
|
||||
diff --git a/makedumpfile.h b/makedumpfile.h
|
||||
index a5955ff750e5..13559651feb6 100644
|
||||
--- a/makedumpfile-1.6.0/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.0/makedumpfile.h
|
||||
@@ -863,12 +863,12 @@ int is_vmalloc_addr_x86_64(ulong vaddr);
|
||||
int get_phys_base_x86_64(void);
|
||||
int get_machdep_info_x86_64(void);
|
||||
int get_versiondep_info_x86_64(void);
|
||||
-unsigned long long vaddr_to_paddr_x86_64(unsigned long vaddr);
|
||||
+unsigned long long vtop4_x86_64(unsigned long vaddr);
|
||||
#define find_vmemmap() find_vmemmap_x86_64()
|
||||
#define get_phys_base() get_phys_base_x86_64()
|
||||
#define get_machdep_info() get_machdep_info_x86_64()
|
||||
#define get_versiondep_info() get_versiondep_info_x86_64()
|
||||
-#define vaddr_to_paddr(X) vaddr_to_paddr_x86_64(X)
|
||||
+#define vaddr_to_paddr(X) vtop4_x86_64(X)
|
||||
#define is_phys_addr(X) (!is_vmalloc_addr_x86_64(X))
|
||||
#endif /* x86_64 */
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
||||
_______________________________________________
|
||||
kexec mailing list
|
||||
kexec@lists.infradead.org
|
||||
http://lists.infradead.org/mailman/listinfo/kexec
|
|
@ -0,0 +1,32 @@
|
|||
From 0ebcd6f3570dd66bff0930872b8bf859bdcf302a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0ebcd6f3570dd66bff0930872b8bf859bdcf302a.1477548646.git.panand@redhat.com>
|
||||
From: Pratyush Anand <panand@redhat.com>
|
||||
Date: Thu, 27 Oct 2016 11:34:33 +0530
|
||||
Subject: [PATCH] x86_64: fix page_offset calculation
|
||||
|
||||
Kernel text region lies above __START_KERNEL_map, which is linearly mapped
|
||||
however not a direct mapping. Direct mapping region lies below it instead.
|
||||
So, page_offset can only be calculated with a region which is below
|
||||
__START_KERNEL_map.
|
||||
|
||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||
---
|
||||
arch/x86_64.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86_64.c b/arch/x86_64.c
|
||||
index 13990cef839b..3ef33ae4ef2d 100644
|
||||
--- a/makedumpfile-1.6.0/arch/x86_64.c
|
||||
+++ b/makedumpfile-1.6.0/arch/x86_64.c
|
||||
@@ -41,7 +41,7 @@ get_page_offset_x86_64(void)
|
||||
unsigned long long virt_start;
|
||||
|
||||
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
||||
- if (virt_start >= __START_KERNEL_map) {
|
||||
+ if (virt_start < __START_KERNEL_map) {
|
||||
info->page_offset = virt_start - phys_start;
|
||||
return TRUE;
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
Name: kexec-tools
|
||||
Version: 2.0.13
|
||||
Release: 4%{?dist}
|
||||
Release: 7%{?dist}.3
|
||||
License: GPLv2
|
||||
Group: Applications/System
|
||||
Summary: The kexec/kdump userspace component
|
||||
|
||||
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
|
||||
Source1: kdumpctl
|
||||
Source2: kdump.sysconfig
|
||||
|
@ -45,25 +46,24 @@ Requires(post): systemd-units
|
|||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
Requires(pre): coreutils sed zlib
|
||||
Requires: dracut >= 044-117
|
||||
Requires: dracut-network >= 044-117
|
||||
Requires: ethtool
|
||||
Requires: dracut >= 044-75
|
||||
Requires: dracut-network, ethtool
|
||||
BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
|
||||
BuildRequires: pkgconfig intltool gettext
|
||||
BuildRequires: systemd-units
|
||||
BuildRequires: automake autoconf libtool
|
||||
%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
|
||||
Obsoletes: diskdumputils netdump kexec-tools-eppic
|
||||
%endif
|
||||
|
||||
%undefine _hardened_build
|
||||
|
||||
ExcludeArch: aarch64
|
||||
|
||||
#START INSERT
|
||||
|
||||
#
|
||||
# Patches 0 through 100 are meant for x86 kexec-tools enablement
|
||||
#
|
||||
Patch1: kexec-tools-2.0.13-kexec-arch-i386-Add-support-for-KASLR-memory-randomi.patch
|
||||
|
||||
#
|
||||
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
|
||||
|
@ -77,8 +77,13 @@ ExcludeArch: aarch64
|
|||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||
#
|
||||
#
|
||||
# Patches 501 through 600 are meant for ppc kexec-tools enablement
|
||||
# Patches 501 through 600 are meant for ARM kexec-tools enablement
|
||||
#
|
||||
Patch500: kexec-tools-2.0.13-kexec-Add-common-device-tree-routines.patch
|
||||
Patch501: kexec-tools-2.0.13-arm64-Add-arm64-kexec-support.patch
|
||||
Patch502: kexec-tools-2.0.13-arm64-Add-support-for-binary-image-files.patch
|
||||
Patch503: kexec-tools-2.0.13-arm64-Add-support-for-additional-relocations-in-the-kexec-purgatory-code.patch
|
||||
Patch504: kexec-tools-2.0.13-arm64-Add-support-of-R_AARCH64_PREL32-relocation-in-.patch
|
||||
|
||||
#
|
||||
# Patches 601 onward are generic patches
|
||||
|
@ -87,6 +92,15 @@ Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
|
|||
Patch602: kexec-tools-2.0.12-makedumpfile-Support-_count-_refcount-rename-in-struct-p.patch
|
||||
Patch603: kexec-tools-2.0.13-fix-armv7-build-failure.patch
|
||||
|
||||
Patch604: kexec-tools-2.0.13-makedumpfile-x86-64-calculate-page-offset-from-pt-load.patch
|
||||
Patch605: kexec-tools-2.0.13-makedumpfile-x86-64-translate-all-VA-to-PA-using-page-table-values.patch
|
||||
Patch606: kexec-tools-2.0.13-makedumpfile-x86-64-kill-is-vmalloc-addr-x86-64.patch
|
||||
Patch607: kexec-tools-2.0.13-makedumpfile-x86-64-kill-some-unused-initialization.patch
|
||||
Patch608: kexec-tools-2.0.13-makedumpfile-x86_64-fix-page_offset-calculation.patch
|
||||
Patch609: kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
|
||||
Patch610: kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
|
||||
Patch611: kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
|
||||
|
||||
%description
|
||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||
kernel to boot using the kernel's kexec feature either on a
|
||||
|
@ -108,17 +122,31 @@ tar -z -x -v -f %{SOURCE9}
|
|||
tar -z -x -v -f %{SOURCE19}
|
||||
tar -z -x -v -f %{SOURCE23}
|
||||
|
||||
%patch1 -p1
|
||||
%patch500 -p1
|
||||
%patch501 -p1
|
||||
%patch502 -p1
|
||||
%patch503 -p1
|
||||
%patch504 -p1
|
||||
|
||||
%patch601 -p1
|
||||
%patch602 -p1
|
||||
%patch603 -p1
|
||||
%patch604 -p1
|
||||
%patch605 -p1
|
||||
%patch606 -p1
|
||||
%patch607 -p1
|
||||
%patch608 -p1
|
||||
%patch609 -p1
|
||||
%patch610 -p1
|
||||
%patch611 -p1
|
||||
|
||||
%ifarch ppc
|
||||
%define archdef ARCH=ppc
|
||||
%endif
|
||||
|
||||
%build
|
||||
|
||||
autoreconf
|
||||
%configure \
|
||||
%ifarch ppc64
|
||||
--host=powerpc64-redhat-linux-gnu \
|
||||
|
@ -316,6 +344,29 @@ done
|
|||
%doc
|
||||
|
||||
%changelog
|
||||
* Thu Apr 27 2017 Dave Young <dyoung@redhat.com> - 2.0.13-7.3
|
||||
- kdump.sysconfig/x86_64: Add nokaslr to kdump kernel cmdline
|
||||
|
||||
* Tue Apr 11 2017 Dave Young <dyoung@redhat.com> - 2.0.13-7.2
|
||||
- kexec-tools fixes for 4.9+ kernels, rhbz1440587
|
||||
|
||||
* Fri Nov 11 2016 Dave Young <dyoung@redhat.com> - 2.0.13-7.1
|
||||
- kexec/arch/i386: Add support for KASLR memory randomization
|
||||
|
||||
* Thu Oct 27 2016 Dave Young <dyoung@redhat.com> - 2.0.13-7
|
||||
- fix wrong page_offset added in 2.0.13-6
|
||||
|
||||
* Wed Oct 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-6
|
||||
- add kexec support for arm64
|
||||
- support x86 kaslr which is enabled by default in F25 kernel
|
||||
|
||||
* Fri Sep 16 2016 Dave Young <dyoung@redhat.com> - 2.0.13-5
|
||||
- Fix bug 1373958 for system boot without initrd
|
||||
- Do not depend on /etc/fstab in kdumpctl in case it does not exist
|
||||
|
||||
* Sun Aug 28 2016 Dave Young <dyoung@redhat.com> - 2.0.13-4.1
|
||||
- Revert the --mount patches in F25 since dracut-044-117 is rawhide only
|
||||
|
||||
* Fri Aug 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-4
|
||||
- Add special dump target "--mount" in dracut_args
|
||||
|
||||
|
|
10
mkdumprd
10
mkdumprd
|
@ -104,7 +104,7 @@ to_mount() {
|
|||
fi
|
||||
|
||||
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
|
||||
_options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
|
||||
[[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
|
||||
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
|
||||
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
|
||||
# kernel, filter it out here.
|
||||
|
@ -355,6 +355,10 @@ handle_default_dump_target()
|
|||
SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
|
||||
_fstype=$(get_fs_type_from_target $_target)
|
||||
|
||||
if $(is_fs_type_nfs $_fstype); then
|
||||
add_dracut_module "nfs"
|
||||
fi
|
||||
|
||||
add_mount "$_target"
|
||||
check_size fs $_target
|
||||
fi
|
||||
|
@ -515,6 +519,10 @@ do
|
|||
perror_exit "Dump target $config_val is probably not mounted."
|
||||
fi
|
||||
|
||||
if [ "$config_opt" = "nfs" ]; then
|
||||
add_dracut_module "nfs"
|
||||
fi
|
||||
|
||||
_absolute_save_path=$(make_absolute_save_path $config_val)
|
||||
_mntpoint=$(get_mntpoint_from_path $_absolute_save_path)
|
||||
if is_atomic && is_bind_mount $_mntpoint; then
|
||||
|
|
Loading…
Reference in New Issue