Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1944814ybz; Thu, 30 Apr 2020 08:11:10 -0700 (PDT) X-Google-Smtp-Source: APiQypJ/0b4mE9dPQf+AUDD2l0NyVeYdR/fioA8bR7qJwXXbtxjZdTkmmr0qFs5CYvI+ijQBJzop X-Received: by 2002:a05:6402:1713:: with SMTP id y19mr3299510edu.40.1588259470561; Thu, 30 Apr 2020 08:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588259470; cv=none; d=google.com; s=arc-20160816; b=ozj1YYdaaR+bVwcOfRrdcdL+VZ4nOEg5ZIJlCun8gyuzoRolDCE2hXuxyWX6XjHeGc IMXSOb5mF4Zzq09576yCTjajQzIMWxOS80cqCuPKDjznGH0EH9Jlb34CBs9OXmHlP8KP /f1rfLMS58PnmHEDngaJxRynXs4XW2EcGCFKjV7qRwznCJYseyR7WUtH16JYXKIM4sEd pCCB0ta5ms7ykkM8fo5Yr+fZk2qSOzjejH+XlI+Mn5i710+coC46U8yyrVEmnIz+E4JS fMXunG1CiJorDUgB02hE0qk8x64jfSY19Z7dCLXJJ/6g2Kkgddf9ex93d+lT4imyKcGB REEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9ZRfY+aUAl2bGP6abt2O3+ui313g3qi6dc9rEWhzGTo=; b=vwttnK0wysQdgi54tUkzhgfcpVa6q6PRwDoxOCr8i231S3jCEtDd4s1F2hjz7DXKKT StcrEKZCveHj6/bgFlAV34XWpiQN0P2/QcJqs/FavMWFfMk2sBn0V5tHyEk88qDBoitL yTn5258oQaloCgDEPBOqQlOdilpShrr8K8uflmmIPOAYJdqonYRfK132RZsz7TQP2Icr b56YWtqUYoS8+bGKN0UMWUN+6gEmfm2Lf578hD6YR6sJQJOCEVkV3TEZ3SX7UT3kM58n lCPMOgShl4ddRfzX9XSu2h1vJBRjJk8zae9tbtySoXYxoi0DkK5HBAbDTkqzwPoW+kDa 6JSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si5920005ejb.274.2020.04.30.08.10.46; Thu, 30 Apr 2020 08:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgD3PIs (ORCPT + 99 others); Thu, 30 Apr 2020 11:08:48 -0400 Received: from brightrain.aerifal.cx ([216.12.86.13]:48622 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbgD3PIr (ORCPT ); Thu, 30 Apr 2020 11:08:47 -0400 X-Greylist: delayed 1041 seconds by postgrey-1.27 at vger.kernel.org; Thu, 30 Apr 2020 11:08:47 EDT Date: Thu, 30 Apr 2020 10:51:23 -0400 From: Rich Felker To: Greg Ungerer Cc: Linus Torvalds , Russell King - ARM Linux admin , Jann Horn , Nicolas Pitre , Andrew Morton , Christoph Hellwig , Linux Kernel Mailing List , Linux-MM , linux-fsdevel , Alexander Viro , "Eric W . Biederman" , Oleg Nesterov , Linux ARM , Mark Salter , Aurelien Jacquiot , linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Linux-sh list Subject: Re: [PATCH v2 0/5] Fix ELF / FDPIC ELF core dumping, and use mmap_sem properly in there Message-ID: <20200430145123.GE21576@brightrain.aerifal.cx> References: <20200429214954.44866-1-jannh@google.com> <20200429215620.GM1551@shell.armlinux.org.uk> <31196268-2ff4-7a1d-e9df-6116e92d2190@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31196268-2ff4-7a1d-e9df-6116e92d2190@linux-m68k.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 01, 2020 at 12:10:05AM +1000, Greg Ungerer wrote: > > > On 30/4/20 9:03 am, Linus Torvalds wrote: > >On Wed, Apr 29, 2020 at 2:57 PM Russell King - ARM Linux admin > > wrote: > >> > >>I've never had any reason to use FDPIC, and I don't have any binaries > >>that would use it. Nicolas Pitre added ARM support, so I guess he > >>would be the one to talk to about it. (Added Nicolas.) > > > >While we're at it, is there anybody who knows binfmt_flat? > > > >It might be Nicolas too. > > > >binfmt_flat doesn't do core-dumping, but it has some other oddities. > >In particular, I'd like to bring sanity to the installation of the new > >creds, and all the _normal_ binfmt cases do it largely close together > >with setup_new_exec(). > > > >binfmt_flat is doing odd things. It's doing this: > > > > /* Flush all traces of the currently running executable */ > > if (id == 0) { > > ret = flush_old_exec(bprm); > > if (ret) > > goto err; > > > > /* OK, This is the point of no return */ > > set_personality(PER_LINUX_32BIT); > > setup_new_exec(bprm); > > } > > > >in load_flat_file() - which is also used to loading _libraries_. Where > >it makes no sense at all. > > I haven't looked at the shared lib support in there for a long time, > but I thought that "id" is only 0 for the actual final program. > Libraries have a slot or id number associated with them. This sounds correct. My understanding of FLAT shared library support is that it's really bad and based on having preassigned slot indices for each library on the system, and a global array per-process to give to data base address for each library. Libraries are compiled to know their own slot numbers so that they just load from fixed_reg[slot_id] to get what's effectively their GOT pointer. I'm not sure if anybody has actually used this in over a decade. Last time I looked the tooling appeared broken, but in this domain lots of users have forked private tooling that's not publicly available or at least not publicly indexed, so it's hard to say for sure. Rich