From patchwork Mon May 23 15:05:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel De Graaf X-Patchwork-Id: 9131979 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 E2C5060761 for ; Mon, 23 May 2016 15:08:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9EDA200F4 for ; Mon, 23 May 2016 15:08:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEDF12822F; Mon, 23 May 2016 15:08:24 +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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA83B200F4 for ; Mon, 23 May 2016 15:08:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4rQl-0000x8-5s; Mon, 23 May 2016 15:06:07 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4rQk-0000wV-ER for xen-devel@lists.xenproject.org; Mon, 23 May 2016 15:06:06 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 41/2D-06723-D5C13475; Mon, 23 May 2016 15:06:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRWlGSWpSXmKPExsXCoZPKqRsr4xx usOYiq8X3LZOZHBg9Dn+4whLAGMWamZeUX5HAmjHp9j6mgk7Fip8v77M0MN6T6WLk4JAQ8JPY /YGti5GLg1NgMYvEjjvvWEAcCYE9jBLT7r5i6mLk5BASWMoo0biNHyQhJLCNUeLYhOWsIAk2A V2JBQdXghWJCChJ3Fs1GcxmFiiSuLx6EZgtLOAtMXn/bTYQm0VAVeJ1WxMjiM0r4Cqx/ulEsL iEgJzEti17wOKcAm4Ss/dPYwS5TgioZso05QmMfAsYGVYxqhenFpWlFuka6yUVZaZnlOQmZub oGhqY6uWmFhcnpqfmJCYV6yXn525iBAYJAxDsYNz7z+kQoyQHk5Io78kdTuFCfEn5KZUZicUZ 8UWlOanFhxhlODiUJHjfSDmHCwkWpaanVqRl5gDDFSYtwcGjJML7ByTNW1yQmFucmQ6ROsWoK CXOKygNlBAASWSU5sG1wWLkEqOslDAvI9AhQjwFqUW5mSWo8q8YxTkYlYR53UCm8GTmlcBNfw W0mAlo8UNpB5DFJYkIKakGxsgmLkX706ofnmqKfGe4uO9I+6lf2/bPmc3wUv7V9LJpbxmf27x XVpqpeuxPNsO59umTPwYL1z+z6D/9QP5TLavE+icfvTf9s/GT5ch9/aw2Jbblx/VQtVs18l/i ttU0L9b9V1jjusT4yZMgdp7g1Ypy01LV6+dOWDWTPfLijHvTp63l+9KhMkWJpTgj0VCLuag4E QBDMqE0jAIAAA== X-Env-Sender: dgdegra@tycho.nsa.gov X-Msg-Ref: server-15.tower-206.messagelabs.com!1464015962!29076698!3 X-Originating-IP: [8.44.101.9] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9766 invoked from network); 23 May 2016 15:06:04 -0000 Received: from emsm-gh1-uea11.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) (8.44.101.9) by server-15.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 May 2016 15:06:04 -0000 X-IronPort-AV: E=Sophos;i="5.26,356,1459814400"; d="scan'208";a="16352620" IronPort-PHdr: =?us-ascii?q?9a23=3AXlaqfxPcp8Yw1XP58Zsl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0KPrzrarrMEGX3/hxlliBBdydsKIVzbGH+P+/EUU7or+/81k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZv?= =?us-ascii?q?IaytQ8iJ35XxjLH5pMKbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf?= =?us-ascii?q?9d32JiKAHbtR/94sCt4MwrqHwI6Loc7coIbYHWN+R9F+QZX3waNDUl6cuuuRTd?= =?us-ascii?q?QA+n4noHTn5QghdOGxLC7hzxQtH2qCSpmPB63Xy2NMv3QLR8dTnqwL1iQRGg3C?= =?us-ascii?q?sIOzM26mj/lt17jKUdpgmo4RN43diHM8muKPNic/aFLpshTm1bU5MUDXRM?= X-IPAS-Result: =?us-ascii?q?A2HqBADyG0NX/wHyM5BcHAGDGoFTt3GEFIYRAoEvTAEBAQE?= =?us-ascii?q?BAQICYieCLYIWAgRqDxAYOVcZiC/EegEBAQcCASSVDQWIBIVhilKOIAKJVoVEj?= =?us-ascii?q?0xihAkgMolRAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2016 15:05:38 +0000 Received: from moss-nexus.infosec.tycho.ncsc.mil (moss-nexus [192.168.25.48]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u4NF5YU7020519; Mon, 23 May 2016 11:05:37 -0400 From: Daniel De Graaf To: xen-devel@lists.xenproject.org Date: Mon, 23 May 2016 11:05:31 -0400 Message-Id: <1464015933-26891-4-git-send-email-dgdegra@tycho.nsa.gov> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464015933-26891-1-git-send-email-dgdegra@tycho.nsa.gov> References: <1464015933-26891-1-git-send-email-dgdegra@tycho.nsa.gov> Cc: steve@zentific.com, Daniel De Graaf , cardoe@cardoe.com Subject: [Xen-devel] [PATCH 3/5] flask/policy: Remove unused support for binary modules X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Daniel De Graaf Reviewed-by: Konrad Rzeszutek Wilk --- .../policy/policy/support/loadable_module.spt | 166 --------------------- tools/flask/policy/policy/support/misc_macros.spt | 2 + 2 files changed, 2 insertions(+), 166 deletions(-) delete mode 100644 tools/flask/policy/policy/support/loadable_module.spt diff --git a/tools/flask/policy/policy/support/loadable_module.spt b/tools/flask/policy/policy/support/loadable_module.spt deleted file mode 100644 index de48b3b..0000000 --- a/tools/flask/policy/policy/support/loadable_module.spt +++ /dev/null @@ -1,166 +0,0 @@ -######################################## -# -# Macros for switching between source policy -# and loadable policy module support -# - -############################## -# -# For adding the module statement -# -define(`policy_module',` - ifdef(`self_contained_policy',`',` - module $1 $2; - - require { - role system_r; - all_kernel_class_perms - } - ') -') - -############################## -# -# For use in interfaces, to optionally insert a require block -# -define(`gen_require',` - ifdef(`self_contained_policy',`',` - define(`in_gen_require_block') - require { - $1 - } - undefine(`in_gen_require_block') - ') -') - -############################## -# -# In the future interfaces should be in loadable modules -# -# template(name,rules) -# -define(`template',` - `define(`$1',` -##### begin $1(dollarsstar) - $2 -##### end $1(dollarsstar) - '') -') - -# helper function, since m4 wont expand macros -# if a line is a comment (#): -define(`policy_m4_comment',`dnl -##### $2 depth: $1 -')dnl - -############################## -# -# In the future interfaces should be in loadable modules -# -# interface(name,rules) -# -define(`interface',` - `define(`$1',` - - define(`policy_temp',incr(policy_call_depth)) - pushdef(`policy_call_depth',policy_temp) - undefine(`policy_temp') - - policy_m4_comment(policy_call_depth,begin `$1'(dollarsstar)) - - $2 - - define(`policy_temp',decr(policy_call_depth)) - pushdef(`policy_call_depth',policy_temp) - undefine(`policy_temp') - - policy_m4_comment(policy_call_depth,end `$1'(dollarsstar)) - - '') -') - -define(`policy_call_depth',0) - -############################## -# -# Optional policy handling -# -define(`optional_policy',` - ifdef(`self_contained_policy',` - ifdef(`$1',`$2',`$3') - ',` - optional { - $2 - ifelse(`$3',`',`',` - } else { - $3 - ') - } - ') -') - -############################## -# -# Determine if we should use the default -# tunable value as specified by the policy -# or if the override value should be used -# -define(`dflt_or_overr',`ifdef(`$1',$1,$2)') - -############################## -# -# Extract booleans out of an expression. -# This needs to be reworked so expressions -# with parentheses can work. - -define(`delcare_required_symbols',` -ifelse(regexp($1, `\w'), -1, `', `dnl -bool regexp($1, `\(\w+\)', `\1'); -delcare_required_symbols(regexp($1, `\w+\(.*\)', `\1'))dnl -') dnl -') - -############################## -# -# Tunable declaration -# -define(`gen_tunable',` - ifdef(`self_contained_policy',` - bool $1 dflt_or_overr(`$1'_conf,$2); - ',` - # loadable module tunable - # declaration will go here - # instead of bool when - # loadable modules support - # tunables - bool $1 dflt_or_overr(`$1'_conf,$2); - ') -') - -############################## -# -# Tunable policy handling -# -define(`tunable_policy',` - ifdef(`self_contained_policy',` - if (`$1') { - $2 - } else { - $3 - } - ',` - # structure for tunables - # will go here instead of a - # conditional when loadable - # modules support tunables - gen_require(` - delcare_required_symbols(`$1') - ') - - if (`$1') { - $2 - } else { - $3 - } - ') -') diff --git a/tools/flask/policy/policy/support/misc_macros.spt b/tools/flask/policy/policy/support/misc_macros.spt index 344f5c4..3116db9 100644 --- a/tools/flask/policy/policy/support/misc_macros.spt +++ b/tools/flask/policy/policy/support/misc_macros.spt @@ -61,6 +61,8 @@ define(`gen_all_users',`') # define(`gen_context',`$1`'ifdef(`enable_mls',`:$2')`'') +define(`dflt_or_overr',`ifdef(`$1',$1,$2)') + ######################################## # # gen_bool(name,default_value)