From: HATAYAMA Daisuke Date: Wed, 20 Mar 2013 04:08:34 +0000 (+1100) Subject: vmcore, sysfs: export ELF note segment size instead of vmcoreinfo data size X-Git-Tag: next-20130320~2^2~108 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c081f5f795a5815a26343646a1de016786dd5922;p=karo-tx-linux.git vmcore, sysfs: export ELF note segment size instead of vmcoreinfo data size Currently, vmcoreinfo exports data part only, but kexec-tool sets it in p_memsz member as a whole ELF note segment size. Due to this, it would be no problem on the current ELF note segment size, but if it grows in the future, then read possibly doesn't reach ELF note header in larger p_memsz position, failing to read a whole ELF segment. Note: kexec-tools assigns PAGE_SIZE to p_memsz for other ELF note types. Due to the above reason, the same issue occurs if actual ELF note data exceeds (PAGE_SIZE - 2 * KEXEC_NOTE_HEAD_BYTES). Signed-off-by: HATAYAMA Daisuke Cc: Zhang Yanfei Cc: Vivek Goyal Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton --- diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 6ada93c23a9a..97d2763f928a 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct kobject *kobj, { return sprintf(buf, "%lx %x\n", paddr_vmcoreinfo_note(), - (unsigned int)vmcoreinfo_max_size); + (unsigned int)sizeof(vmcoreinfo_note)); } KERNEL_ATTR_RO(vmcoreinfo);