On Mon, Jul 31, 2017 at 01:42:13PM -0400, Colin Walters wrote: > > > On Mon, Jul 31, 2017, at 12:32 PM, Colin Walters wrote: > > On Mon, Jul 31, 2017, at 12:29 PM, Dan Williams wrote: > > > > > > How is S_CONTENTS_IMMUTABLE different than S_IMMUTABLE? > > > > We still want the ability to make hardlinks. > > Also of course, symmetrically, to unlink. If we used S_IMMUTABLE for /etc/sudoers, > it'd still be racy since one would have to transiently remove the flag in order > to replace it with a new version. > > Related to this topic is the fact that S_IMMUTABLE is itself mutable; I > think once S_IMMUTABLE_CONTENTS is set, it would not be able to made > mutable again. > > Also I just remembered that since then memfd_create() and more notably > fcntl(F_ADD_SEALS) landed - in fact it already has flags for what we want > here AFAICS. Your S_IOMAP_IMMUTABLE is fcntl(F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW) I don't think F_SEAL_{SHRINK,GROW} prevents reflinking or CoW of file data, which are two things that cannot happen under S_IOMAP_IMMUTABLE that aren't size changes. From the implementation it looks like shrink and grow are only supposed to disallow changes to i_size, not i_blocks (or the file block map). Then again, I suppose F_SEAL_* only work on shmem, so maybe it simply isn't defined for any other filesystem...? e.g. it doesn't prohibit reflink, but the only fs implementing seals doesn't support reflink. <shrug> Seals cannot be removed, which is too strict for the S_IOMAP_IMMUTABLE user cases being presented. > and mine just adds in F_SEAL_WRITE. I think there was some discussion > of the seals for persistent files when memfd_create() landed, but I can't > find it offhand. --D > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html