o This patch adds a new note type NT_KDUMPINFO. This note is added with
kernel core dumps generated by kdump.
o This note mainly communicates the information required by kernel dump
analysis tool "crash" to analyze the kernel core dump. As of now it contains
the pointer to task struct of panicing task and page size. Page size is
irrelevant for i386 but is required for architectures like ia64 and ppc64.
o gdb is not affected by this change as gdb need not to parse this note.
Signed-off-by: Vivek Goyal <[email protected]>
---
linux-2.6.14-rc1-mm1-vivek/arch/i386/kernel/crash.c | 9 +++++++++
linux-2.6.14-rc1-mm1-vivek/include/linux/elf.h | 2 +-
linux-2.6.14-rc1-mm1-vivek/include/linux/elfcore.h | 13 +++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff -puN arch/i386/kernel/crash.c~kdump-x86-add-note-type-nt-kdump arch/i386/kernel/crash.c
--- linux-2.6.14-rc1-mm1/arch/i386/kernel/crash.c~kdump-x86-add-note-type-nt-kdump 2005-09-21 12:22:14.113474136 +0530
+++ linux-2.6.14-rc1-mm1-vivek/arch/i386/kernel/crash.c 2005-09-21 12:22:14.128471856 +0530
@@ -62,6 +62,7 @@ static void final_note(u32 *buf)
static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
{
struct elf_prstatus prstatus;
+ struct elf_kdumpinfo kdumpinfo;
u32 *buf;
if ((cpu < 0) || (cpu >= NR_CPUS))
@@ -80,6 +81,14 @@ static void crash_save_this_cpu(struct p
elf_core_copy_regs(&prstatus.pr_reg, regs);
buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
sizeof(prstatus));
+
+ /* Also store NT_KDUMPINFO */
+ if (cpu == crashing_cpu) {
+ kdumpinfo.page_shift = PAGE_SHIFT;
+ kdumpinfo.panic_tsk = current;
+ buf = append_elf_note(buf, "CORE", NT_KDUMPINFO, &kdumpinfo,
+ sizeof(kdumpinfo));
+ }
final_note(buf);
}
diff -puN include/linux/elfcore.h~kdump-x86-add-note-type-nt-kdump include/linux/elfcore.h
--- linux-2.6.14-rc1-mm1/include/linux/elfcore.h~kdump-x86-add-note-type-nt-kdump 2005-09-21 12:22:14.116473680 +0530
+++ linux-2.6.14-rc1-mm1-vivek/include/linux/elfcore.h 2005-09-21 12:22:14.129471704 +0530
@@ -79,9 +79,22 @@ struct elf_prpsinfo
char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
};
+/*
+ * NT_KDUMPINFO can be used to communicate additional information required for
+ * kernel core dumps. Additional information includes kernel configuration
+ * variables like page size and any other relevant data required by
+ * debugger (crash in this case).
+*/
+struct elf_kdumpinfo
+{
+ char page_shift; /* Page size */
+ struct task_struct *panic_tsk; /* Pointer to panic task_struct */
+};
+
#ifndef __KERNEL__
typedef struct elf_prstatus prstatus_t;
typedef struct elf_prpsinfo prpsinfo_t;
+typedef struct elf_kdumpinfo kdumpinfo_t;
#define PRARGSZ ELF_PRARGSZ
#endif
diff -puN include/linux/elf.h~kdump-x86-add-note-type-nt-kdump include/linux/elf.h
--- linux-2.6.14-rc1-mm1/include/linux/elf.h~kdump-x86-add-note-type-nt-kdump 2005-09-21 12:22:14.120473072 +0530
+++ linux-2.6.14-rc1-mm1-vivek/include/linux/elf.h 2005-09-21 12:22:14.130471552 +0530
@@ -391,7 +391,7 @@ typedef struct elf64_shdr {
#define NT_TASKSTRUCT 4
#define NT_AUXV 6
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
-
+#define NT_KDUMPINFO 7 /* Used for kernel core dumps */
/* Note header in a PT_NOTE section */
typedef struct elf32_note {
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|