aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_prop.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2024-10-02 09:12:02 -0700
committerGitHub <[email protected]>2024-10-02 09:12:02 -0700
commitd34d4f97a81f6895de3da67ffbad6f986b2cdae6 (patch)
tree90fcbe619bfb7a0b735c1b25ec455f21b67711c9 /module/zfs/dsl_prop.c
parent86737c5927c204dc866f1de7c95ab964e98be6af (diff)
snapdir: add 'disabled' value to make .zfs inaccessible
In some environments, just making the .zfs control dir hidden from sight might not be enough. In particular, the following scenarios might warrant not allowing access at all: - old snapshots with wrong permissions/ownership - old snapshots with exploitable setuid/setgid binaries - old snapshots with sensitive contents Introducing a new 'disabled' value that not only hides the control dir, but prevents access to its contents by returning ENOENT solves all of the above. The new property value takes advantage of 'iuv' semantics ("ignore unknown value") to automatically fall back to the old default value when a pool is accessed by an older version of ZFS that doesn't yet know about 'disabled' semantics. I think that technically the zfs_dirlook change is enough to prevent access, but preventing lookups and dir entries in an already opened .zfs handle might also be a good idea to prevent races when modifying the property at runtime. Add zfs_snapshot_no_setuid parameter to control whether automatically mounted snapshots have the setuid mount option set or not. this could be considered a partial fix for one of the scenarios mentioned in desired. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Fabian Grünbichler <[email protected]> Co-authored-by: Fabian Grünbichler <[email protected]> Closes #3963 Closes #16587
Diffstat (limited to 'module/zfs/dsl_prop.c')
-rw-r--r--module/zfs/dsl_prop.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c
index 3b8683593..1a0e83419 100644
--- a/module/zfs/dsl_prop.c
+++ b/module/zfs/dsl_prop.c
@@ -698,6 +698,10 @@ dsl_prop_set_iuv(objset_t *mos, uint64_t zapobj, const char *propname,
*(uint64_t *)value == ZFS_REDUNDANT_METADATA_NONE)
iuv = B_TRUE;
break;
+ case ZFS_PROP_SNAPDIR:
+ if (*(uint64_t *)value == ZFS_SNAPDIR_DISABLED)
+ iuv = B_TRUE;
+ break;
default:
break;
}