mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
kexec: move vmcoreinfo out of the kernel's .bss section
As Eric said, "what we need to do is move the variable vmcoreinfo_note out of the kernel's .bss section. And modify the code to regenerate and keep this information in something like the control page. Definitely something like this needs a page all to itself, and ideally far away from any other kernel data structures. I clearly was not watching closely the data someone decided to keep this silly thing in the kernel's .bss section." This patch allocates extra pages for these vmcoreinfo_XXX variables, one advantage is that it enhances some safety of vmcoreinfo, because vmcoreinfo now is kept far away from other kernel data structures. Link: http://lkml.kernel.org/r/1493281021-20737-1-git-send-email-xlpang@redhat.com Signed-off-by: Xunlei Pang <xlpang@redhat.com> Tested-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Reviewed-by: Juergen Gross <jgross@suse.com> Suggested-by: Eric Biederman <ebiederm@xmission.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Dave Young <dyoung@redhat.com> Cc: Hari Bathini <hbathini@linux.vnet.ibm.com> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
112166f88c
commit
203e9e4121
8 changed files with 29 additions and 21 deletions
|
@ -14,10 +14,10 @@
|
|||
#include <asm/sections.h>
|
||||
|
||||
/* vmcoreinfo stuff */
|
||||
static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
|
||||
u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
|
||||
static unsigned char *vmcoreinfo_data;
|
||||
size_t vmcoreinfo_size;
|
||||
size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
|
||||
size_t vmcoreinfo_max_size = VMCOREINFO_BYTES;
|
||||
u32 *vmcoreinfo_note;
|
||||
|
||||
/*
|
||||
* parsing the "crashkernel" commandline
|
||||
|
@ -326,6 +326,9 @@ static void update_vmcoreinfo_note(void)
|
|||
|
||||
void crash_save_vmcoreinfo(void)
|
||||
{
|
||||
if (!vmcoreinfo_note)
|
||||
return;
|
||||
|
||||
vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds());
|
||||
update_vmcoreinfo_note();
|
||||
}
|
||||
|
@ -356,11 +359,26 @@ void __weak arch_crash_save_vmcoreinfo(void)
|
|||
|
||||
phys_addr_t __weak paddr_vmcoreinfo_note(void)
|
||||
{
|
||||
return __pa_symbol((unsigned long)(char *)&vmcoreinfo_note);
|
||||
return __pa(vmcoreinfo_note);
|
||||
}
|
||||
|
||||
static int __init crash_save_vmcoreinfo_init(void)
|
||||
{
|
||||
vmcoreinfo_data = (unsigned char *)get_zeroed_page(GFP_KERNEL);
|
||||
if (!vmcoreinfo_data) {
|
||||
pr_warn("Memory allocation for vmcoreinfo_data failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!vmcoreinfo_note) {
|
||||
free_page((unsigned long)vmcoreinfo_data);
|
||||
vmcoreinfo_data = NULL;
|
||||
pr_warn("Memory allocation for vmcoreinfo_note failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
|
||||
VMCOREINFO_PAGESIZE(PAGE_SIZE);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue