From owner-svn-src-all@FreeBSD.ORG Mon Mar 12 10:36:04 2012 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 5D239106566B; Mon, 12 Mar 2012 10:36:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CBBB8FC0A; Mon, 12 Mar 2012 10:36:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2CAa4VX057921; Mon, 12 Mar 2012 10:36:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2CAa4GU057919; Mon, 12 Mar 2012 10:36:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203121036.q2CAa4GU057919@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 12 Mar 2012 10:36:04 +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: r232856 - head/libexec/rtld-elf 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: Mon, 12 Mar 2012 10:36:04 -0000 Author: kib Date: Mon Mar 12 10:36:03 2012 New Revision: 232856 URL: http://svn.freebsd.org/changeset/base/232856 Log: When iterating over the dso program headers, the object is not initialized yet, and object segments are not yet mapped. Only parse the notes that appear in the first page of the dso (as it should be anyway), and use the preloaded page content. Reported and tested by: stass MFC after: 20 days Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Mon Mar 12 08:13:04 2012 (r232855) +++ head/libexec/rtld-elf/map_object.c Mon Mar 12 10:36:03 2012 (r232856) @@ -149,7 +149,10 @@ map_object(int fd, const char *path, con break; case PT_NOTE: - note_start = (Elf_Addr)obj->relocbase + phdr->p_offset; + if (phdr->p_offset > PAGE_SIZE || + phdr->p_offset + phdr->p_filesz > PAGE_SIZE) + break; + note_start = (Elf_Addr)(char *)hdr + phdr->p_offset; note_end = note_start + phdr->p_filesz; digest_notes(obj, note_start, note_end); break;