[PATCH] makedumpfile: Add a existence check of symbols for --dump-dmesg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
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



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux