diff options
author | dg <dg@FreeBSD.org> | 1998-10-13 08:24:45 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1998-10-13 08:24:45 +0000 |
commit | 3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d (patch) | |
tree | 64822d97637c55a2d7aeb4a999c847a5869bac46 /sys/vm/vm_glue.c | |
parent | 3280e5edc1739224a3e662ea57aa1746d1eb9105 (diff) | |
download | FreeBSD-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/vm/vm_glue.c')
-rw-r--r-- | sys/vm/vm_glue.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 329f188..e73862d 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -59,7 +59,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_glue.c,v 1.75 1998/03/04 10:27:00 dufault Exp $ + * $Id: vm_glue.c,v 1.76 1998/09/29 17:33:59 abial Exp $ */ #include "opt_rlimit.h" @@ -125,8 +125,8 @@ kernacc(addr, len, rw) vm_offset_t saddr, eaddr; vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; - saddr = trunc_page(addr); - eaddr = round_page(addr + len); + saddr = trunc_page((vm_offset_t)addr); + eaddr = round_page((vm_offset_t)addr + len); vm_map_lock_read(kernel_map); rv = vm_map_check_protection(kernel_map, saddr, eaddr, prot); vm_map_unlock_read(kernel_map); @@ -164,7 +164,7 @@ useracc(addr, len, rw) */ save_hint = map->hint; rv = vm_map_check_protection(map, - trunc_page(addr), round_page(addr + len), prot); + trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), prot); map->hint = save_hint; vm_map_unlock_read(map); @@ -176,8 +176,8 @@ vslock(addr, len) caddr_t addr; u_int len; { - vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr), - round_page(addr + len), FALSE); + vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), + round_page((vm_offset_t)addr + len), FALSE); } void @@ -189,8 +189,8 @@ vsunlock(addr, len, dirtied) #ifdef lint dirtied++; #endif /* lint */ - vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr), - round_page(addr + len), TRUE); + vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), + round_page((vm_offset_t)addr + len), TRUE); } /* |