Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Serge Hallyn and committed by
Linus Torvalds
3318a386 e06f42d6

+3 -3
+3 -3
security/commoncap.c
··· 279 279 struct vfs_cap_data vcaps; 280 280 struct inode *inode; 281 281 282 - if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) { 283 - bprm_clear_caps(bprm); 282 + bprm_clear_caps(bprm); 283 + 284 + if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) 284 285 return 0; 285 - } 286 286 287 287 dentry = dget(bprm->file->f_dentry); 288 288 inode = dentry->d_inode;