diff options
author | tjr <tjr@FreeBSD.org> | 2004-06-05 02:00:12 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2004-06-05 02:00:12 +0000 |
commit | 445b7fecaa7b9b3cef0f344d22aa7304b6c70f91 (patch) | |
tree | 9d782826773deb4a2c226f21fe82c14feea1e0b2 /sys/kern/imgact_elf.c | |
parent | 3cf722bc8127aefb24815e39202bd64bad49ebf5 (diff) | |
download | FreeBSD-src-445b7fecaa7b9b3cef0f344d22aa7304b6c70f91.zip FreeBSD-src-445b7fecaa7b9b3cef0f344d22aa7304b6c70f91.tar.gz |
Back out workaround for vn_rdwr_inchunks()'s INT_MAX length limitation
after discussions with bde; vn_rdwr_inchunks() itself should be fixed.
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r-- | sys/kern/imgact_elf.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 799fff1..e0b27c0 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <sys/imgact.h> #include <sys/imgact_elf.h> #include <sys/kernel.h> -#include <sys/limits.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> @@ -962,35 +961,23 @@ __elfN(coredump)(td, vp, limit) /* Write the contents of all of the writable segments. */ if (error == 0) { Elf_Phdr *php; - off_t chunksize, offset, segofs; + off_t offset; int i; php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1; offset = hdrsize; for (i = 0; i < seginfo.count; i++) { - /* - * Write the segment in maximally-sized chunks that - * neither exceed vn_rdwr_inchunks()'s INT_MAX - * length limitation nor span a block boundary. - */ - segofs = 0; - while (segofs < php->p_filesz) { - chunksize = MIN(php->p_filesz - segofs, - INT_MAX - MAXBSIZE + 1); - error = vn_rdwr_inchunks(UIO_WRITE, vp, - (caddr_t)(uintptr_t)php->p_vaddr + segofs, - chunksize, offset + segofs, UIO_USERSPACE, - IO_UNIT | IO_DIRECT, cred, NOCRED, - (int *)NULL, curthread); /* XXXKSE */ - if (error != 0) - goto done; - segofs += chunksize; - } + error = vn_rdwr_inchunks(UIO_WRITE, vp, + (caddr_t)(uintptr_t)php->p_vaddr, + php->p_filesz, offset, UIO_USERSPACE, + IO_UNIT | IO_DIRECT, cred, NOCRED, (int *)NULL, + curthread); /* XXXKSE */ + if (error != 0) + break; offset += php->p_filesz; php++; } } -done: free(hdr, M_TEMP); return (error); |