From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [PATCH] selinux: Don't sleep inside inode_getsecid hook To: Andreas Gruenbacher , Paul Moore , Eric Paris , selinux@tycho.nsa.gov References: <1455793448-26143-1-git-send-email-agruenba@redhat.com> From: Stephen Smalley Message-ID: <56C5CCCF.4000400@tycho.nsa.gov> Date: Thu, 18 Feb 2016 08:53:19 -0500 MIME-Version: 1.0 In-Reply-To: <1455793448-26143-1-git-send-email-agruenba@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: On 02/18/2016 06:04 AM, Andreas Gruenbacher wrote: > The inode_getsecid hook is called from contexts in which sleeping is not > allowed, so we cannot revalidate inode security labels from there. Use > the non-validating version of inode_security() instead. > > Reported-by: Benjamin Coddington > Signed-off-by: Andreas Gruenbacher Offending caller is ima_match_rules? Acked-by: Stephen Smalley > --- > security/selinux/hooks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index f8110cf..f1ab715 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -3249,7 +3249,7 @@ static int selinux_inode_listsecurity(struct inode *inode, char *buffer, size_t > > static void selinux_inode_getsecid(struct inode *inode, u32 *secid) > { > - struct inode_security_struct *isec = inode_security(inode); > + struct inode_security_struct *isec = inode_security_novalidate(inode); > *secid = isec->sid; > } > >