Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 2009 09:55:26 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 164251 for review
Message-ID:  <200906130955.n5D9tQcj089890@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906130955.n5D9tQcj089890>