From patchwork Thu Feb 18 11:04:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 8349601 Return-Path: X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 54D4DC0553 for ; Thu, 18 Feb 2016 13:22:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDABB20386 for ; Thu, 18 Feb 2016 13:22:03 +0000 (UTC) Received: from emvm-gh1-uea09.nsa.gov (emvm-gh1-uea09.nsa.gov [63.239.67.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAD7C20357 for ; Thu, 18 Feb 2016 13:22:00 +0000 (UTC) X-TM-IMSS-Message-ID: <3815a05c00038568@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1) id 3815a05c00038568 ; Thu, 18 Feb 2016 08:22:47 -0500 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u1IDJYXk011546; Thu, 18 Feb 2016 08:19:39 -0500 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u1IB4Gqn247596 for ; Thu, 18 Feb 2016 06:04:16 -0500 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u1IB4GhF014470; Thu, 18 Feb 2016 06:04:16 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CUAgCopMVWfBy3hNFeGQEBAg8BAQEBhCMmqiQBjWaECBKIKQEBAQEBARIBAQsLCgghhR6CEAESiBq7a4YSiD6EbAWXBY1ajnECRI4DghgMAT8ZgUk7LodmAh4BBoESAQEB X-IPAS-Result: A1CUAgCopMVWfBy3hNFeGQEBAg8BAQEBhCMmqiQBjWaECBKIKQEBAQEBARIBAQsLCgghhR6CEAESiBq7a4YSiD6EbAWXBY1ajnECRI4DghgMAT8ZgUk7LodmAh4BBoESAQEB X-IronPort-AV: E=Sophos;i="5.22,464,1449550800"; d="scan'208";a="5211169" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 18 Feb 2016 06:04:15 -0500 X-TM-IMSS-Message-ID: <1725456200039a1f@nsa.gov> Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 ADH-AES256-SHA (256/256)) id 1725456200039a1f ; Thu, 18 Feb 2016 06:03:55 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 7962DC0006F7; Thu, 18 Feb 2016 11:04:12 +0000 (UTC) Received: from schleppi.home.com (vpn1-6-221.ams2.redhat.com [10.36.6.221]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1IB4AEu007599; Thu, 18 Feb 2016 06:04:11 -0500 From: Andreas Gruenbacher To: Paul Moore , Stephen Smalley , Eric Paris , selinux@tycho.nsa.gov Subject: [PATCH] selinux: Don't sleep inside inode_getsecid hook Date: Thu, 18 Feb 2016 12:04:08 +0100 Message-Id: <1455793448-26143-1-git-send-email-agruenba@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-TM-AS-MML: disable X-Mailman-Approved-At: Thu, 18 Feb 2016 08:19:33 -0500 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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; }