From owner-p4-projects@FreeBSD.ORG Sat Jun 13 09:55:27 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 60EB31065673; Sat, 13 Jun 2009 09:55:27 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 204F31065670 for ; Sat, 13 Jun 2009 09:55:27 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0CDC98FC13 for ; Sat, 13 Jun 2009 09:55:27 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5D9tQtT089892 for ; Sat, 13 Jun 2009 09:55:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5D9tQcj089890 for perforce@freebsd.org; Sat, 13 Jun 2009 09:55:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sat, 13 Jun 2009 09:55:26 GMT Message-Id: <200906130955.n5D9tQcj089890@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 164251 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2009 09:55:28 -0000 http://perforce.freebsd.org/chv.cgi?CH=164251 Change 164251 by rwatson@rwatson_freebsd_capabilities on 2009/06/13 09:55:15 Rather than encode a requirement that shared object file descriptors be at offset 0, pread() at offset 0 to get the ELF header. The remainder of rtld-elf makes no use of file offsets, since it uses mmap to load actual ELF sections. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/map_object.c#5 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/map_object.c#5 (text+ko) ==== @@ -44,7 +44,8 @@ /* * Map a shared object into memory. The "fd" argument is a file descriptor, - * which must be open on the object and positioned at its beginning. + * which must be open on the object. + * * The "path" argument is a pathname that is used only for error messages. * * The return value is a pointer to a newly-allocated Obj_Entry structure @@ -270,7 +271,7 @@ } u; ssize_t nbytes; - if ((nbytes = read(fd, u.buf, PAGE_SIZE)) == -1) { + if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) { _rtld_error("%s: read error: %s", path, strerror(errno)); return NULL; }