Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76a67ec6 authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd: nfsd should drop CAP_MKNOD for non-root



Since creating a device node is normally an operation requiring special
privilege, Igor Zhbanov points out that it is surprising (to say the
least) that a client can, for example, create a device node on a
filesystem exported with root_squash.

So, make sure CAP_MKNOD is among the capabilities dropped when an nfsd
thread handles a request from a non-root user.

Reported-by: default avatarIgor Zhbanov <izh1979@gmail.com>
Cc: stable@kernel.org
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 84f09f46
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -393,7 +393,9 @@ struct cpu_vfs_cap_data {
# define CAP_FULL_SET     ((kernel_cap_t){{ ~0, ~0 }})
# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }})
# define CAP_FS_SET       ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } })
# define CAP_NFSD_SET     ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
# define CAP_NFSD_SET     ((kernel_cap_t){{ CAP_FS_MASK_B0 \
					    | CAP_TO_MASK(CAP_SYS_RESOURCE) \
					    | CAP_TO_MASK(CAP_MKNOD), \
					    CAP_FS_MASK_B1 } })

#endif /* _KERNEL_CAPABILITY_U32S != 2 */