Received: by 10.223.185.116 with SMTP id b49csp4023314wrg; Mon, 26 Feb 2018 09:50:33 -0800 (PST) X-Google-Smtp-Source: AH8x227fPlUX+Vc3hxII3rJELZSSoMKP020GWJBwAUOejWR+0szCWQ2v+pwKGQP6Z/lfAsMGiWgN X-Received: by 2002:a17:902:60cf:: with SMTP id k15-v6mr11170174pln.347.1519667433793; Mon, 26 Feb 2018 09:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519667433; cv=none; d=google.com; s=arc-20160816; b=rS5ulnA9NX+oi5OE+dWsCvyvrt9Y9pC6nimpw3SS6QwgXevk67NmyO4b/Tt/4LNo03 A11QxT9MYT6FcXLXNqpG6S4II5eR2vAH9GYgZr8nxOTCHB3zlgWbSC526fuXNEccpXjf I0So8nFxGiqF1yxwwUyUVk3yDOAvdjP9sRel4F0FVvaDXUgEOjHQq+9gCFOvDoh6z4NG qEMLeMTbJ1TCavZyR8xw36sE7broLDWXa9m1E/SgiZRx+d9wZAKvW3zj+aRSCR5a2qZE xthmaCugWc1KvR2XE60hYeUoTLiRYwmocqzbjTS3v0Azr9sxO9SQoCngaX4VmyINDa40 KDXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=dTkTD0MIQQYGLhp4g3ArYBitbRfvT4rTvcrHqq1KNfg=; b=FCLCEuEHcCZfSECLfiwc56CX6T4iSqf5oJCK6VmchsG+pjmAZU2RjgaSAsyAgWV49a H5q54e3KVACOWfX4H/2CJI3hYMu7a/aHM3soGX6+nAbYkkWXznFfLhQvWB9wooKbUtWi i+H7NlxGNmermkRVtWXPulv58aAaqviYvittmjQcNi3axuwyJ6hVDMfq0M6vuh3DcOw7 PlQmEelwW1X6suJ739jtyoUxpc7HnJ0w8Yr/7FLxFIFpdP3C/Cmyvvz4sPY8s6SPEY0A DeGEpNrJXf1gDQbB+s8+k36iQ1CtG6Inee8nZcZyxh1al30p1VZbwxVzgt0FRxapmWvR sE5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gdyn/YIh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e61-v6si7146046plb.190.2018.02.26.09.50.17; Mon, 26 Feb 2018 09:50:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gdyn/YIh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908AbeBZRs3 (ORCPT + 99 others); Mon, 26 Feb 2018 12:48:29 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35106 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbeBZRs0 (ORCPT ); Mon, 26 Feb 2018 12:48:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dTkTD0MIQQYGLhp4g3ArYBitbRfvT4rTvcrHqq1KNfg=; b=gdyn/YIhuwcIuOK/jkMcqPoCz khf2XHstAQPPb+IiQkyZwzZQdQY2DhTHhqSF+RVciwXux9EIsElnqv4fUIJmuPOo7hFe3lNEgpSm0 z7zsfTfdXSKENypJ0qNRXm69dtydJqORS7UACcD6OuVRGKFIjkvRYxIw5VYLvIUX6MYxvwwA7JWG4 UDr+722UZFjmHWXIneZf7HE6c/RHVrtu1bx1Wv2R6yLWEWT56EFQFiZCIV3O+ROYrL7FcnyEJrNxN JszJvvivv8j/yNyk28a2xzxRiUE5CM+/CYnNCAoaMVCKFx7NcnXP71z4pGGBzRuKdljtNTgOCd68K NO03NWgmA==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eqMt0-0001is-3k; Mon, 26 Feb 2018 17:48:26 +0000 Subject: Re: [PATCH 1/1] Additional strict check on ELF file. Checks segments are followed in order of 'p_vaddr ' value ascending. It fixes erorr in total_mapping_size with computation total size. This error happens if segments in ELF file are not in order. To: Ilya Smith , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180226154659.10218-1-blackzert@gmail.com> <20180226154659.10218-2-blackzert@gmail.com> From: Randy Dunlap Message-ID: <16811dde-abb3-1504-003c-475d40610f9f@infradead.org> Date: Mon, 26 Feb 2018 09:48:23 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180226154659.10218-2-blackzert@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/2018 07:46 AM, Ilya Smith wrote: > Signed-off-by: Ilya Smith > --- > fs/binfmt_elf.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c > index bdb201230bae..970b42044240 100644 > --- a/fs/binfmt_elf.c > +++ b/fs/binfmt_elf.c > @@ -524,6 +524,52 @@ static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp, > > #endif /* !CONFIG_ARCH_BINFMT_ELF_STATE */ > > +/** > + * elf_check_phdr() - common check ELF program header. > + * @phdr: The program header to check > + * @phdr_num: Count of program headers in @phdr from elf header. > + * > + * Checks ELF binary meets specification. > + * > + * Return: Zero to proceed with ELF load, non-zero to faile the ELF load fail > + * with that return code. > + */ > +static int elf_check_phdr(struct elf_phdr *phdr, unsigned long phdr_num) > +{ And it would be nicer/better to have all of the "intro" text in the body of this message instead of in another email. thanks, -- ~Randy