LGTM, for the v2, ack.
Thanks,
Tao Liu
On Thu, May 7, 2026 at 4:35 PM Aureau, Georges (Kernel Tools ERT)
<georges.aureau(a)hpe.com> wrote:
>
> 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(a)hpe.com>
> --
> defs.h | 1 +
> kernel.c | 15 ++++++++++++++-
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/defs.h b/defs.h
> index a6f4372..c07b9a2 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 8781d6a..0dafe74 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,19 @@ 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),
> --
> Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
> To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines:
https://github.com/crash-utility/crash/wiki
>