diff options
author | Serge Hallyn <serue@us.ibm.com> | 2008-10-30 12:52:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-01 12:49:45 -0400 |
commit | 3318a386e4ca68c76e0294363d29bdc46fcad670 (patch) | |
tree | da0da58f10bcb7dd7a885f6032b46d1025af208b | |
parent | e06f42d6c127883e58b747048752f44ae208ae47 (diff) |
file caps: always start with clear bprm->caps_*
While Linux doesn't honor setuid on scripts. However, it mistakenly
behaves differently for file capabilities.
This patch fixes that behavior by making sure that get_file_caps()
begins with empty bprm->caps_*. That way when a script is loaded,
its bprm->caps_* may be filled when binfmt_misc calls prepare_binprm(),
but they will be cleared again when binfmt_elf calls prepare_binprm()
next to read the interpreter's file capabilities.
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Andrew G. Morgan <morgan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | security/commoncap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 399bfdb9e2da..3976613db829 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -279,10 +279,10 @@ static int get_file_caps(struct linux_binprm *bprm) | |||
279 | struct vfs_cap_data vcaps; | 279 | struct vfs_cap_data vcaps; |
280 | struct inode *inode; | 280 | struct inode *inode; |
281 | 281 | ||
282 | if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) { | 282 | bprm_clear_caps(bprm); |
283 | bprm_clear_caps(bprm); | 283 | |
284 | if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) | ||
284 | return 0; | 285 | return 0; |
285 | } | ||
286 | 286 | ||
287 | dentry = dget(bprm->file->f_dentry); | 287 | dentry = dget(bprm->file->f_dentry); |
288 | inode = dentry->d_inode; | 288 | inode = dentry->d_inode; |