From owner-cvs-ports@FreeBSD.ORG Sat Nov 7 00:03:14 2009 Return-Path: Delivered-To: cvs-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8726106566C; Sat, 7 Nov 2009 00:03:13 +0000 (UTC) (envelope-from iant@google.com) Received: from smtp-out.google.com (smtp-out.google.com [216.239.33.17]) by mx1.freebsd.org (Postfix) with ESMTP id 746CF8FC08; Sat, 7 Nov 2009 00:03:12 +0000 (UTC) Received: from zps19.corp.google.com (zps19.corp.google.com [172.25.146.19]) by smtp-out.google.com with ESMTP id nA6Nqj2S023737; Fri, 6 Nov 2009 23:52:46 GMT DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1257551567; bh=QJZRfV+Fu5jlCyvtAyQEEhVxX3c=; h=To:Cc:Subject:References:From:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=XRcBtPUX1nuSzUfXtB/CIr5yAr1+9bOjwBTk9rLfYoHzliiZWaDnl3KYvIzal0IuN IpkH3CEsfArPzX+QmoStg== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=to:cc:subject:references:from:date:in-reply-to:message-id: user-agent:mime-version:content-type:x-system-of-record; b=E4WNW0IW8DWT2uI6Xe7QcOdIAk/1aw67Fr83SvFb8M/rZ7gqlKU4zLIcBya6EuQLa 0UTb21IVcqchB0khlu4Eg== Received: from gxk27 (gxk27.prod.google.com [10.202.11.27]) by zps19.corp.google.com with ESMTP id nA6Nqf2B030724; Fri, 6 Nov 2009 15:52:42 -0800 Received: by gxk27 with SMTP id 27so188869gxk.7 for ; Fri, 06 Nov 2009 15:52:41 -0800 (PST) Received: by 10.101.158.16 with SMTP id k16mr1235868ano.47.1257551560365; Fri, 06 Nov 2009 15:52:40 -0800 (PST) Received: from coign.google.com (dhcp-172-22-124-228.mtv.corp.google.com [172.22.124.228]) by mx.google.com with ESMTPS id 34sm235928yxf.47.2009.11.06.15.52.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 06 Nov 2009 15:52:39 -0800 (PST) To: Juergen Lock References: <200909211911.n8LJBlUK002650@repoman.freebsd.org> <20091103213538.GA61624@triton8.kn-bremen.de> From: Ian Lance Taylor Date: Fri, 06 Nov 2009 15:52:37 -0800 In-Reply-To: <20091103213538.GA61624@triton8.kn-bremen.de> (Juergen Lock's message of "Tue\, 3 Nov 2009 22\:35\:38 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true Cc: Dirk Meyer , cvs-ports@freebsd.org, sprewell@jaggeri.com, cvs-all@freebsd.org, ports-committers@freebsd.org Subject: Re: cvs commit: ports/devel/gold Makefile X-BeenThere: cvs-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2009 00:03:14 -0000 Juergen Lock writes: > Is this about `exec format error' (ENOEXEC)? We discussed this > yesterday on irc (hi Sprewell! :) and found out that gold can produce > executables that won't run on FreeBSD 7 and 8 too (for him it was > chromium and some test executables on 7.2/i386, for me it was test > executables on 8/amd64, I couldnt reproduce it here on 8 and 7 i386) - > and after some debugging using qemu's gdbstub and a FreeBSD 8/amd64 > livefs guest that I scp'd a problem executable into I found out that > its this condition in sys/kern/imgact_elf.c that fails: > http://fxr.watson.org/fxr/source/kern/imgact_elf.c#L721 > > 719 if (phdr[i].p_type == PT_INTERP) { > 720 /* Path to interpreter */ > 721 if (phdr[i].p_filesz > MAXPATHLEN || > 722 phdr[i].p_offset + phdr[i].p_filesz > PAGE_SIZE) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 723 return (ENOEXEC); > 724 interp = imgp->image_header + phdr[i].p_offset; > 725 break; > 726 } > 727 } > > (gdb) p/x phdr[1].p_offset > $11 = 0x1174 > (gdb) p/x phdr[1].p_filesz > $12 = 0x15 > (gdb) > > So it seems our kernel expects this data (path of the `image activator' > aka shared linker aka /libexec/ld-elf.so.1) to be in the first page of > the executable... Technically an ELF executable is permitted to have the PT_INTERP segment anywhere it likes, so I think the kernel is in error here. However, it is good practice to put PT_INTERP in the first page of the executable, and I have made that change to gold. So this issue should be fixed in the next release of the GNU binutils. Ian