diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-10-06 17:14:39 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-10-06 17:14:39 +0000 |
commit | 63d44e1faa04cea5ccac3d79af166dcd61120959 (patch) | |
tree | 26dbb6219a1f0f19b26edc64dc5b0985cc31c4b9 /libexec | |
parent | fd2a94971be3ae7d27b361e6a81e7dea97a15966 (diff) | |
download | FreeBSD-src-63d44e1faa04cea5ccac3d79af166dcd61120959.zip FreeBSD-src-63d44e1faa04cea5ccac3d79af166dcd61120959.tar.gz |
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.
MFC after: 1 month
Sponsored by: Google
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/map_object.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 6de0c9e..d231830 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -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; } |