From patchwork Thu Jun 9 14:47:07 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: 9167213 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 354A1604DB for ; Thu, 9 Jun 2016 14:49:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26FE4264F4 for ; Thu, 9 Jun 2016 14:49:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C1912834F; Thu, 9 Jun 2016 14:49:51 +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 7D0F6264F4 for ; Thu, 9 Jun 2016 14:49:50 +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 1bB1FA-0004z6-1M; Thu, 09 Jun 2016 14:47:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bB1F8-0004uz-6M for xen-devel@lists.xen.org; Thu, 09 Jun 2016 14:47:34 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 70/5B-31933-58189575; Thu, 09 Jun 2016 14:47:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXCoZPKqdvSGBl u0LhPymLJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzWib9Yul4KhixcobfxgbGKfKdjFyckgI+Ek8 7e1m6WLk4uAUmM4isf/6EjYQR0JgP6PEot1tYBkhgaWMEltvfINytjJK3LhylBWkn01AV2LBw ZVMILaIgLTEtc+XGUFsZgFtieZ3M9lBbGEBX4nrDx+xgdgsAqoSz851gsV5BVwkuvY9ZYe4Q0 5i25Y9YL2cAq4Sb86/BKrnAFrmIrHwp9cERr4FjAyrGNWLU4vKUot0zfSSijLTM0pyEzNzdA0 NjPVyU4uLE9NTcxKTivWS83M3MQIDpZ6BgXEH45U250OMkhxMSqK83iWR4UJ8SfkplRmJxRnx RaU5qcWHGGU4OJQkeEsagHKCRanpqRVpmTnAkIVJS3DwKInwfqgHSvMWFyTmFmemQ6ROMSpKi fNagPQJgCQySvPg2mBxcolRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMK89yBSezLwSuOmvgB YzAS1efiQcZHFJIkJKqoHR0JhxtneOZfeeDK0Kqc7rlpYns087CYfb7Z4c2BS9Y0HbhbJCNR5 2n0PrL6+ZwWg/9aTVZv05C+LnZvzSO3L6xkqL0O3Ls/7EMczTZL15oGS28/RtC9xVrCOubHKP nCTIskLxcEdx4UblLQ/C/z279WTP/Pqn1fv8dqeXvk8+87NNhn+BuMxCJZbijERDLeai4kQAs +u1dI4CAAA= X-Env-Sender: dgdegra@tycho.nsa.gov X-Msg-Ref: server-6.tower-31.messagelabs.com!1465483649!18348707!4 X-Originating-IP: [8.44.101.9] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62814 invoked from network); 9 Jun 2016 14:47:32 -0000 Received: from emsm-gh1-uea11.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) (8.44.101.9) by server-6.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Jun 2016 14:47:32 -0000 X-IronPort-AV: E=Sophos;i="5.26,445,1459814400"; d="scan'208";a="16783284" IronPort-PHdr: =?us-ascii?q?9a23=3A+rA0IR1vaxTVagi1smDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?segQK/ad9pjvdHbS+e9qxAeQG96LurQb1qGJ6ejJYi8p39WoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09?= =?us-ascii?q?fr2zQd6DyZvqnL/os7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP?= =?us-ascii?q?5Xz247bXianhL7+9vitMU7q3cYhuglv/Jkfe26Ov5gDO8QMDNzI20zocHmqxTH?= =?us-ascii?q?ZQ+O/WcHFHUblFxPGQeWwgv9W8Lduy37u+419CTSEtf/RL58DTit46pkUhbAlD?= =?us-ascii?q?YMNzl/9nrezMN3kvQI81qauxVjztuMM8muP/1kc/aYJ4sX?= X-IPAS-Result: =?us-ascii?q?A2FtBABJgFlX/wHyM5BeGwEBAYMggVO5CIQJhhMCgTVMAQE?= =?us-ascii?q?BAQEBAgJiJ4IwghYCBGoPEBg5VxmIL74qAQEBBwIBJJUOBYgIhWKKa44nAolZh?= =?us-ascii?q?UWPZVSECiAyiggBAQE?= 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; 09 Jun 2016 14:47:28 +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 u59ElSN6018061; Thu, 9 Jun 2016 10:47:28 -0400 From: Daniel De Graaf To: xen-devel@lists.xen.org Date: Thu, 9 Jun 2016 10:47:07 -0400 Message-Id: <1465483638-9489-5-git-send-email-dgdegra@tycho.nsa.gov> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465483638-9489-1-git-send-email-dgdegra@tycho.nsa.gov> References: <1465483638-9489-1-git-send-email-dgdegra@tycho.nsa.gov> Cc: Daniel De Graaf Subject: [Xen-devel] [PATCH 04/15] 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 Reviewed-by: Doug Goldstein --- .../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)