From patchwork Sat Aug 27 09:21:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Iooss X-Patchwork-Id: 9302339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 228A36077C for ; Sat, 27 Aug 2016 09:25:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 050DB28457 for ; Sat, 27 Aug 2016 09:25:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D3C284AE; Sat, 27 Aug 2016 09:24:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.nsa.gov [8.44.101.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C82C028457 for ; Sat, 27 Aug 2016 09:24:58 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.28,586,1464652800"; d="scan'208";a="18801455" IronPort-PHdr: =?us-ascii?q?9a23=3AHQIDFB9fOiFNE/9uRHKM819IXTAuvvDOBiVQ1KB9?= =?us-ascii?q?1OkcTK2v8tzYMVDF4r011RmSDNydt6gP07Se8/i5HzdRudDZ6DFKWacPfidNsd?= =?us-ascii?q?8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4?= =?us-ascii?q?bt74BpTVx5zukbvjotuPOU4Q2nL9Oeo0d0Tu612J94E/ushLEu4J0BzHo39FKa?= =?us-ascii?q?x95FhDAhatpSv6/dq655V58i5d6LoL/s9EVrjmLexjFeQLRAk8NygJwOGj9Vyd?= =?us-ascii?q?DFjH2nxJSWgSkxxVEyDZ/Rr6WdH3qSK8ue1jiweAOsija7E/XjCr9O9KTxjzk2?= =?us-ascii?q?9TMT8y92XekYpxi6VAuzqk+ww5xJTbNtLGfMFid7/QKItJDVFKWdxcAmkfDw?= =?us-ascii?q?=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2ELBQBVW8FX/wHyM5BdHAEBBAEBGQaDCgEBAQEBHlZ8uWk?= =?us-ascii?q?3IgeHQUwBAQEBAQEBAQIBAlsngjIEAxMFBAE5PAEBAQEBASMCGlICBAECJBMUI?= =?us-ascii?q?A4DCQEBFykICAMBLRURDgsFGASIHwQBtXyKGoYuiF8RAWiFEAWIJoc1iXSBZIQ?= =?us-ascii?q?8iQGCRYc3hWOQPVSCNBwXgTduhC14gScBAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 27 Aug 2016 09:24:54 +0000 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 u7R9NRV0006176; Sat, 27 Aug 2016 05:23:43 -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 u7R9NPTp022725 for ; Sat, 27 Aug 2016 05:23:25 -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 u7R9NOdw006173 for ; Sat, 27 Aug 2016 05:23:25 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CTAwCTW8FXfSIeaIFdHQEFAYMpAQEBAQF0fLYZhCQMh0FMAQIBAQEBAQITAQELFAmFKgYnYlFXGYhABAG1fIoahi6JWYUQBYgmhzWJdIFkhDyJAYJFjRqQPYI2DEYcF4E3boZMAQEB X-IPAS-Result: A1CTAwCTW8FXfSIeaIFdHQEFAYMpAQEBAQF0fLYZhCQMh0FMAQIBAQEBAQITAQELFAmFKgYnYlFXGYhABAG1fIoahi6JWYUQBYgmhzWJdIFkhDyJAYJFjRqQPYI2DEYcF4E3boZMAQEB X-IronPort-AV: E=Sophos;i="5.28,586,1464667200"; d="scan'208";a="5668307" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 27 Aug 2016 05:23:18 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Apz1mRRD9d/ufRK8k0jXVUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP79p8bcNUDSrc9gkEXOFd2CrakV0qyK6eu4ByRAuc/H6yFaNsQUFlcsso?= =?us-ascii?q?Y/p0QYGsmLCEn2frbBThcRO4B8bmJj5GyxKkNPGczzNBX4q3y26iMOSF2kbVIm?= =?us-ascii?q?btr8FoOatcmrzef6o8SVOFQRwmbnKussZFXu9EOK55FQ2dMjYo8KiTLx6kNSfO?= =?us-ascii?q?pXwW46bXmypD3bovmKwZh47i5LsOgg/cMTGY/zfqA/UKAKRG9+azN9t4XXskzY?= =?us-ascii?q?QA+O4GYMenkHmRpPRQ7e5Vf1WYminDH9s79b2SKdOcTtBZEzXi+5p/NtSRTvjC?= =?us-ascii?q?4ccT8+93rMosksnORcuh339E83+JLdfIzAbKk2RajaZ95PHWc=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HCAwBVW8FXfSIeaIFdHQEFARgBBQGDC?= =?us-ascii?q?gEBAQEBdHy2GYNQVAyHQUwBAQEBAQEBAQIBAhABAQsUCUiCMhgLATk8AQEBAQE?= =?us-ascii?q?BIwIaUgYnYlFXGYhABAG1fIoahi6JWYUQBYgmhzWJdIFkhDyJAYJFjRqQPYI2D?= =?us-ascii?q?EYcF4E3boZMAQEB?= X-IPAS-Result: =?us-ascii?q?A0HCAwBVW8FXfSIeaIFdHQEFARgBBQGDCgEBAQEBdHy2GYN?= =?us-ascii?q?QVAyHQUwBAQEBAQEBAQIBAhABAQsUCUiCMhgLATk8AQEBAQEBIwIaUgYnYlFXG?= =?us-ascii?q?YhABAG1fIoahi6JWYUQBYgmhzWJdIFkhDyJAYJFjRqQPYI2DEYcF4E3boZMAQE?= =?us-ascii?q?B?= X-IronPort-AV: E=Sophos;i="5.28,586,1464652800"; d="scan'208";a="18801450" Received: from mx1.polytechnique.org ([129.104.30.34]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2016 09:23:17 +0000 Received: from localhost.localdomain (32.206.133.77.rev.sfr.net [77.133.206.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 8DEC95646D3 for ; Sat, 27 Aug 2016 11:23:15 +0200 (CEST) From: Nicolas Iooss To: selinux@tycho.nsa.gov Subject: [PATCH 1/3] checkpolicy: add types associated to a role in the current scope when parsing Date: Sat, 27 Aug 2016 11:21:47 +0200 Message-Id: <20160827092149.9277-2-nicolas.iooss@m4x.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160827092149.9277-1-nicolas.iooss@m4x.org> References: <20160827092149.9277-1-nicolas.iooss@m4x.org> X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sat Aug 27 11:23:15 2016 +0200 (CEST)) X-Org-Mail: nicolas.iooss.2010@polytechnique.org 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-Virus-Scanned: ClamAV using ClamSMTP This fixes most of the errors reported in "make -C libsepol test": ./libsepol-tests CUnit - A unit testing framework for C - Version 2.1-3 http://cunit.sourceforge.net/ Suite: cond Test: cond_expr_equal ...passed Suite: linker Test: linker_indexes ...passed Test: linker_types ...passed Test: linker_roles ... role o1_b_role_1 has 0 types, 1 expected role o1_b_role_1 has 0 types, 1 expected role o1_m1_role_1 has 0 types, 1 expected sym g_b_role_2 has 1 decls, 2 expected Role o1_b_role_2 had type o1_b_type_1 not in types array role o1_b_role_2 has 0 types, 1 expected Role g_b_role_4 had type g_m1_type_2 not in types array role g_b_role_4 has 0 types, 1 expected role o3_b_role_1 has 0 types, 1 expected role o3_b_role_1 has 0 types, 1 expected role o4_b_role_1 has 0 types, 1 expected Role o4_b_role_1 had type g_m1_type_1 not in types array FAILED 1. test-common.c:216 - found == len 2. test-common.c:216 - found == len 3. test-common.c:216 - found == len 4. test-common.c:43 - scope->decl_ids_len == len 5. test-common.c:52 - found == 1 6. test-common.c:213 - new == 1 7. test-common.c:216 - found == len 8. test-common.c:213 - new == 1 9. test-common.c:216 - found == len 10. test-common.c:216 - found == len 11. test-common.c:216 - found == len 12. test-common.c:216 - found == len 13. test-common.c:213 - new == 1 Test: linker_cond ...passed Suite: expander Test: expander_indexes ...passed Test: expander_attr_mapping ...passed Test: expander_role_mapping ...passed Test: expander_user_mapping ...passed Test: expander_alias ...passed Suite: deps Test: deps_modreq_global ...passed Test: deps_modreq_opt ...passed Suite: downgrade Test: downgrade ...passed Run Summary: Type Total Ran Passed Failed Inactive suites 5 5 n/a 0 0 tests 13 13 12 1 0 asserts 1269 1269 1256 13 n/a Signed-off-by: Nicolas Iooss --- checkpolicy/policy_define.c | 1 + 1 file changed, 1 insertion(+) diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c index 100e517820f9..128869c675be 100644 --- a/checkpolicy/policy_define.c +++ b/checkpolicy/policy_define.c @@ -2614,6 +2614,7 @@ int define_role_types(void) free(id); return -1; } + role = get_local_role(id, role->s.value, (role->flavor == ROLE_ATTRIB)); while ((id = queue_remove(id_queue))) { if (set_types(&role->types, id, &add, 0))