DF-3026 / fix.diff
--- a/sys/vfs/tmpfs/tmpfs_vnops.c +++ b/sys/vfs/tmpfs/tmpfs_vnops.c @@ -686,7 +686,20 @@ return error; } - node = VP_TO_TMPFS_NODE(vp); + node = VP_TO_TMPFS_NODE(vp);; + + /* + * DF-3026: re-check system flags on every write like UFS does + * (ufs_readwrite.c): a writable descriptor opened before the + * administrator set SF_APPEND/SF_IMMUTABLE must not keep writing. + */ + if (node->tn_flags & APPEND) { + if ((ioflag & IO_APPEND) == 0 && + uio->uio_offset != node->tn_size) + return (EPERM); + } + if (node->tn_flags & IMMUTABLE) + return (EPERM); if (vp->v_type != VREG) return (EINVAL); |