Author: rwatson
Date: Mon Dec 14 12:19:21 2009
New Revision: 200509
URL: http://svn.freebsd.org/changeset/base/200509

Log:
  Merge r197808 from head to stable/8:
  
    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:
  stable/8/libexec/rtld-elf/map_object.c
Directory Properties:
  stable/8/libexec/rtld-elf/   (props changed)

Modified: stable/8/libexec/rtld-elf/map_object.c
==============================================================================
--- stable/8/libexec/rtld-elf/map_object.c      Mon Dec 14 11:53:02 2009        
(r200508)
+++ stable/8/libexec/rtld-elf/map_object.c      Mon Dec 14 12:19:21 2009        
(r200509)
@@ -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;
     }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to