| To: | Al Viro <viro@xxxxxxxxxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH 1/5] fs: Fix S_NOSEC handling |
| From: | Jan Kara <jack@xxxxxxx> |
| Date: | Thu, 18 Dec 2014 13:49:02 +0100 |
| Cc: | linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, Jan Kara <jack@xxxxxxx>, stable@xxxxxxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1418906946-30695-1-git-send-email-jack@xxxxxxx> |
| References: | <1418906946-30695-1-git-send-email-jack@xxxxxxx> |
file_remove_suid() could mistakenly set S_NOSEC inode bit when root was
modifying the file. As a result following writes to the file by ordinary
user would avoid clearing suid or sgid bits.
Fix the bug by checking actual mode bits before setting S_NOSEC.
CC: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
fs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..f5e01704a5c8 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1631,7 +1631,8 @@ int file_remove_suid(struct file *file)
error = security_inode_killpriv(dentry);
if (!error && killsuid)
error = __remove_suid(dentry, killsuid);
- if (!error && (inode->i_sb->s_flags & MS_NOSEC))
+ if (!error && (inode->i_sb->s_flags & MS_NOSEC) &&
+ !is_sxid(inode->i_mode))
inode->i_flags |= S_NOSEC;
return error;
--
1.8.4.5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 2/5] fs: Rename file_remove_suid() to file_remove_privs(), Jan Kara |
|---|---|
| Next by Date: | [PATCH 3/5] fs: Provide function telling whether file_remove_privs() will do anything, Jan Kara |
| Previous by Thread: | [PATCH 2/5] fs: Rename file_remove_suid() to file_remove_privs(), Jan Kara |
| Next by Thread: | [PATCH 3/5] fs: Provide function telling whether file_remove_privs() will do anything, Jan Kara |
| Indexes: | [Date] [Thread] [Top] [All Lists] |