SECURITY: Move exec_permission RCU checks into security modules
Right now all RCU walks fall back to reference walk when CONFIG_SECURITY is enabled, even though just the standard capability module is active. This is because security_inode_exec_permission unconditionally fails RCU walks. Move this decision to the low level security module. This requires passing the RCU flags down the security hook. This way at least the capability module and a few easy cases in selinux/smack work with RCU walks with CONFIG_SECURITY=y Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
8d082f8f3f
commit
8c9e80ed27
@@ -686,7 +686,7 @@ static int smack_inode_rename(struct inode *old_inode,
|
||||
*
|
||||
* Returns 0 if access is permitted, -EACCES otherwise
|
||||
*/
|
||||
static int smack_inode_permission(struct inode *inode, int mask)
|
||||
static int smack_inode_permission(struct inode *inode, int mask, unsigned flags)
|
||||
{
|
||||
struct smk_audit_info ad;
|
||||
|
||||
@@ -696,6 +696,10 @@ static int smack_inode_permission(struct inode *inode, int mask)
|
||||
*/
|
||||
if (mask == 0)
|
||||
return 0;
|
||||
|
||||
/* May be droppable after audit */
|
||||
if (flags & IPERM_FLAG_RCU)
|
||||
return -ECHILD;
|
||||
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS);
|
||||
smk_ad_setfield_u_fs_inode(&ad, inode);
|
||||
return smk_curacc(smk_of_inode(inode), mask, &ad);
|
||||
|
Reference in New Issue
Block a user