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_pager.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_pager.c')
-rw-r--r-- | sys/vm/vm_pager.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 2dc6e7b..21267e0 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pager.c,v 1.36 1998/03/07 21:37:21 dyson Exp $ + * $Id: vm_pager.c,v 1.37 1998/03/16 01:56:01 dyson Exp $ */ /* @@ -91,7 +91,7 @@ extern struct pagerops vnodepagerops; extern struct pagerops devicepagerops; static int dead_pager_getpages __P((vm_object_t, vm_page_t *, int, int)); -static vm_object_t dead_pager_alloc __P((void *, vm_size_t, vm_prot_t, +static vm_object_t dead_pager_alloc __P((void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t)); static int dead_pager_putpages __P((vm_object_t, vm_page_t *, int, int, int *)); static boolean_t dead_pager_haspage __P((vm_object_t, vm_pindex_t, int *, int *)); @@ -110,7 +110,7 @@ dead_pager_getpages(obj, ma, count, req) vm_object_t dead_pager_alloc(handle, size, prot, off) void *handle; - vm_size_t size; + vm_ooffset_t size; vm_prot_t prot; vm_ooffset_t off; { @@ -227,7 +227,7 @@ vm_pager_bufferinit() * need to perform page-level validation (e.g. the device pager). */ vm_object_t -vm_pager_allocate(objtype_t type, void *handle, vm_size_t size, vm_prot_t prot, +vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off) { struct pagerops *ops; |