Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755193Ab3CSCfw (ORCPT ); Mon, 18 Mar 2013 22:35:52 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:46198 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756753Ab3CSCa0 (ORCPT ); Mon, 18 Mar 2013 22:30:26 -0400 From: HATAYAMA Daisuke Subject: [PATCH v3 04/21] vmcore, sysfs: export ELF note segment size instead of vmcoreinfo data size To: vgoyal@redhat.com, ebiederm@xmission.com, cpw@sgi.com, kumagai-atsushi@mxc.nes.nec.co.jp, lisa.mitchell@hp.com, heiko.carstens@de.ibm.com, akpm@linux-foundation.org Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, zhangyanfei@cn.fujitsu.com Date: Sat, 16 Mar 2013 13:01:10 +0900 Message-ID: <20130316040109.15064.41863.stgit@localhost6.localdomain6> In-Reply-To: <20130316040003.15064.62308.stgit@localhost6.localdomain6> References: <20130316040003.15064.62308.stgit@localhost6.localdomain6> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1320 Lines: 35 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 --- kernel/ksysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 6ada93c..97d2763 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/