diff options
author | David Greenman <dg@FreeBSD.org> | 1998-10-13 08:24:45 +0000 |
---|---|---|
committer | David Greenman <dg@FreeBSD.org> | 1998-10-13 08:24:45 +0000 |
commit | 6cde7a165f154ed47b58fc42d6d2041e18384680 (patch) | |
tree | 75c32899ed392bb9123cc155f65d0a0b121f6f46 /sys/kern/vfs_export.c | |
parent | d74a7fd03e9f6e094bd0d88f544cff2d7052755a (diff) | |
download | src-6cde7a165f154ed47b58fc42d6d2041e18384680.tar.gz src-6cde7a165f154ed47b58fc42d6d2041e18384680.zip |
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.
Notes
Notes:
svn path=/head/; revision=40286
Diffstat (limited to 'sys/kern/vfs_export.c')
-rw-r--r-- | sys/kern/vfs_export.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 40fc3151ce72..a5258d8f2d06 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.163 1998/09/14 19:56:40 sos Exp $ + * $Id: vfs_subr.c,v 1.164 1998/10/12 20:14:09 dt Exp $ */ /* @@ -2539,15 +2539,14 @@ retry: if (vp->v_type == VREG) { if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) goto retn; - object = vnode_pager_alloc(vp, - OFF_TO_IDX(round_page(vat.va_size)), 0, 0); + object = vnode_pager_alloc(vp, vat.va_size, 0, 0); } else if (major(vp->v_rdev) < nblkdev) { /* * This simply allocates the biggest object possible * for a VBLK vnode. This should be fixed, but doesn't * cause any problems (yet). */ - object = vnode_pager_alloc(vp, INT_MAX, 0, 0); + object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); } object->ref_count--; vp->v_usecount--; |