From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH 0/8] ELF unexec (bug#20614) Date: Mon, 02 Nov 2015 05:40:43 +0200 Message-ID: <83611lxe4k.fsf@gnu.org> References: <20151102015334.GO13961@bubble.grove.modra.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446435660 20775 80.91.229.3 (2 Nov 2015 03:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2015 03:41:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Modra Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 02 04:40:53 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zt5zI-0006jr-71 for ged-emacs-devel@m.gmane.org; Mon, 02 Nov 2015 04:40:52 +0100 Original-Received: from localhost ([::1]:39894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zt5zH-00081Z-IL for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2015 22:40:51 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zt5z5-00081U-Mg for emacs-devel@gnu.org; Sun, 01 Nov 2015 22:40:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zt5z0-0002wR-Kb for emacs-devel@gnu.org; Sun, 01 Nov 2015 22:40:39 -0500 Original-Received: from mtaout29.012.net.il ([80.179.55.185]:45102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zt5z0-0002vR-5x for emacs-devel@gnu.org; Sun, 01 Nov 2015 22:40:34 -0500 Original-Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0NX600E004OLTM00@mtaout29.012.net.il> for emacs-devel@gnu.org; Mon, 02 Nov 2015 05:39:53 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NX600A4O4UGPT40@mtaout29.012.net.il>; Mon, 02 Nov 2015 05:39:53 +0200 (IST) In-reply-to: <20151102015334.GO13961@bubble.grove.modra.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.185 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:193100 Archived-At: > Date: Mon, 2 Nov 2015 12:23:34 +1030 > From: Alan Modra > > This series of patches addresses bug #20614 by rewriting the bss > handling code rather than adding yet more hacks. Thanks. It would be best to send these to the bug tracker, 20614@debbugs.gnu.org, so that this is recorded with the bug. > Finding bss sections > by name as we do currently results in complicated code that > - does not account for all names of possible bss sections, > - assumes specific ordering of bss sections, > - can wrongly choose a SHT_NOBITS section not in the bss segment, > - incorrectly calculates bss size (no accounting for alignment gaps), > - assumes .data and .bss are in the same segment. > > All of these problems and more are solved by finding the bss segment > in PT_LOAD headers, ie. the address range included in p_memsz but not > p_filesz of the last PT_LOAD header, then matching SHT_NOBITS sections > in that address range. > > I've split the patch into a series as there are multiple problems of > varying severity in this code, and it might be a little easier to > review this way. The series was tested indiviually on x86_64-linux > and on powerpc64-linux and powerpc64le-linux after fixing bug #20614 > with patch 7/8. > > Patch 8/8 goes further and removes the added .data2 section. I don't > see any need for a new SHT_PROGBITS section to cover the old bss > section(s) plus dumped data. Not adding a section means there is no > need to patch symbol st_shndx or section sh_info and sh_link fields, > which is fragile code. At least, sh_info shouldn't really be patched > unless SHF_INFO_LINK is set in sh_flags, but not all linkers set the > flag properly. I'll let ELF experts review this, but in any case, we will need your legal paperwork before we can accept such a substantial contribution. Let me know if you want me to send you the copyright assignment form. Thanks!