[PATCH] makedumpfile: Add a existence check of symbols for --dump-dmesg
Atsushi Kumagai
kumagai-atsushi at mxc.nes.nec.co.jp
Mon Dec 16 01:07:05 EST 2013
Hello,
I found a bug while testing for makedumpfile-1.5.5.
I'll release v1.5.5 after retesting with this patch, it will be
a few days later.
Thanks
Atsushi Kumagai
From: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
Date: Mon, 16 Dec 2013 14:00:51 +0900
Subject: [PATCH] Add a existence check of symbols for --dump-dmesg.
Since the format of the kernel log buffer was changed in kernel 3.5,
some symbols related to the format have been needed for --dump-dmesg
option. However, the functions for it use the symbols without
existence check, so makedumpfile can run into unexpected error.
In practice, this is a definite issue since kernel 3.5 doesn't
export SIZE(log) to VMCOREINFO.
Signed-off-by: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
---
makedumpfile.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/makedumpfile.c b/makedumpfile.c
index 20f107e..23251a1 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -4036,6 +4036,14 @@ dump_dmesg()
if (!close_files_for_creating_dumpfile())
goto out;
} else {
+ if (SIZE(printk_log) == NOT_FOUND_STRUCTURE ||
+ OFFSET(printk_log.len) == NOT_FOUND_STRUCTURE ||
+ OFFSET(printk_log.text_len) == NOT_FOUND_STRUCTURE ||
+ OFFSET(printk_log.ts_nsec) == NOT_FOUND_STRUCTURE) {
+ ERRMSG("Can't get necessary structures for extracting dmesg log.\n");
+ goto out;
+ }
+
if (!readmem(VADDR, log_buf, log_buffer, log_buf_len)) {
ERRMSG("Can't read indexed dmesg log.\n");
goto out;
--
1.8.0.2
More information about the kexec
mailing list