From owner-svn-src-all@FreeBSD.ORG Sun Jan 25 12:07:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DC8710656E9; Sun, 25 Jan 2009 12:07:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59C0B8FC31; Sun, 25 Jan 2009 12:07:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0PC7hVh017338; Sun, 25 Jan 2009 12:07:43 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PC7hf1017337; Sun, 25 Jan 2009 12:07:43 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901251207.n0PC7hf1017337@svn.freebsd.org> From: Robert Watson Date: Sun, 25 Jan 2009 12:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187686 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 12:07:45 -0000 Author: rwatson Date: Sun Jan 25 12:07:43 2009 New Revision: 187686 URL: http://svn.freebsd.org/changeset/base/187686 Log: When a statically linked binary is executed (or at least, one without an interpreter definition in its program header), set the auxiliary ELF argument AT_BASE to 0 rather than to the address that we would have mapped the interpreter at if there had been one. The ELF ABI specifications appear to be ambiguous as to the desired behavior in this situation, as they define AT_BASE as the base address of the interpreter, but do not mention what to do if there is none. On Solaris, AT_BASE will be set to the base address of the static binary if there is no interpreter, and on Linux, AT_BASE is set to 0. We go with the Linux semantics as they are of more immediate utility and allow the early runtime environment to know that the kernel has not mapped an interpreter, but because AT_PHDR points at the ELF header for the running binary, it is still possible to retrieve all required mapping information when the process starts should it be required. Either approach would be preferable to our current behavior of passing a pointer to an unmapped region of user memory as AT_BASE. MFC after: 3 weeks Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sun Jan 25 10:31:45 2009 (r187685) +++ head/sys/kern/imgact_elf.c Sun Jan 25 12:07:43 2009 (r187686) @@ -822,7 +822,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i uprintf("ELF interpreter %s not found\n", interp); return (error); } - } + } else + addr = 0; /* * Construct auxargs table (used by the fixup routine)