summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2/imgact_coff.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-10-13 08:24:45 +0000
committerdg <dg@FreeBSD.org>1998-10-13 08:24:45 +0000
commit3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d (patch)
tree64822d97637c55a2d7aeb4a999c847a5869bac46 /sys/i386/ibcs2/imgact_coff.c
parent3280e5edc1739224a3e662ea57aa1746d1eb9105 (diff)
downloadFreeBSD-src-3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d.zip
FreeBSD-src-3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d.tar.gz
Fixed two potentially serious classes of bugs:
1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however.
Diffstat (limited to 'sys/i386/ibcs2/imgact_coff.c')
-rw-r--r--sys/i386/ibcs2/imgact_coff.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index 9308e9d..23c1344 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: imgact_coff.c,v 1.30 1998/02/11 01:46:47 eivind Exp $
+ * $Id: imgact_coff.c,v 1.31 1998/08/16 01:21:49 bde Exp $
*/
#include <sys/param.h>
@@ -70,7 +70,7 @@ load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset,
size_t copy_len;
map_offset = trunc_page(offset);
- map_addr = trunc_page(vmaddr);
+ map_addr = trunc_page((vm_offset_t)vmaddr);
if (memsz > filsz) {
/*
@@ -116,8 +116,8 @@ load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset,
*/
copy_len = (offset + filsz) - trunc_page(offset + filsz);
- map_addr = trunc_page(vmaddr + filsz);
- map_len = round_page(vmaddr + memsz) - map_addr;
+ map_addr = trunc_page((vm_offset_t)vmaddr + filsz);
+ map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr;
DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx,0x%x, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", __FILE__, __LINE__, map_addr, map_len));
@@ -451,7 +451,7 @@ exec_coff_imgact(imgp)
vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)text_address;
vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t)data_address;
- hole = (caddr_t)trunc_page(vmspace->vm_daddr) + ctob(vmspace->vm_dsize);
+ hole = (caddr_t)trunc_page((vm_offset_t)vmspace->vm_daddr) + ctob(vmspace->vm_dsize);
DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx, PAGE_SIZE, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n",
OpenPOWER on IntegriCloud