!85 arm64: Use VA_BITS for page_offset calculation
From: @chenhaixaing Reviewed-by: @wangbin224 Signed-off-by: @wangbin224
This commit is contained in:
commit
b09c52d95d
69
arm64-Use-VA_BITS-for-page_offset-calculation.patch
Normal file
69
arm64-Use-VA_BITS-for-page_offset-calculation.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From c180a63f2cb370da6097ad97eb07333c07aa988b Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Mon, 25 Oct 2021 16:53:26 +0900
|
||||
Subject: [PATCH] arm64: Use VA_BITS for page_offset calculation
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://github.com/crash-utility/crash/commit/c180a63f2cb370da6097ad97eb07333c07aa988b
|
||||
|
||||
Commit 167d37e347fe ("arm64: assign page_offset with VA_BITS kernel
|
||||
configuration value") changed the page_offset calculation from
|
||||
using VA_BITS_ACTUAL to CONFIG_ARM64_VA_BITS. This caused an error
|
||||
for ramdumps without vmcoreinfo like this:
|
||||
|
||||
crash: vmlinux and /var/tmp/ramdump_elf_XUtCMT do not match!
|
||||
|
||||
Set the vmcoreinfo value to VA_BITS if available, and use VA_BITS
|
||||
for page_offset calculation instead.
|
||||
|
||||
Also remove ARM64_FLIP_PAGE_OFFSET_ACTUAL because it's not used
|
||||
actually.
|
||||
|
||||
Reported-by: Ankur Bansal <er.ankurbansal@gmail.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
arm64.c | 5 ++++-
|
||||
defs.h | 4 +---
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 7069312..3dcbcc6 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -404,7 +404,7 @@ arm64_init(int when)
|
||||
fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n", ms->CONFIG_ARM64_VA_BITS);
|
||||
fprintf(fp, " VA_BITS_ACTUAL: %ld\n", ms->VA_BITS_ACTUAL);
|
||||
fprintf(fp, "(calculated) VA_BITS: %ld\n", ms->VA_BITS);
|
||||
- fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET_ACTUAL);
|
||||
+ fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET);
|
||||
fprintf(fp, " VA_START: %lx\n", ms->VA_START);
|
||||
fprintf(fp, " modules: %lx - %lx\n", ms->modules_vaddr, ms->modules_end);
|
||||
fprintf(fp, " vmalloc: %lx - %lx\n", ms->vmalloc_start_addr, ms->vmalloc_end);
|
||||
@@ -4031,6 +4031,9 @@ arm64_calc_VA_BITS(void)
|
||||
error(FATAL, "cannot determine VA_BITS_ACTUAL\n");
|
||||
}
|
||||
|
||||
+ if (machdep->machspec->CONFIG_ARM64_VA_BITS)
|
||||
+ machdep->machspec->VA_BITS = machdep->machspec->CONFIG_ARM64_VA_BITS;
|
||||
+
|
||||
/*
|
||||
* The mm flip commit is introduced before 52-bits VA, which is before the
|
||||
* commit to export NUMBER(TCR_EL1_T1SZ)
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 8b356d5..9710055 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -3238,9 +3238,7 @@ typedef signed int s32;
|
||||
#define ARM64_PAGE_OFFSET ((0xffffffffffffffffUL) \
|
||||
<< (machdep->machspec->VA_BITS - 1))
|
||||
/* kernels >= v5.4 the kernel VA space is flipped */
|
||||
-#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->CONFIG_ARM64_VA_BITS)
|
||||
-#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
|
||||
- - ((1UL) << machdep->machspec->VA_BITS_ACTUAL) + 1)
|
||||
+#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->VA_BITS)
|
||||
|
||||
#define ARM64_USERSPACE_TOP ((1UL) << machdep->machspec->VA_BITS)
|
||||
#define ARM64_USERSPACE_TOP_ACTUAL ((1UL) << machdep->machspec->VA_BITS_ACTUAL)
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: crash
|
||||
Version: 7.3.0
|
||||
Release: 10
|
||||
Release: 11
|
||||
Summary: Linux kernel crash utility.
|
||||
License: GPLv3
|
||||
URL: https://crash-utility.github.io
|
||||
@ -22,6 +22,7 @@ Patch10: crash-7.3.0-sw.patch
|
||||
Patch11: Fix-live-debugging-with-lockdown-integrity.patch
|
||||
Patch12: arm64-fix-backtraces-of-KASAN-kernel-dumpfile-truncated.patch
|
||||
Patch13: 0001-arm64-Fix-segfault-by-bt-command-with-offline-cpus.patch
|
||||
Patch14: arm64-Use-VA_BITS-for-page_offset-calculation.patch
|
||||
|
||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel
|
||||
BuildRequires: gcc gcc-c++ bison m4
|
||||
@ -87,6 +88,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
|
||||
%{_mandir}/man8/crash.8*
|
||||
|
||||
%changelog
|
||||
* Mon Jul 17 2023 chenhaixiang <chenhaixiang3@huawei.com> - 7.3.0-11
|
||||
- arm64: Use VA_BITS for page_offset calculation
|
||||
|
||||
* Wed Jan 4 2023 lijianglin<lijianglin2@huawei.com> - 7.3.0-10
|
||||
- fix segfault by "bt" command with offline cpus
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user