lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130311173650.GG8482@redhat.com>
Date:	Mon, 11 Mar 2013 13:36:50 -0400
From:	Vivek Goyal <vgoyal@...hat.com>
To:	HATAYAMA Daisuke <d.hatayama@...fujitsu.com>
Cc:	zhangyanfei@...fujitsu.com, kexec@...ts.infradead.org,
	heiko.carstens@...ibm.com, linux-kernel@...r.kernel.org,
	lisa.mitchell@...com, kumagai-atsushi@....nes.nec.co.jp,
	ebiederm@...ssion.com, akpm@...ux-foundation.org, cpw@....com
Subject: Re: [PATCH v2 01/20] vmcore: refer to e_phoff member explicitly

On Mon, Mar 11, 2013 at 09:31:41AM +0900, HATAYAMA Daisuke wrote:
> From: Zhang Yanfei <zhangyanfei@...fujitsu.com>
> Subject: Re: [PATCH v2 01/20] vmcore: refer to e_phoff member explicitly
> Date: Sun, 10 Mar 2013 14:46:31 +0800
> 
> > 于 2013年03月05日 15:35, Zhang Yanfei 写道:
> >> 于 2013年03月02日 16:35, HATAYAMA Daisuke 写道:
> <cut>
> > 
> > One minor suggestion.
> > 
> > Previously, when the code assumes program headers are following immediately
> > the ELF header, it uses
> > 
> >  elfcorebuf_sz = sizeof(Elf64_Ehdr) + ehdr.e_phnum * sizeof(Elf64_Phdr);
> > 
> > to calculate the size of ELF header and ELF program headers
> > 
> > This patch avoids the assumption, and uses ehdr.e_phoff to get the program
> > headers' address. But it will read unrelated contents into elfcorebuf if
> > program headers are not following immediately the ELF header. So could the
> > code be:
> > 
> > elfcorebuf_sz = sizeof(Elf64_Ehdr) + ehdr.e_phnum * sizeof(Elf64_Phdr);
> > addr = elfcorehdr_addr + ehdr.e_phoff;
> > memcpy(elfcorebuf, &ehdr, sizeof(Elf64_Ehdr));
> > read_from_oldmem(elfcorebuf + sizeof(Elf64_Ehdr), elfcorebuf_sz -
> >                  sizeof(Elf64_Ehdr), &addr, 0);
> > (Elf64_Ehdr *)elfcorebuf->e_phoff = sizeof(Elf64_Ehdr);
> 
> Thanks. This is not minor suggestion. This is critical. My code is
> completely broken. On ELF, segments and headers other than ELF header
> can occur in any positions. This means program header table can occur
> after segments. So, on terabyte systems, e_phoff can be more than
> terabytes.

Agreed. It is safer to not copy al the bits till e_phoff.

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ