From: Baoquan He <bhe@redhat.com> To: xlpang@redhat.com Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, akpm@linux-foundation.org, Eric Biederman <ebiederm@xmission.com>, Dave Young <dyoung@redhat.com> Subject: Re: [PATCH] kexec: Update vmcoreinfo after crash happened Date: Thu, 16 Mar 2017 21:18:09 +0800 [thread overview] Message-ID: <20170316131809.GC23625@x1> (raw) In-Reply-To: <58CA86D2.70800@redhat.com> On 03/16/17 at 08:36pm, Xunlei Pang wrote: > On 03/16/2017 at 08:27 PM, Baoquan He wrote: > > Hi Xunlei, > > > > Did you really see this ever happened? Because the vmcore size estimate > > feature, namely --mem-usage option of makedumpfile, depends on the > > vmcoreinfo in 1st kernel, your change will break it. > > Hi Baoquan, > > I can reproduce it using a kernel module which modifies the vmcoreinfo, > so it's a problem can actually happen. > > > If not, it could be not good to change that. > > That's a good point, then I guess we can keep the crash_save_vmcoreinfo_init(), > and store again all the vmcoreinfo after crash. What do you think? Well, then it will make makedumpfile segfault happen too when execute below command in 1st kernel if it existed: makedumpfile --mem-usage /proc/kcore So we still need to face that problem and need fix it. vmcoreinfo_note is in kernel data area, how does module intrude into this area? And can we fix the module code? > > > > > Baoquan > > > > On 03/16/17 at 08:16pm, Xunlei Pang wrote: > >> Currently vmcoreinfo data is updated at boot time subsys_initcall(), > >> it has the risk of being modified by some wrong code during system > >> is running. > >> > >> As a result, vmcore dumped will contain the wrong vmcoreinfo. Later on, > >> when using "crash" utility to parse this vmcore, we probably will get > >> "Segmentation fault". > >> > >> Based on the fact that the value of each vmcoreinfo stays invariable > >> once kernel boots up, we safely move all the vmcoreinfo operations into > >> crash_save_vmcoreinfo() which is called after crash happened. In this > >> way, vmcoreinfo data correctness is always guaranteed. > >> > >> Signed-off-by: Xunlei Pang <xlpang@redhat.com> > >> --- > >> kernel/kexec_core.c | 14 +++----------- > >> 1 file changed, 3 insertions(+), 11 deletions(-) > >> > >> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > >> index bfe62d5..1bfdd96 100644 > >> --- a/kernel/kexec_core.c > >> +++ b/kernel/kexec_core.c > >> @@ -1367,12 +1367,6 @@ static void update_vmcoreinfo_note(void) > >> final_note(buf); > >> } > >> > >> -void crash_save_vmcoreinfo(void) > >> -{ > >> - vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > >> - update_vmcoreinfo_note(); > >> -} > >> - > >> void vmcoreinfo_append_str(const char *fmt, ...) > >> { > >> va_list args; > >> @@ -1402,7 +1396,7 @@ phys_addr_t __weak paddr_vmcoreinfo_note(void) > >> return __pa_symbol((unsigned long)(char *)&vmcoreinfo_note); > >> } > >> > >> -static int __init crash_save_vmcoreinfo_init(void) > >> +void crash_save_vmcoreinfo(void) > >> { > >> VMCOREINFO_OSRELEASE(init_uts_ns.name.release); > >> VMCOREINFO_PAGESIZE(PAGE_SIZE); > >> @@ -1474,13 +1468,11 @@ static int __init crash_save_vmcoreinfo_init(void) > >> #endif > >> > >> arch_crash_save_vmcoreinfo(); > >> - update_vmcoreinfo_note(); > >> + vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > >> > >> - return 0; > >> + update_vmcoreinfo_note(); > >> } > >> > >> -subsys_initcall(crash_save_vmcoreinfo_init); > >> - > >> /* > >> * Move into place and start executing a preloaded standalone > >> * executable. If nothing was preloaded return an error. > >> -- > >> 1.8.3.1 > >> >
WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com> To: xlpang@redhat.com Cc: Dave Young <dyoung@redhat.com>, akpm@linux-foundation.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Eric Biederman <ebiederm@xmission.com> Subject: Re: [PATCH] kexec: Update vmcoreinfo after crash happened Date: Thu, 16 Mar 2017 21:18:09 +0800 [thread overview] Message-ID: <20170316131809.GC23625@x1> (raw) In-Reply-To: <58CA86D2.70800@redhat.com> On 03/16/17 at 08:36pm, Xunlei Pang wrote: > On 03/16/2017 at 08:27 PM, Baoquan He wrote: > > Hi Xunlei, > > > > Did you really see this ever happened? Because the vmcore size estimate > > feature, namely --mem-usage option of makedumpfile, depends on the > > vmcoreinfo in 1st kernel, your change will break it. > > Hi Baoquan, > > I can reproduce it using a kernel module which modifies the vmcoreinfo, > so it's a problem can actually happen. > > > If not, it could be not good to change that. > > That's a good point, then I guess we can keep the crash_save_vmcoreinfo_init(), > and store again all the vmcoreinfo after crash. What do you think? Well, then it will make makedumpfile segfault happen too when execute below command in 1st kernel if it existed: makedumpfile --mem-usage /proc/kcore So we still need to face that problem and need fix it. vmcoreinfo_note is in kernel data area, how does module intrude into this area? And can we fix the module code? > > > > > Baoquan > > > > On 03/16/17 at 08:16pm, Xunlei Pang wrote: > >> Currently vmcoreinfo data is updated at boot time subsys_initcall(), > >> it has the risk of being modified by some wrong code during system > >> is running. > >> > >> As a result, vmcore dumped will contain the wrong vmcoreinfo. Later on, > >> when using "crash" utility to parse this vmcore, we probably will get > >> "Segmentation fault". > >> > >> Based on the fact that the value of each vmcoreinfo stays invariable > >> once kernel boots up, we safely move all the vmcoreinfo operations into > >> crash_save_vmcoreinfo() which is called after crash happened. In this > >> way, vmcoreinfo data correctness is always guaranteed. > >> > >> Signed-off-by: Xunlei Pang <xlpang@redhat.com> > >> --- > >> kernel/kexec_core.c | 14 +++----------- > >> 1 file changed, 3 insertions(+), 11 deletions(-) > >> > >> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > >> index bfe62d5..1bfdd96 100644 > >> --- a/kernel/kexec_core.c > >> +++ b/kernel/kexec_core.c > >> @@ -1367,12 +1367,6 @@ static void update_vmcoreinfo_note(void) > >> final_note(buf); > >> } > >> > >> -void crash_save_vmcoreinfo(void) > >> -{ > >> - vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > >> - update_vmcoreinfo_note(); > >> -} > >> - > >> void vmcoreinfo_append_str(const char *fmt, ...) > >> { > >> va_list args; > >> @@ -1402,7 +1396,7 @@ phys_addr_t __weak paddr_vmcoreinfo_note(void) > >> return __pa_symbol((unsigned long)(char *)&vmcoreinfo_note); > >> } > >> > >> -static int __init crash_save_vmcoreinfo_init(void) > >> +void crash_save_vmcoreinfo(void) > >> { > >> VMCOREINFO_OSRELEASE(init_uts_ns.name.release); > >> VMCOREINFO_PAGESIZE(PAGE_SIZE); > >> @@ -1474,13 +1468,11 @@ static int __init crash_save_vmcoreinfo_init(void) > >> #endif > >> > >> arch_crash_save_vmcoreinfo(); > >> - update_vmcoreinfo_note(); > >> + vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > >> > >> - return 0; > >> + update_vmcoreinfo_note(); > >> } > >> > >> -subsys_initcall(crash_save_vmcoreinfo_init); > >> - > >> /* > >> * Move into place and start executing a preloaded standalone > >> * executable. If nothing was preloaded return an error. > >> -- > >> 1.8.3.1 > >> > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2017-03-16 13:18 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-03-16 12:16 [PATCH] kexec: Update vmcoreinfo after crash happened Xunlei Pang 2017-03-16 12:16 ` Xunlei Pang 2017-03-16 12:27 ` Baoquan He 2017-03-16 12:27 ` Baoquan He 2017-03-16 12:36 ` Xunlei Pang 2017-03-16 12:36 ` Xunlei Pang 2017-03-16 13:18 ` Baoquan He [this message] 2017-03-16 13:18 ` Baoquan He 2017-03-16 13:40 ` Xunlei Pang 2017-03-16 13:40 ` Xunlei Pang 2017-03-18 18:23 ` Petr Tesarik 2017-03-18 18:23 ` Petr Tesarik 2017-03-20 2:17 ` Xunlei Pang 2017-03-20 2:17 ` Xunlei Pang 2017-03-20 13:04 ` Petr Tesarik 2017-03-20 13:04 ` Petr Tesarik 2017-03-20 19:15 ` Eric W. Biederman 2017-03-20 19:15 ` Eric W. Biederman 2017-03-21 2:05 ` Xunlei Pang 2017-03-21 2:05 ` Xunlei Pang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170316131809.GC23625@x1 \ --to=bhe@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=dyoung@redhat.com \ --cc=ebiederm@xmission.com \ --cc=kexec@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=xlpang@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.