]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vmcore, sysfs: export ELF note segment size instead of vmcoreinfo data size
authorHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Wed, 20 Mar 2013 04:08:34 +0000 (15:08 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Mar 2013 04:23:27 +0000 (15:23 +1100)
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 <d.hatayama@jp.fujitsu.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/ksysfs.c

index 6ada93c23a9ac55e0c5aaebe9fcd98c05f2c84dd..97d2763f928a0c6b8abd0b0739ec2bf8308fb67a 100644 (file)
@@ -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);