FreeBSD Bugzilla – Attachment 247381 Details for
Bug 276045
copy_file_range(2) can truncate the output file when it should not do so
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix handling of truncation in vn_generic_copy_file_range()
copytrunc2.patch (text/plain), 1.00 KB, created by
Rick Macklem
on 2023-12-31 23:38:12 UTC
(
hide
)
Description:
Fix handling of truncation in vn_generic_copy_file_range()
Filename:
MIME Type:
Creator:
Rick Macklem
Created:
2023-12-31 23:38:12 UTC
Size:
1.00 KB
patch
obsolete
>--- sys/kern/vfs_vnops.c.copy 2023-12-30 15:27:34.014432000 -0800 >+++ sys/kern/vfs_vnops.c 2023-12-31 13:39:46.386543000 -0800 >@@ -3296,8 +3296,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * > goto out; > if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0) > holein = 0; >- if (holein > 0) >- error = vn_getsize_locked(invp, &insize, incred); >+ error = vn_getsize_locked(invp, &insize, incred); > VOP_UNLOCK(invp); > if (error != 0) > goto out; >@@ -3333,7 +3332,11 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * > */ > if (error == 0) > error = vn_getsize_locked(outvp, &outsize, outcred); >- if (error == 0 && outsize > *outoffp && outsize <= *outoffp + len) { >+ if (error == 0 && outsize > *outoffp && >+ *outoffp <= OFF_MAX - len && outsize <= *outoffp + len && >+ *inoffp < insize && >+ *outoffp <= OFF_MAX - (insize - *inoffp) && >+ outsize <= *outoffp + (insize - *inoffp)) { > #ifdef MAC > error = mac_vnode_check_write(curthread->td_ucred, > outcred, outvp);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276045
: 247381 |
247804
|
247805