Imagine situation where a security problem is found in setuid binary.

User upgrades his system to fix the problem, but if he has any ZFS snapshots
for the file system which contains problematic binary, any user can mount the
snapshot and execute vulnerable binary.

Prevent this from happening by always mounting snapshots with setuid turned off.

MFC after:	2 weeks
This commit is contained in:
Pawel Jakub Dawidek 2011-05-31 07:02:49 +00:00
parent 7c017a713e
commit 12b9f8e47d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222518

View File

@ -171,6 +171,11 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
* Snapshots are always read-only.
*/
mp->mnt_flag |= MNT_RDONLY;
/*
* We don't want snapshots to allow access to vulnerable setuid
* programs, so we turn off setuid when mounting snapshots.
*/
mp->mnt_flag |= MNT_NOSUID;
/*
* We don't want snapshots to be visible in regular
* mount(8) and df(1) output.