* [PATCH] kdump: Append newline to the last lien of vmcoreinfo note
@ 2012-07-17 17:36 Vivek Goyal
2012-07-18 22:04 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Vivek Goyal @ 2012-07-17 17:36 UTC (permalink / raw)
To: linux kernel mailing list, Andrew Morton; +Cc: Eric W. Biederman
Last line of vmcoreinfo note does not end with \n. Parsing all the lines
in note becomes easier if all lines end with \n instead of trying to special
case the last line.
I know atleast one tool, vmcore-dmesg in kexec-tools tree which made the
assumption that all lines end with \n. I think it is a good idea to
fix it.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
kernel/kexec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/kernel/kexec.c
===================================================================
--- linux-2.6.orig/kernel/kexec.c 2012-07-17 19:26:38.844033784 -0400
+++ linux-2.6/kernel/kexec.c 2012-07-17 23:51:33.311701781 -0400
@@ -1424,7 +1424,7 @@ static void update_vmcoreinfo_note(void)
void crash_save_vmcoreinfo(void)
{
- vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds());
+ vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds());
update_vmcoreinfo_note();
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kdump: Append newline to the last lien of vmcoreinfo note 2012-07-17 17:36 [PATCH] kdump: Append newline to the last lien of vmcoreinfo note Vivek Goyal @ 2012-07-18 22:04 ` Andrew Morton 2012-07-19 13:49 ` Vivek Goyal 0 siblings, 1 reply; 4+ messages in thread From: Andrew Morton @ 2012-07-18 22:04 UTC (permalink / raw) To: Vivek Goyal; +Cc: linux kernel mailing list, Eric W. Biederman On Tue, 17 Jul 2012 13:36:55 -0400 Vivek Goyal <vgoyal@redhat.com> wrote: > Last line of vmcoreinfo note does not end with \n. Parsing all the lines > in note becomes easier if all lines end with \n instead of trying to special > case the last line. > > I know atleast one tool, vmcore-dmesg in kexec-tools tree which made the > assumption that all lines end with \n. I think it is a good idea to > fix it. > > Signed-off-by: Vivek Goyal <vgoyal@redhat.com> > --- > kernel/kexec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux-2.6/kernel/kexec.c > =================================================================== > --- linux-2.6.orig/kernel/kexec.c 2012-07-17 19:26:38.844033784 -0400 > +++ linux-2.6/kernel/kexec.c 2012-07-17 23:51:33.311701781 -0400 > @@ -1424,7 +1424,7 @@ static void update_vmcoreinfo_note(void) > > void crash_save_vmcoreinfo(void) > { > - vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); > + vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > update_vmcoreinfo_note(); > } huh, that was a screwup. And now we have to make what must be viewed as a non-back-compatible ABI change. Ho hum, presumably there isn't a lot of code out there which is dependent upon a non-newline-terminated CRASHTIME record. Why did this work at all, anyway? Is CRASHTIME always the last-emitted record? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kdump: Append newline to the last lien of vmcoreinfo note 2012-07-18 22:04 ` Andrew Morton @ 2012-07-19 13:49 ` Vivek Goyal 2012-07-20 4:44 ` Atsushi Kumagai 0 siblings, 1 reply; 4+ messages in thread From: Vivek Goyal @ 2012-07-19 13:49 UTC (permalink / raw) To: Andrew Morton Cc: linux kernel mailing list, Eric W. Biederman, Atsushi Kumagai On Wed, Jul 18, 2012 at 03:04:39PM -0700, Andrew Morton wrote: > On Tue, 17 Jul 2012 13:36:55 -0400 > Vivek Goyal <vgoyal@redhat.com> wrote: > > > Last line of vmcoreinfo note does not end with \n. Parsing all the lines > > in note becomes easier if all lines end with \n instead of trying to special > > case the last line. > > > > I know atleast one tool, vmcore-dmesg in kexec-tools tree which made the > > assumption that all lines end with \n. I think it is a good idea to > > fix it. > > > > Signed-off-by: Vivek Goyal <vgoyal@redhat.com> > > --- > > kernel/kexec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Index: linux-2.6/kernel/kexec.c > > =================================================================== > > --- linux-2.6.orig/kernel/kexec.c 2012-07-17 19:26:38.844033784 -0400 > > +++ linux-2.6/kernel/kexec.c 2012-07-17 23:51:33.311701781 -0400 > > @@ -1424,7 +1424,7 @@ static void update_vmcoreinfo_note(void) > > > > void crash_save_vmcoreinfo(void) > > { > > - vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); > > + vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > > update_vmcoreinfo_note(); > > } > > huh, that was a screwup. And now we have to make what must be > viewed as a non-back-compatible ABI change. > > Ho hum, presumably there isn't a lot of code out there which is > dependent upon a non-newline-terminated CRASHTIME record. I think so. AFAIK, makedumpfile (vmcore filtering utility) is only user of CRASHTIME=. > > Why did this work at all, anyway? Is CRASHTIME always the last-emitted > record? Yes, CRASHTIME= is always the last emitted line in vmcoreinfo note. I had a quick look at makedumpfile code and looks like they read the whole note, dump it to a file and then do fgets() on the file in a loop. As it is last line in the file, fgets encounters EOF and reads the CRASHTIME= line successfully. So even after this change makedumpfile should remain unaffected. CCing makedumpfile maintainer, Atsushi Kumagai. Thanks Vivek ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kdump: Append newline to the last lien of vmcoreinfo note 2012-07-19 13:49 ` Vivek Goyal @ 2012-07-20 4:44 ` Atsushi Kumagai 0 siblings, 0 replies; 4+ messages in thread From: Atsushi Kumagai @ 2012-07-20 4:44 UTC (permalink / raw) To: vgoyal; +Cc: akpm, linux-kernel, ebiederm Hello Vivek, On Thu, 19 Jul 2012 09:49:21 -0400 Vivek Goyal <vgoyal@redhat.com> wrote: > On Wed, Jul 18, 2012 at 03:04:39PM -0700, Andrew Morton wrote: > > On Tue, 17 Jul 2012 13:36:55 -0400 > > Vivek Goyal <vgoyal@redhat.com> wrote: > > > > > Last line of vmcoreinfo note does not end with \n. Parsing all the lines > > > in note becomes easier if all lines end with \n instead of trying to special > > > case the last line. > > > > > > I know atleast one tool, vmcore-dmesg in kexec-tools tree which made the > > > assumption that all lines end with \n. I think it is a good idea to > > > fix it. > > > > > > Signed-off-by: Vivek Goyal <vgoyal@redhat.com> > > > --- > > > kernel/kexec.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > Index: linux-2.6/kernel/kexec.c > > > =================================================================== > > > --- linux-2.6.orig/kernel/kexec.c 2012-07-17 19:26:38.844033784 -0400 > > > +++ linux-2.6/kernel/kexec.c 2012-07-17 23:51:33.311701781 -0400 > > > @@ -1424,7 +1424,7 @@ static void update_vmcoreinfo_note(void) > > > > > > void crash_save_vmcoreinfo(void) > > > { > > > - vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); > > > + vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); > > > update_vmcoreinfo_note(); > > > } > > > > huh, that was a screwup. And now we have to make what must be > > viewed as a non-back-compatible ABI change. > > > > Ho hum, presumably there isn't a lot of code out there which is > > dependent upon a non-newline-terminated CRASHTIME record. > > I think so. AFAIK, makedumpfile (vmcore filtering utility) is only > user of CRASHTIME=. > > > > > Why did this work at all, anyway? Is CRASHTIME always the last-emitted > > record? > > Yes, CRASHTIME= is always the last emitted line in vmcoreinfo note. > > I had a quick look at makedumpfile code and looks like they read the whole > note, dump it to a file and then do fgets() on the file in a loop. As it is > last line in the file, fgets encounters EOF and reads the CRASHTIME= line > successfully. So even after this change makedumpfile should remain > unaffected. > > CCing makedumpfile maintainer, Atsushi Kumagai. As you said, makedumpfile reads VMCOREINFO line by line with fgets(). So, it's OK that the end of the last line is whether \n or EOF. Therefore, this change doesn't affect makedumpfile. Thanks Atsushi Kumagai ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-20 4:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-17 17:36 [PATCH] kdump: Append newline to the last lien of vmcoreinfo note Vivek Goyal 2012-07-18 22:04 ` Andrew Morton 2012-07-19 13:49 ` Vivek Goyal 2012-07-20 4:44 ` Atsushi Kumagai
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.