From: Alexander Egorenkov <egorenar@linux.ibm.com>
To: kexec@lists.infradead.org
Cc: Alexander Egorenkov <egorenar@linux.ibm.com>
Subject: [PATCH 1/1] makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO
Date: Fri, 18 Sep 2020 13:55:56 +0200 [thread overview]
Message-ID: <20200918115556.517586-1-egorenar@linux.ibm.com> (raw)
The offset of the field 'init_uts_ns.name' has changed
since linux-next commit 9a56493f6942c0e2df1579986128721da96e00d8.
Make use of the offset 'uts_namespace.name' if available in VMCOREINFO.
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
---
makedumpfile.c | 17 +++++++++++++++--
makedumpfile.h | 6 ++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index 4c4251e..5b8b90c 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1159,7 +1159,10 @@ check_release(void)
if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) {
utsname = SYMBOL(system_utsname);
} else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) {
- utsname = SYMBOL(init_uts_ns) + sizeof(int);
+ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE)
+ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name);
+ else
+ utsname = SYMBOL(init_uts_ns) + sizeof(int);
} else {
ERRMSG("Can't get the symbol of system_utsname.\n");
return FALSE;
@@ -2008,6 +2011,11 @@ get_structure_info(void)
SIZE_INIT(cpu_spec, "cpu_spec");
OFFSET_INIT(cpu_spec.mmu_features, "cpu_spec", "mmu_features");
+ /*
+ * Get offsets of the uts_namespace's members.
+ */
+ OFFSET_INIT(uts_namespace.name, "uts_namespace", "name");
+
return TRUE;
}
@@ -2077,7 +2085,10 @@ get_str_osrelease_from_vmlinux(void)
if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) {
utsname = SYMBOL(system_utsname);
} else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) {
- utsname = SYMBOL(init_uts_ns) + sizeof(int);
+ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE)
+ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name);
+ else
+ utsname = SYMBOL(init_uts_ns) + sizeof(int);
} else {
ERRMSG("Can't get the symbol of system_utsname.\n");
return FALSE;
@@ -2284,6 +2295,7 @@ write_vmcoreinfo_data(void)
WRITE_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
WRITE_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
WRITE_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features);
+ WRITE_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name);
if (SYMBOL(node_data) != NOT_FOUND_SYMBOL)
WRITE_ARRAY_LENGTH("node_data", node_data);
@@ -2682,6 +2694,7 @@ read_vmcoreinfo(void)
READ_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
READ_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
READ_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features);
+ READ_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name);
READ_STRUCTURE_SIZE("printk_log", printk_log);
if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
diff --git a/makedumpfile.h b/makedumpfile.h
index 03fb4ce..9088f1f 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1719,6 +1719,8 @@ struct size_table {
long cpu_spec;
long pageflags;
+
+ long uts_namespace;
};
struct offset_table {
@@ -1880,6 +1882,10 @@ struct offset_table {
struct cpu_spec_s {
long mmu_features;
} cpu_spec;
+
+ struct uts_namespace_s {
+ long name;
+ } uts_namespace;
};
/*
--
2.26.2
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2020-09-18 11:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 11:55 Alexander Egorenkov [this message]
2020-12-17 9:55 ` [PATCH 1/1] makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO HAGIO KAZUHITO(萩尾 一仁)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200918115556.517586-1-egorenar@linux.ibm.com \
--to=egorenar@linux.ibm.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.