Linux: reject read/write mapping to immutable file only on VM_SHARED
Private read/write mapping can't be used to modify the mapped files, so they will remain be immutable. Private read/write mappings are usually used to load the data segment of executable files, rejecting them will rendering immutable executable files to stop working. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: WHR <msl0000023508@gmail.com> Closes #15344
This commit is contained in:
parent
76663fe372
commit
f2fe4d51a8
|
@ -4071,8 +4071,8 @@ zfs_map(struct inode *ip, offset_t off, caddr_t *addrp, size_t len,
|
|||
if ((error = zfs_enter_verify_zp(zfsvfs, zp, FTAG)) != 0)
|
||||
return (error);
|
||||
|
||||
if ((vm_flags & VM_WRITE) && (zp->z_pflags &
|
||||
(ZFS_IMMUTABLE | ZFS_READONLY | ZFS_APPENDONLY))) {
|
||||
if ((vm_flags & VM_WRITE) && (vm_flags & VM_SHARED) &&
|
||||
(zp->z_pflags & (ZFS_IMMUTABLE | ZFS_READONLY | ZFS_APPENDONLY))) {
|
||||
zfs_exit(zfsvfs, FTAG);
|
||||
return (SET_ERROR(EPERM));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue