From patchwork Mon Mar 28 19:42:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Moore X-Patchwork-Id: 8680281 Return-Path: X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 376329F36E for ; Mon, 28 Mar 2016 19:47:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92FA32010B for ; Mon, 28 Mar 2016 19:47:57 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (unknown [63.239.67.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA57920109 for ; Mon, 28 Mar 2016 19:47:56 +0000 (UTC) X-TM-IMSS-Message-ID: Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1) id e1da2905000238e4 ; Mon, 28 Mar 2016 15:45:42 -0400 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 u2SJkMNw001858; Mon, 28 Mar 2016 15:46:24 -0400 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 u2SJgHrn117360 for ; Mon, 28 Mar 2016 15:42:17 -0400 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 u2SJgCgf001026 for ; Mon, 28 Mar 2016 15:42:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DPAwBfiPlWkxy3hNFdHAGELTSKIp4ukBWEDYd+AQEBAQEBEgEBAQEJCwkJIYUaBIECBQImAkkpiCefb49dkD18hSKBe4dRgjSCVgWXYZc9hVICjwqCGAxSgW0gMIc/H4EcAQEB X-IPAS-Result: A1DPAwBfiPlWkxy3hNFdHAGELTSKIp4ukBWEDYd+AQEBAQEBEgEBAQEJCwkJIYUaBIECBQImAkkpiCefb49dkD18hSKBe4dRgjSCVgWXYZc9hVICjwqCGAxSgW0gMIc/H4EcAQEB X-IronPort-AV: E=Sophos;i="5.24,408,1454994000"; d="scan'208";a="5330397" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 28 Mar 2016 15:42:16 -0400 X-TM-IMSS-Message-ID: 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 e1d6563d000237ba ; Mon, 28 Mar 2016 15:41:31 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id DEB7364385 for ; Mon, 28 Mar 2016 19:42:14 +0000 (UTC) Received: from [127.0.0.1] (unused [10.10.51.4] (may be forged)) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2SJgESH028061; Mon, 28 Mar 2016 15:42:14 -0400 Subject: [PATCH] selinux: simply inode label states to INVALID and INITIALIZED From: Paul Moore To: selinux@tycho.nsa.gov Date: Mon, 28 Mar 2016 15:42:13 -0400 Message-ID: <145919413391.2232.14686465186592932882.stgit@localhost> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 28 Mar 2016 19:42:14 +0000 (UTC) X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1571-6.5.0.1024-16972.004 X-TM-AS-Result: No--2.214-7.0-31-10 X-imss-scan-details: No--2.214-7.0-31-10 X-TMASE-MatchedRID: O5Tju5269FG5X15AcJhsekhEDfw/93BuWDLajM22ETa4a2U7iYmMbqjP D2CRrh2KEaIDbp9MwdJIKrDEoCVeap6U7joP1tmOA9lly13c/gERWG8HyxfLI1Je7qhVGmbY9Os /l7x5zsEDjX4E13GCjl5IkTKFvb/EgjtU8/YH4GGRkchtwbQpC5ki8CAGxqnSbhEhcDFlNnxKjK YFgtpoApJ0O4G7c2ZBT/5qIli3+s3NSUZoSZ9eVEiM8XK7lnvrPZKSh9YbJb1PzCEGshlMuykEO 84sarFhMSkSZqMf0OFRuGRXWCBE0NBKAOIUVybtsxOATg6vAqs= 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: Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RDNS_NONE, 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 From: Paul Moore There really is no need for LABEL_MISSING as we really only care if the inode's label is INVALID or INITIALIZED. Also adjust the revalidate code to reload the label whenever the label is not INITIALIZED so we are less sensitive to label state in the future. Signed-off-by: Paul Moore --- security/selinux/hooks.c | 2 +- security/selinux/include/objsec.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index ec1a1a8..837c566 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -259,7 +259,7 @@ static int __inode_security_revalidate(struct inode *inode, might_sleep_if(may_sleep); - if (isec->initialized == LABEL_INVALID) { + if (isec->initialized != LABEL_INITIALIZED) { if (!may_sleep) return -ECHILD; diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h index a2ae054..c21e135 100644 --- a/security/selinux/include/objsec.h +++ b/security/selinux/include/objsec.h @@ -38,9 +38,8 @@ struct task_security_struct { }; enum label_initialized { - LABEL_MISSING, /* not initialized */ - LABEL_INITIALIZED, /* inizialized */ - LABEL_INVALID /* invalid */ + LABEL_INVALID, /* invalid or not initialized */ + LABEL_INITIALIZED /* initialized */ }; struct inode_security_struct {