72 lines
2.4 KiB
Diff
72 lines
2.4 KiB
Diff
From 7ff3146d46ea9afb0724b57b3425c9a965a67d12 Mon Sep 17 00:00:00 2001
|
|
From: "Aureau, Georges (Kernel Tools ERT)" <georges.aureau@hpe.com>
|
|
Date: Thu, 7 May 2026 04:12:32 +0000
|
|
Subject: [PATCH 10/39] Fix get_xtime() for kernel 6.13 and higher
|
|
|
|
On kernels 6.13 and higher, DATE is not displayed properly:
|
|
crash> sys | grep -e DATE -e REL
|
|
DATE: Wed Dec 31 18:00:00 CST 1969
|
|
RELEASE: 7.0.0-14-generic
|
|
|
|
The function get_xtime() was enhanced to support:
|
|
- kernel 6.13 ("shadow_timekeeper" moved to "struct tk_data tk_core")
|
|
- kernel 6.17 ("tk_core" is now "timekeeper_data[0]).
|
|
|
|
With this get_xtime() fix:
|
|
crash> sys | grep DATE
|
|
DATE: Mon Apr 27 09:19:50 CDT 2026
|
|
|
|
Signed-off-by: Georges Aureau <georges.aureau@hpe.com>
|
|
---
|
|
defs.h | 1 +
|
|
kernel.c | 14 +++++++++++++-
|
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/defs.h b/defs.h
|
|
index 6a91343f0313..89044b18cdbe 100644
|
|
--- a/defs.h
|
|
+++ b/defs.h
|
|
@@ -2290,6 +2290,7 @@ struct offset_table { /* stash of commonly-used offsets */
|
|
long bpf_ringbuf_nr_pages;
|
|
long hrtimer_clock_base_index;
|
|
long klp_patch_list;
|
|
+ long tk_data_timekeeper;
|
|
};
|
|
|
|
struct size_table { /* stash of commonly-used sizes */
|
|
diff --git a/kernel.c b/kernel.c
|
|
index 1e639ec6a007..6dfc8714a1ff 100644
|
|
--- a/kernel.c
|
|
+++ b/kernel.c
|
|
@@ -258,6 +258,7 @@ kernel_init()
|
|
|
|
MEMBER_OFFSET_INIT(timekeeper_xtime, "timekeeper", "xtime");
|
|
MEMBER_OFFSET_INIT(timekeeper_xtime_sec, "timekeeper", "xtime_sec");
|
|
+ MEMBER_OFFSET_INIT(tk_data_timekeeper, "tk_data", "timekeeper");
|
|
get_xtime(&kt->date);
|
|
if (CRASHDEBUG(1))
|
|
fprintf(fp, "xtime timespec.tv_sec: %lx: %s\n",
|
|
@@ -11134,7 +11135,18 @@ get_xtime(struct timespec *date)
|
|
struct syment *sp;
|
|
uint64_t xtime_sec;
|
|
|
|
- if (VALID_MEMBER(timekeeper_xtime) &&
|
|
+ if (VALID_MEMBER(tk_data_timekeeper) &&
|
|
+ VALID_MEMBER(timekeeper_xtime_sec)) {
|
|
+ long offset = OFFSET(tk_data_timekeeper) +
|
|
+ OFFSET(timekeeper_xtime_sec);
|
|
+ if ((sp = kernel_symbol_search("timekeeper_data")) ||
|
|
+ (sp = kernel_symbol_search("tk_core"))) {
|
|
+ readmem(sp->value + offset, KVADDR,
|
|
+ &xtime_sec, sizeof(uint64_t),
|
|
+ "tk_data timekeeper xtime_sec", RETURN_ON_ERROR);
|
|
+ date->tv_sec = (__time_t)xtime_sec;
|
|
+ }
|
|
+ } else if (VALID_MEMBER(timekeeper_xtime) &&
|
|
(sp = kernel_symbol_search("timekeeper"))) {
|
|
readmem(sp->value + OFFSET(timekeeper_xtime), KVADDR,
|
|
date, sizeof(struct timespec),
|
|
--
|
|
2.54.0
|
|
|