svn commit: r197880 - projects/capabilities8/libexec/rtld-elf

Robert Watson rwatson at FreeBSD.org
Thu Oct 8 21:53:58 UTC 2009


Author: rwatson
Date: Thu Oct  8 21:53:58 2009
New Revision: 197880
URL: http://svn.freebsd.org/changeset/base/197880

Log:
  Manually merge r197808 from head to capabilities8:
  
    In rtld's map_object(), use pread(..., 0) rather than read() to read the
    ELF header from the front of the file.  As all other I/O on the binary
    is done using mmap(), this avoids the need for seek privileges on the
    file descriptor during run-time linking.
  
    Sponsored by:   Google

Modified:
  projects/capabilities8/libexec/rtld-elf/map_object.c

Modified: projects/capabilities8/libexec/rtld-elf/map_object.c
==============================================================================
--- projects/capabilities8/libexec/rtld-elf/map_object.c	Thu Oct  8 21:52:13 2009	(r197879)
+++ projects/capabilities8/libexec/rtld-elf/map_object.c	Thu Oct  8 21:53:58 2009	(r197880)
@@ -273,7 +273,7 @@ get_elf_header (int fd, const char *path
     } 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;
     }


More information about the svn-src-projects mailing list