* [PATCH] kdump: Fix exported size of vmcoreinfo note
@ 2014-01-14 19:33 Vivek Goyal
2014-01-14 19:35 ` Vivek Goyal
2014-01-14 23:35 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Vivek Goyal @ 2014-01-14 19:33 UTC (permalink / raw)
To: linux kernel mailing list, Andrew Morton; +Cc: Greg KH, Kexec Mailing List
Right now we seem to be exporting the max data size contained inside
vmcoreinfo note. But this does not include the size of meta data around
vmcore info data. Like name of the note and starting and ending elf_note.
I think user space expects total size and that size is put in PT_NOTE
elf header. Things seem to be fine so far because we are not using
vmcoreinfo note to the maximum capacity. But as it starts filling up,
to capacity, at some point of time, problem will be visible.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
kernel/ksysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/kernel/ksysfs.c
===================================================================
--- linux-2.6.orig/kernel/ksysfs.c 2014-01-14 14:09:42.107767503 -0500
+++ linux-2.6/kernel/ksysfs.c 2014-01-14 14:15:24.385510314 -0500
@@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct ko
{
return sprintf(buf, "%lx %x\n",
paddr_vmcoreinfo_note(),
- (unsigned int)vmcoreinfo_max_size);
+ (unsigned int)sizeof(vmcoreinfo_note));
}
KERNEL_ATTR_RO(vmcoreinfo);
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kdump: Fix exported size of vmcoreinfo note
2014-01-14 19:33 [PATCH] kdump: Fix exported size of vmcoreinfo note Vivek Goyal
@ 2014-01-14 19:35 ` Vivek Goyal
2014-01-14 23:35 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Vivek Goyal @ 2014-01-14 19:35 UTC (permalink / raw)
To: linux kernel mailing list, Andrew Morton; +Cc: Greg KH, Kexec Mailing List
CCed to old mail id of Greg. Fixing it.
On Tue, Jan 14, 2014 at 02:33:11PM -0500, Vivek Goyal wrote:
> Right now we seem to be exporting the max data size contained inside
> vmcoreinfo note. But this does not include the size of meta data around
> vmcore info data. Like name of the note and starting and ending elf_note.
>
> I think user space expects total size and that size is put in PT_NOTE
> elf header. Things seem to be fine so far because we are not using
> vmcoreinfo note to the maximum capacity. But as it starts filling up,
> to capacity, at some point of time, problem will be visible.
>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
> kernel/ksysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/kernel/ksysfs.c
> ===================================================================
> --- linux-2.6.orig/kernel/ksysfs.c 2014-01-14 14:09:42.107767503 -0500
> +++ linux-2.6/kernel/ksysfs.c 2014-01-14 14:15:24.385510314 -0500
> @@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct ko
> {
> return sprintf(buf, "%lx %x\n",
> paddr_vmcoreinfo_note(),
> - (unsigned int)vmcoreinfo_max_size);
> + (unsigned int)sizeof(vmcoreinfo_note));
> }
> KERNEL_ATTR_RO(vmcoreinfo);
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kdump: Fix exported size of vmcoreinfo note
2014-01-14 19:33 [PATCH] kdump: Fix exported size of vmcoreinfo note Vivek Goyal
2014-01-14 19:35 ` Vivek Goyal
@ 2014-01-14 23:35 ` Andrew Morton
2014-01-15 15:12 ` Vivek Goyal
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2014-01-14 23:35 UTC (permalink / raw)
To: Vivek Goyal
Cc: Ken'ichi Ohmichi, Greg KH, Kexec Mailing List,
linux kernel mailing list, Dan Aloni
On Tue, 14 Jan 2014 14:33:11 -0500 Vivek Goyal <vgoyal@redhat.com> wrote:
> Right now we seem to be exporting the max data size contained inside
> vmcoreinfo note. But this does not include the size of meta data around
> vmcore info data. Like name of the note and starting and ending elf_note.
>
> I think user space expects total size and that size is put in PT_NOTE
> elf header. Things seem to be fine so far because we are not using
> vmcoreinfo note to the maximum capacity. But as it starts filling up,
> to capacity, at some point of time, problem will be visible.
urgh. This is what we get for adding undocumented interfaces.
Looking through the fd59d231f81cb0287 changelog and the various email
threads it points to I can find no mention of what vmcoreinfo is
*supposed* to contain. It was just kinda silently tossed in there.
So as a remedial step, could we please get this and any associated
interfaces written down in a way which people can very belatedly
review?
Phrases like "I think user space expects" and "Things seem to be fine
so far" don't inspire a ton of confidence. What are the chances of
userspace breakage here? Would it be safer/saner to leave vmcoreinfo
alone and add a new vmcoreinfo2 with the altered behaviour?
> --- linux-2.6.orig/kernel/ksysfs.c 2014-01-14 14:09:42.107767503 -0500
> +++ linux-2.6/kernel/ksysfs.c 2014-01-14 14:15:24.385510314 -0500
> @@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct ko
> {
> return sprintf(buf, "%lx %x\n",
> paddr_vmcoreinfo_note(),
> - (unsigned int)vmcoreinfo_max_size);
> + (unsigned int)sizeof(vmcoreinfo_note));
> }
> KERNEL_ATTR_RO(vmcoreinfo);
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kdump: Fix exported size of vmcoreinfo note
2014-01-14 23:35 ` Andrew Morton
@ 2014-01-15 15:12 ` Vivek Goyal
0 siblings, 0 replies; 4+ messages in thread
From: Vivek Goyal @ 2014-01-15 15:12 UTC (permalink / raw)
To: Andrew Morton
Cc: Ken'ichi Ohmichi, Greg KH, Kexec Mailing List,
linux kernel mailing list, Dan Aloni
On Tue, Jan 14, 2014 at 03:35:54PM -0800, Andrew Morton wrote:
> On Tue, 14 Jan 2014 14:33:11 -0500 Vivek Goyal <vgoyal@redhat.com> wrote:
>
> > Right now we seem to be exporting the max data size contained inside
> > vmcoreinfo note. But this does not include the size of meta data around
> > vmcore info data. Like name of the note and starting and ending elf_note.
> >
> > I think user space expects total size and that size is put in PT_NOTE
> > elf header. Things seem to be fine so far because we are not using
> > vmcoreinfo note to the maximum capacity. But as it starts filling up,
> > to capacity, at some point of time, problem will be visible.
>
> urgh. This is what we get for adding undocumented interfaces.
>
> Looking through the fd59d231f81cb0287 changelog and the various email
> threads it points to I can find no mention of what vmcoreinfo is
> *supposed* to contain. It was just kinda silently tossed in there.
>
> So as a remedial step, could we please get this and any associated
> interfaces written down in a way which people can very belatedly
> review?
Sure. I will send another patch to add some documentation for vmcoreinfo
in Documentation/ABI/testing/* in a separate patch.
>
> Phrases like "I think user space expects" and "Things seem to be fine
> so far" don't inspire a ton of confidence. What are the chances of
> userspace breakage here? Would it be safer/saner to leave vmcoreinfo
> alone and add a new vmcoreinfo2 with the altered behaviour?
I don't think user space will be broken with this change. So there is
no need to introduce vmcoreinfo2. This change is safe and backward
compatible. More explanation on why this change is safe is below.
vmcoreinfo contains information about kernel which user space needs to
know to do things like filtering. For example, various kernel config
options or information about size or offset of some data structures etc.
All this information is commmunicated to user space with an ELF note
present in ELF /proc/vmcore file.
Currently vmcoreinfo data size is 4096. With some elf note meta data
around it, actual size is 4132 bytes. But we are using barely 25% of
that size. Rest is empty. So even if we tell user space that size of
ELf note is 4096 and not 4132, nothing will be broken becase after
around 1000 bytes, everything is zero anyway.
But once we start filling up the note to the capacity, and not report
the full size of note, bad things will start happening. Either some data
will be lost or tools will be confused that they did not fine the zero
note at the end.
So I think this change is safe and should not break existing tools.
Thanks
Vivek
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-15 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 19:33 [PATCH] kdump: Fix exported size of vmcoreinfo note Vivek Goyal
2014-01-14 19:35 ` Vivek Goyal
2014-01-14 23:35 ` Andrew Morton
2014-01-15 15:12 ` Vivek Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox