[PATCHv9 0/4] crash-utility/arm64: memory layout bug fixes
by Pingfan Liu
This series fix the bug caused by arm64 kernel memory layout changes
v8 -> v9:
reorder the series
drop phys_offset_nominal
This series can work on v5.13 kernel (RHEL-9) and for compatibility, on v4.18 (RHEL-8)
Cc: HAGIO KAZUHITO <k-hagio-ab(a)nec.com>
Cc: Lianbo Jiang <lijiang(a)redhat.com>
Cc: Bhupesh Sharma <bhupesh.sharma(a)linaro.org>
To: crash-utility(a)redhat.com
Pingfan Liu (4):
crash-utility/arm64: rename ARM64_PAGE_OFFSET_ACTUAL as
ARM64_FLIP_PAGE_OFFSET_ACTUAL
crash-utility/arm64: assign page_offset with kernel configure value
crash-utility/arm64: use dedicated bits to record the mem layout
changes
crash-utility/arm64: implement switchable PTOV()/VTOP()
arm64.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++--------
defs.h | 15 ++++++++------
2 files changed, 62 insertions(+), 14 deletions(-)
--
2.29.2
3 years, 4 months
[hacklet] handle kernel > 5.12 rename of task_struct.state
by Mike Galbraith
Greetings fellow crash users. The hacklet below keeps crash working
(for the nonce) into the 5.14 kernel cycle. I doubt it's applicable (despite being kinda sorta disguised as a patch just in case;), but it should serve as a bandaid until the real deal comes along.
Handle kernel rename of task_struct.state to __state
Kernels post 5.13 renamed task->state to task->__state. Check the
validity of 'state', and upon failure, rashly presume that "__state"
exists, and isn't going to change again any time soon.
Signed-off-by: Mike Galbraith <efault(a)gmx.de>
---
task.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/task.c
+++ b/task.c
@@ -296,7 +296,10 @@ task_init(void)
tt->flags |= THREAD_INFO;
}
- MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "state");
+ if (VALID_MEMBER(task_struct_state))
+ MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "state");
+ else /* post linux 5.13 */
+ MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "__state");
MEMBER_OFFSET_INIT(task_struct_exit_state, "task_struct", "exit_state");
MEMBER_OFFSET_INIT(task_struct_pid, "task_struct", "pid");
MEMBER_OFFSET_INIT(task_struct_comm, "task_struct", "comm");
3 years, 4 months
Re: [Crash-utility] [PATCH v3 1/1] task: Handle task_struct state member changes in linux-next (Alexander Egorenkov)
by lijiang
> Date: Tue, 29 Jun 2021 08:15:30 +0000
> From: HAGIO KAZUHITO(?????) <k-hagio-ab(a)nec.com>
> To: "Discussion list for crash utility usage, maintenance and
> development" <crash-utility(a)redhat.com>
> Subject: Re: [Crash-utility] [PATCH v3 1/1] task: Handle task_struct
> state member changes in linux-next
> Message-ID:
> <TYYPR01MB6777EF7678CAA8F65D5579AFDD029(a)TYYPR01MB6777.jpnprd01.prod.outlook.com>
>
> Content-Type: text/plain; charset="iso-2022-jp"
>
> -----Original Message-----
> > The member state of task_struct has been renamed to __state and its type
> > changed from long to unsigned int.
> >
> > https://lore.kernel.org/linux-arch/20210611082810.970791107@infradead.org/
> >
> > Signed-off-by: Alexander Egorenkov <egorenar(a)linux.ibm.com>
>
> Thanks for the update.
>
> Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
>
> Now I can see commit 2f064a59a11f ("sched: Change task_struct::state")
> already in the mainline, I will add this to the log when applying.
>
This helps to understand the reasons for these changes.
Acked-by: Lianbo Jiang <lijiang(a)redhat.com>
> Kazu
3 years, 4 months
Fix pvops Xen detection for kernels >= v4.20
by Petr Tesařík
Kernel commit 5c83511bdb9832c86be20fb86b783356e2f58062 removed
pv_init_ops, and later commit 054ac8ad5ebe4a69e1f0e842483821ddbe560121
removed the Xen-specific paravirt patch function. As a result, pvops Xen
dumps are no longer recognized as Xen dumps, and virtual-to-physical
translation fails.
Use the value of xen_start_info to determine whether the kernel is
running in Xen PV mode. This pointer is set during the initialization of
a PV domain. Kudos to Juergen Gross, who suggested this check.
Signed-off-by: Petr Tesarik <ptesarik(a)suse.com>
---
kernel.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/kernel.c b/kernel.c
index e123f76..36fdea2 100644
--- a/kernel.c
+++ b/kernel.c
@@ -95,6 +95,7 @@ static ulong __dump_audit(char *);
static void dump_audit(void);
static char *vmcoreinfo_read_string(const char *);
static void check_vmcoreinfo(void);
+static int is_pvops_xen(void);
/*
@@ -109,7 +110,6 @@ kernel_init()
char *rqstruct;
char *rq_timestamp_name = NULL;
char *irq_desc_type_name;
- ulong pv_init_ops;
struct gnu_request req;
if (pc->flags & KERNEL_DEBUG_QUERY)
@@ -169,11 +169,7 @@ kernel_init()
error(FATAL, "cannot malloc m2p page.");
}
- if (PVOPS() && symbol_exists("pv_init_ops") &&
- readmem(symbol_value("pv_init_ops"), KVADDR, &pv_init_ops,
- sizeof(void *), "pv_init_ops", RETURN_ON_ERROR) &&
- ((p1 = value_symbol(pv_init_ops)) &&
- (STREQ(p1, "xen_patch") || STREQ(p1, "paravirt_patch_default")))) {
+ if (is_pvops_xen()) {
kt->flags |= ARCH_XEN | ARCH_PVOPS_XEN;
kt->xen_flags |= WRITABLE_PAGE_TABLES;
if (machine_type("X86"))
@@ -10709,6 +10705,32 @@ paravirt_init(void)
}
}
+static int
+is_pvops_xen(void)
+{
+ ulong addr;
+ char *sym;
+
+ if (!PVOPS())
+ return FALSE;
+
+ if (symbol_exists("pv_init_ops") &&
+ readmem(symbol_value("pv_init_ops"), KVADDR, &addr,
+ sizeof(void *), "pv_init_ops", RETURN_ON_ERROR) &&
+ (sym = value_symbol(addr)) &&
+ (STREQ(sym, "xen_patch") ||
+ STREQ(sym, "paravirt_patch_default")))
+ return TRUE;
+
+ if (symbol_exists("xen_start_info") &&
+ readmem(symbol_value("xen_start_info"), KVADDR, &addr,
+ sizeof(void *), "xen_start_info", RETURN_ON_ERROR) &&
+ addr != 0)
+ return TRUE;
+
+ return FALSE;
+}
+
/*
* Get the kernel's xtime timespec from its relevant location.
*/
3 years, 4 months