From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH v2] fs: binfmt_elf: Add ELF header consistency checks Date: Thu, 21 Nov 2013 01:39:19 +0000 Message-ID: <20131121013918.GI10323@ZenIV.linux.org.uk> References: <1384994071-12283-1-git-send-email-geyslan@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-br@googlegroups.com To: "Geyslan G. Bem" Return-path: Content-Disposition: inline In-Reply-To: <1384994071-12283-1-git-send-email-geyslan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Nov 20, 2013 at 09:34:31PM -0300, Geyslan G. Bem wrote: > The member 'e_ehsize' that holds the ELF header size is compared > with the elfhdr struct size. If not equal, goes out. > If 'e_phoff' holds 0 the object has no program header table, so > goes out. > Ensures the file being loaded has the correct data encoding, checking > 'e_ident[EI_DATA]' against 'ELF_DATA'. > > Besides the checks being in accordance with the ELF Specifications, > they increase the binary consistency reducing the use of malformed ones. This is completely misguided. We are allowed to reject such binaries, but what's the point of doing that?