Commit 666bfddb authored by Vivek Goyal's avatar Vivek Goyal Committed by Linus Torvalds

[PATCH] kdump: Access dump file in elf format (/proc/vmcore)

From: "Vivek Goyal" <vgoyal@in.ibm.com>

o Support for /proc/vmcore interface. This interface exports elf core image
  either in ELF32 or ELF64 format, depending on the format in which elf headers
  have been stored by crashed kernel.
o Added support for CONFIG_VMCORE config option.
o Removed the dependency on /proc/kcore.

From: "Eric W. Biederman" <ebiederm@xmission.com>

This patch has been refactored to more closely match the prevailing style in
the affected files.  And to clearly indicate the dependency between
/proc/kcore and proc/vmcore.c

From: Hariprasad Nellitheertha <hari@in.ibm.com>

This patch contains the code that provides an ELF format interface to the
previous kernel's memory post kexec reboot.

Signed off by Hariprasad Nellitheertha <hari@in.ibm.com>
Signed-off-by: default avatarEric Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarVivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2030eae5
...@@ -734,6 +734,12 @@ config PROC_KCORE ...@@ -734,6 +734,12 @@ config PROC_KCORE
bool "/proc/kcore support" if !ARM bool "/proc/kcore support" if !ARM
depends on PROC_FS && MMU depends on PROC_FS && MMU
config PROC_VMCORE
bool "/proc/vmcore support (EXPERIMENTAL)"
depends on PROC_FS && EMBEDDED && EXPERIMENTAL && CRASH_DUMP
help
Exports the dump image of crashed kernel in ELF format.
config SYSFS config SYSFS
bool "sysfs file system support" if EMBEDDED bool "sysfs file system support" if EMBEDDED
default y default y
......
...@@ -11,4 +11,5 @@ proc-y += inode.o root.o base.o generic.o array.o \ ...@@ -11,4 +11,5 @@ proc-y += inode.o root.o base.o generic.o array.o \
kmsg.o proc_tty.o proc_misc.o kmsg.o proc_tty.o proc_misc.o
proc-$(CONFIG_PROC_KCORE) += kcore.o proc-$(CONFIG_PROC_KCORE) += kcore.o
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/crash_dump.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -618,6 +619,11 @@ void __init proc_misc_init(void) ...@@ -618,6 +619,11 @@ void __init proc_misc_init(void)
(size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
} }
#endif #endif
#ifdef CONFIG_PROC_VMCORE
proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL);
if (proc_vmcore)
proc_vmcore->proc_fops = &proc_vmcore_operations;
#endif
#ifdef CONFIG_MAGIC_SYSRQ #ifdef CONFIG_MAGIC_SYSRQ
entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL); entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
if (entry) if (entry)
......
This diff is collapsed.
...@@ -7,8 +7,12 @@ ...@@ -7,8 +7,12 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#define ELFCORE_ADDR_MAX (-1ULL)
extern unsigned long long elfcorehdr_addr; extern unsigned long long elfcorehdr_addr;
extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
unsigned long, int); unsigned long, int);
extern struct file_operations proc_vmcore_operations;
extern struct proc_dir_entry *proc_vmcore;
#endif /* CONFIG_CRASH_DUMP */ #endif /* CONFIG_CRASH_DUMP */
#endif /* LINUX_CRASHDUMP_H */ #endif /* LINUX_CRASHDUMP_H */
...@@ -74,6 +74,13 @@ struct kcore_list { ...@@ -74,6 +74,13 @@ struct kcore_list {
size_t size; size_t size;
}; };
struct vmcore {
struct list_head list;
unsigned long long paddr;
unsigned long size;
loff_t offset;
};
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
extern struct proc_dir_entry proc_root; extern struct proc_dir_entry proc_root;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* Stores the physical address of elf header of crash image. */ /* Stores the physical address of elf header of crash image. */
unsigned long long elfcorehdr_addr; unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
/* /*
* Copy a page from "oldmem". For this page, there is no pte mapped * Copy a page from "oldmem". For this page, there is no pte mapped
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment