From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:44640 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894AbdKGMAV (ORCPT ); Tue, 7 Nov 2017 07:00:21 -0500 Date: Tue, 7 Nov 2017 20:00:15 +0800 From: Baoquan He To: linux-kernel@vger.kernel.org Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, oleg@redhat.com, mhocko@kerne.org, keescook@chromium.org, jkosina@suse.cz, mingo@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org Subject: Re: [PATCH 0/3] binfmt_elf: Clean up codes related to total_size passed into elf_map() Message-ID: <20171107120015.GB14732@x1> References: <1507261078-23615-1-git-send-email-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507261078-23615-1-git-send-email-bhe@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi maintainers and experts, Any comment about this patchset? At least for patch 2, I think we can correct it since we do not have to take the total_size way for PIE programs which are MAP_FIXED and are loaded offset from ELF_ET_DYN_BASE. That is making code a little confusing. About patch 3, it's pointed out in an Redhat internal patch reviewing. I am fine if no one like it. If approved, I can update the git log to make it better and repost. Thanks Baoquan On 10/06/17 at 11:37am, Baoquan He wrote: > Currently total_size passed into elf_map() is non-zero only for dynamic > loader, either in load_elf_interp(), or in load_elf_binary() for ET_DYN > without INTERP case. Now PIE programs are loaded offset from ELF_ET_DYN_BASE, > and map flags has been set as MAP_FIXED, no need to use tatal_size strategy. > > And in elf_map(), Oleg pointed out that the mmap(total_size) + munmap(extra_size) > way looks very ugly. We can search the unmapped area of total_size big, > then only map the 1st PT_LOAD segment with the searched address. > > In this patchset, clean up them all. > > Baoquan He (3): > binfmt_elf: Clean up the variable name of map flags > binfmt_elf: Get the total_size only for dynamic loader in > load_elf_binary() > binfmt_elf: Search an unmapped area with total_size but not map the > whole image > > fs/binfmt_elf.c | 50 +++++++++++++++++++++++++++----------------------- > 1 file changed, 27 insertions(+), 23 deletions(-) > > -- > 2.5.5 >