Commit 46434eee authored by Seth Forshee's avatar Seth Forshee

fs: Allow CAP_FOWNER in s_user_ns to create hard links

Privileged users in the namespace which controls a super block
should not be prevented from creating hard links. Expand the
check in may_linkat() to allow CAP_FOWNER in s_user_ns to set
any hardlink.
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
parent c9f892ab
...@@ -974,7 +974,7 @@ static int may_linkat(struct path *link) ...@@ -974,7 +974,7 @@ static int may_linkat(struct path *link)
* otherwise, it must be a safe source. * otherwise, it must be a safe source.
*/ */
if (uid_eq(cred->fsuid, inode->i_uid) || safe_hardlink_source(inode) || if (uid_eq(cred->fsuid, inode->i_uid) || safe_hardlink_source(inode) ||
capable(CAP_FOWNER)) ns_capable(inode->i_sb->s_user_ns, CAP_FOWNER))
return 0; return 0;
audit_log_link_denied("linkat", link); audit_log_link_denied("linkat", link);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment