From patchwork Thu May 4 21:36:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn via Selinux X-Patchwork-Id: 9712741 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 AC0A160235 for ; Thu, 4 May 2017 21:38:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FAC7200F5 for ; Thu, 4 May 2017 21:38:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83E242869F; Thu, 4 May 2017 21:38:15 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (smtp.nsa.gov [8.44.101.8]) (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 CA69E286A3 for ; Thu, 4 May 2017 21:38:13 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.38,289,1491264000"; d="scan'208";a="6678170" IronPort-PHdr: =?us-ascii?q?9a23=3APip9Nh9l2Po43f9uRHKM819IXTAuvvDOBiVQ1KB5?= =?us-ascii?q?0OwTIJqq85mqBkHD//Il1AaPBtSFrawfwLKP+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1?= =?us-ascii?q?Ov71GonPhMiryuy+4ZPebgFJiTanYL5/Ihq6oRnMusILnYZsN6E9xwfTrHBVYe?= =?us-ascii?q?pW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbf?= =?us-ascii?q?VwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8qlkSAXsiC?= =?us-ascii?q?waKTA39m/ZgdF0gK5CvR6tuxlzzojTb4yJOvdyYr7RccoGSWZcQ81dUzFND4O5?= =?us-ascii?q?Y4YJEuEPP/tXr5PlqlUQsBWwCwqiCuT3yjJKm3P706000/4/HgHdxwEsA84CvW?= =?us-ascii?q?7IoNjvKKseTea4x7TIwzXZaPNW3C/w5ozWfRAvr/GHQL1/ftDXyUYyCQzFlEib?= =?us-ascii?q?p5H5PzOSyOsNq3WQ7/RhVe21lmUpth9+ojyuxscql4nIiZ8ex1ff9SpnxIY1JN?= =?us-ascii?q?u4SFN0YNO/DJtRtz2VN4txQs84RWFoozw1xqcJuZ68YigH0ZIqzAPRZfyAdoiH?= =?us-ascii?q?+BPjVOCJLDd3hXJlZLK/hwup/kS61uL8Ucy03E5RriVZiNbMsGoB1xjI5cWBV/?= =?us-ascii?q?Bz/V+h1C6S2w3c5exIO0A5mbfBJ5I/zbM8iIAfvVnbEiPohEn7iLWae0Yk9+Sy?= =?us-ascii?q?9ujqZqvqqoWBO4J3lw3zNLkllNalDuQiKAcOWnCW+eG71LL+40L0WK5Kjvgqkq?= =?us-ascii?q?nBt5DaONgbqra5AwBL1oYj7A6yDyu839QCnHkHMUlFdAibj4npJ17OIPf4Ae25?= =?us-ascii?q?g1uwizdk2+rKPrjgApXJNnTDkbHhcqhh60NE1QY+wt9S64hUB70cOv7/RED8uM?= =?us-ascii?q?LCAhMkKwC0xvzoCNR51oMQQ2KPBaqZPbvJsVCW4uIvIu+MZJIauTrkMPcl4OPu?= =?us-ascii?q?jXklllADZqmkxocXaXCkEfRmJEWVe3zsgswbHmsQsQo+S/LqhEWYUTFPf3ayQ7?= =?us-ascii?q?485jYjBYKkCofDQJqigKCB3CihGJ1bfWJGCleK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= =?us-ascii?q?pLhnJWnJXUhIZzT2L31lUqaosLqCYspP6Jc2viVMS+mze06VSqT6oxcA1CPjBW?= =?us-ascii?q?Rezighdz62opX5gwB6iGWFIXZtrXrWZd1wxRDF5NDGWfFR3j0GRC93iTTMAli8?= =?us-ascii?q?Pt+p8s+Ol5fEqOy+UHihVpJLeynx0YyArDe75XFtARCnm/Czm8bnERQj3S/gyd?= =?us-ascii?q?ZqUSTIrBDhYojkzKm6KvpnfkhuBF/998V6AZtyko0ui5EMwXIanIma/WIbkWfv?= =?us-ascii?q?NtVWwbj+bH0JRT4P3dHV+hTq2EptL3+S3IL5S2mSwtB7a9m9eGMW1To379pWB6?= =?us-ascii?q?eM8LxEgSx1r0KgrQ3LfPh9mi0RxuE05HEBhOEJvBYtziKbAr0JGElUISrslxOU?= =?us-ascii?q?4NykqqVYenqve6Cq1EVihdChEK2CogZEVXb6ZJgiGzRw4958MF3S1n3z8Yfkd8?= =?us-ascii?q?fMbd4JsR2UiRjAhfBPKJ0tjvoKmTZnOWXlsH07ze40kAdj3Y+8vIeaK2Vh5qS5?= =?us-ascii?q?DQBENjftfcMc5intjbpCnsaRx42vBo9uGigPXJbzUf2oES4StPT+OwaACjI8rG?= =?us-ascii?q?2XGb3FHQ+Q8E1mtW7AE4i3N3GLI3kU1c9iSwSAK0FEjwAUWTo7koQ/Fg+02Mzr?= =?us-ascii?q?aF156SwJ5l7kthtMzfplNwHlXWfCoAendC80R4KZLBpK8A5C/VzYMdGF7u1tBS?= =?us-ascii?q?FY5YetrBeKKmyGfQRHEX8GWkKDB1D5Mbmh+8PM8+6GCeqiN/HOe6mBqfRCV/eU?= =?us-ascii?q?wpKiyoVm8CyKNsWTOXliCuY22kRdUn9kHMTZgS8ASzQNlyLKbc6Uuguz+jFtos?= =?us-ascii?q?C46vTrVxrl5ZGTBLtKLdVv5xe2jL+GN+GKgCZ5LShX1o8QxXDS0rcSx1gShD9y?= =?us-ascii?q?dzm2DbsPrzbNQ7zKlq9REREbdz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pdMc5N4SUBXDlRrjqDotS+UspD2dV5D5UUONdwp2/9GL9YOJiW?= =?us-ascii?q?u3A5oKbvymLf+zwms1e33zSzG665T+JF5GISAAMpKHqCqkM3Fesj7n/S8kzRsl?= =?us-ascii?q?Bz5+pbB76PjVlvrzZ5AJ9OAyhG1Wy/L1VzV3RGtP1aJ7rTc8xZWfYyZBuvNAc5?= =?us-ascii?q?Ff8pxUCJ+lt0nXjhaSxoqgRa4zzdXxUzVSQNjbftgycRqse7OTIBSpJIajsgby?= =?us-ascii?q?HZKwKbhy9XvRBfa110VJADGNpF/a8U3ZdM9MrYVUmsMT0FXABlNg8gzfpfkktD?= =?us-ascii?q?vV6EeSzBCAqnbuzDshtpcseNtMSpNuj2/B9bioP7t+A176UDSGe8mQK3RdDRsp?= =?us-ascii?q?TxucCUuUuWbKf3Lem8bmHbTDTWihCwn7gkBYHQ/yfPKApbN4V6yX08bJjjDm7E?= =?us-ascii?q?Iw9LKL8FKEpAS696c8lGrf5HaMN+fqYG57NtDAqdRhzzAIyvsOVGLlHLSDvFIS?= =?us-ascii?q?WO7vCzrIDO4bHTUuXvesuMx3PbTK1tJZd69SP3G7H03o9C4kD2wOti9ltmSVja?= =?us-ascii?q?NCCMtM7hKR0W68mibETiooYkHTfRAJdujnXh2F1Pd80KTCK06pgYzo1W6GroQ+?= =?us-ascii?q?JizkfzqPFS96Vj6YQv+7Bp0tu0Kr3PJvRGqkJnGR+UBhhw9poxHmd/QXxRYvUL?= =?us-ascii?q?J/fVZ6gZitruq+/vHawN9BKV4/BZacfAJ0zZhsm/EC+TRgJZkwoatD4aKhec1+?= =?us-ascii?q?SflK9qSMalouz51Vwx41SkKR4G1r9t75+e+qWUvO/XcwfRzb8cV6joXMzztLMs?= =?us-ascii?q?u1iW5fI+ir4DYWl1YxCjEOgBV84S2mbgwroszSI3Cc/DGKjg+PFbXXIjgj3gg4?= =?us-ascii?q?x9H0kRGv4MH7qE54Jenmkim+zeK9IZbLtPmnqVGh6iCb8Czm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exoqpuWW3OcN7P9kO0v4e4AbPgoOy6jm5npNUgtuVLn2s06FUuITftRpVO?= =?us-ascii?q?jJoWxS6YJkL68PPUaSpIb2rjhWtF82ABUlaLgqrjxVbkPOhhFaW77ouL4cjQsR?= =?us-ascii?q?Sdt5uUhKGWKsN2Ix+SHKVaFUjKaLDvwa7CmTT6IJU0VyMSN+WAm52JNwdLu1hf?= =?us-ascii?q?pHqH9JnjthoPg21DxrXBS8tjH3p6IWwD4u5b62ujMAuXxDU+WfnDzFCVpGzPsQ?= =?us-ascii?q?i6cTFWzu6VumYHkMdIHy+qVoJdz89Yk95HQyeRcjfyoGXeSmES3/k6OIAoiSsN?= =?us-ascii?q?1BhR+NucPObaSwLSgTLbk91xPjR2Zn3QjagRlo8XEHQjO+4984PI+9I9oqxjK0?= =?us-ascii?q?GWjHc1YB+qJJsNXrul4NV+Y2bU5hz3hi0siAXS0BXsvPG3w6jgI8c2VLbIpD6Q?= =?us-ascii?q?MGF6kvmjuIvLdJ/g8aYDfQCYmk9JPfncHW1nkhV9tqwHzZprGdjJMwzHJlg890?= =?us-ascii?q?7jKJuHkKeOzYV8hsA3bt2YdbzezzfO6tsucBSItn1LutSvkCPde/+WGuwpVlRl?= =?us-ascii?q?elxqgCH1q+KOIDxLfbUie9SW2fXeSLcnSMkCgiP0735BmoMkc3Z9lQo086KOvC?= =?us-ascii?q?iYZWlxf9XrNsWiWQuVjbwXQsMeMHdgI5pYCndhcWTO4LeeecI/Quz+c6CFQWaX?= =?us-ascii?q?/GASp2BPWsvV6rgod7J21q4V/mbuT17gDmLNySFwEYEY7bq5584uC6RmOdNn9j?= =?us-ascii?q?0hJyOFN49+HBGFQtruVcaYqencDMh9Rn1u4Ib/JtMSw+ut4QnYJu8ouU392JcR?= =?us-ascii?q?HWyJb9O9fVruKeA/LB00QgYntaXaYBYQPp+4U6OcY0VKbNErtfoRQRHrM6QJgm?= =?us-ascii?q?N2ft6KF0Mh18fRPLaLSzmMnqqfqBZoFIqH/O8lIwMCDctgUbyvyzSQx0dYqqhn?= =?us-ascii?q?v1IJA0SDJMtNhtChxhHItUBcwPsxCnA5mPmKGgit+x/Ux6t/UNsarqBfDAzM65?= =?us-ascii?q?0JlpX5hG+UyLOy7cBKd1jURhj+SymunP34LwCMPjfNMEUfZ0QnTBarDYBIm/LS?= =?us-ascii?q?iOOs3kcU5c77GcyK55UgmWZC3hUauGrDekNPR47kol0YF4eevTzCA3777Fwtfy?= =?us-ascii?q?YHtbpii7p36TKJRf9EDKBfDZXx9MTvqF9HhqELYPbYvw7ugOKsAiwNmA7Alv9j?= =?us-ascii?q?RNztWKL7KnrkDSxkJxbYjbI1fx2yYlRYkKJwyyMU8tgW/ft3TcDm1QLsylKcl2?= =?us-ascii?q?nNaVFQfg50hrlmErYW5NAG3oRc2eOWIDwcKxeBWK9B5XD9YEh+O3YlA3tqmzSe?= =?us-ascii?q?luJ5VEluKmurobkdZpNS7PXtZVPznKI7JtPTpeEP/PpF42bR4AqLc1R4g1aYKJ?= =?us-ascii?q?IEMdP0eK0Tnywhfa0U3oa9ys076EICMM/Xpbz7LF0D5Mpw6itPaHg83jVq7WbJ?= =?us-ascii?q?X3XP7ULSokWSuWRTMoEUam4V2koeYLvOKEIWcDpVAZeiCSBxQQpqBottfdFXLT?= =?us-ascii?q?met/fJ0Kg/CaRi/wSC1klKYoACZEq1yMSeIZFQbKd3/hnHZcuAu6K/BX5n3paL?= =?us-ascii?q?mYxqtOW+wKGYtAaOaZTMXEdvxEPDcniDEZOOe6f93BoLc0yU7HTGsDE6nV712S?= =?us-ascii?q?VkCXTeaAxzLwWoUVuZI4ui0y+tLfhiV3CbjHP66Dpz6y9Y61lCmYtvfFWWk3Yk?= =?us-ascii?q?w6nuYCDXKfwBlEMm4EENAVuFz3Tq6GeUlMyGojifhy1B8UZARzTnpu32VUnPa4?= =?us-ascii?q?Hc1ZU0QUjGK1QPAdalB4FjYw8lGL4gHoZtwAo8/TTXdE9rQQUYodMOUo6I7PNa?= =?us-ascii?q?sLzvYp2S5prS05viiGEVNSkBiF86vRHaJ7wL1O/2848O9qXhLHfzSKaWXDy4y7?= =?us-ascii?q?G+pT1CxupjbizMOSsedzZ4FXv4VoPFBfIy94KJjj9DZNXHu84xe1sg7zSDaTLj?= =?us-ascii?q?wHyDkMIiMBe6B+yOot4zjScdOUy06eueofoU2nBBzDMaaz1YQDFMDgnT61bShN?= =?us-ascii?q?bCXjQ4t7rvdLicY6fbIsZY/4BUvIaAf5EFTL6Gg36BH2r+HzXoJxyWIEn/BxJQ?= =?us-ascii?q?=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2FsAAD+nQtZ/wHyM5BcGQEBAQEBAQEBAQEBBwEBAQEBFAE?= =?us-ascii?q?BAQEBAQEBAQEBBwEBAQEBgwEpYnoSjnOmaIEaBRdAJAuKR1cBAQEBAQEBAQIBA?= =?us-ascii?q?mgogjMKIQRGKS8BAQEBAQEBAQEBAQEBAQEaAg1lAhcNVQMJAhIFMQgDATABBQE?= =?us-ascii?q?1BYgDTYE+DQ6kfT+NdDomAoRChioFEogrjWMFkBiBBIxJhxuLbQ2KcCeGTgKSb?= =?us-ascii?q?TOBFVhMPiUJAh4IHw+BTRmDD0QcggNWiQEBAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 04 May 2017 21:38:11 +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 v44Lb0mt015754; Thu, 4 May 2017 17:37:23 -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 v44LavFH036050 for ; Thu, 4 May 2017 17:36:57 -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 v44Laug7015744 for ; Thu, 4 May 2017 17:36:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1BWAAA5ngtZf7XAVdFcGgEBAQECAQEBAQgBAQEBgyyBCzJatnUFWhwQhXiET1cBAgEBAQEBAhMBAQkLCwgmhWcNGQEBNwGBFAEFATWIVYFLDqR+P4sdglc6gwkBAQWHVwEBAQEBBQIeAwUJAQiEPYIQgV6KSgyDDZAdgQSMSYUzgWiLbQ2KcIZ1ApJtM4EVgSM+LiAIGRWFKg8cggMgNokBAQEB X-IPAS-Result: A1BWAAA5ngtZf7XAVdFcGgEBAQECAQEBAQgBAQEBgyyBCzJatnUFWhwQhXiET1cBAgEBAQEBAhMBAQkLCwgmhWcNGQEBNwGBFAEFATWIVYFLDqR+P4sdglc6gwkBAQWHVwEBAQEBBQIeAwUJAQiEPYIQgV6KSgyDDZAdgQSMSYUzgWiLbQ2KcIZ1ApJtM4EVgSM+LiAIGRWFKg8cggMgNokBAQEB X-IronPort-AV: E=Sophos;i="5.38,289,1491278400"; d="scan'208";a="6041261" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 04 May 2017 17:36:57 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AfO7nkBFYO7gB1TuXUbgvB51GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ78os2wAkXT6L1XgUPTWs2DsrQf2rSQ7furATVIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSijewZbJ/IA+3oAjfucUanZZuIbstxxXUpXdFZ/?= =?us-ascii?q?5Yzn5yK1KJmBb86Maw/Jp9/ClVpvks6c1OX7jkcqohVbBXAygoPG4z5M3wqBnM?= =?us-ascii?q?VhCP6WcGUmUXiRVHHQ7I5wznU5jrsyv6su192DSGPcDzULs5Vyiu47ttRRT1ji?= =?us-ascii?q?oMKjw3/3zNisFojKxVvg+vqRJ8zYDTe4yZKOZyc7nBcd4AWWZNQsBcXDFBDIOm?= =?us-ascii?q?aIsPCvIMM+JGoInzqVsFsBSxChOqBOzy1DBInGL907Am0+QmDw7GxBErEtUMsH?= =?us-ascii?q?vKotX1OrkSXPu6zKnPyjXDYPdW1inn5IfUdRAhpOiBULRtesTfzkkvEhnKjlSW?= =?us-ascii?q?qYH9MDOV1/gNs2iG7+V7T+6gl2knqwRprji02sgjkI/JipgRyl/f8yhy3YU7Jc?= =?us-ascii?q?WgRUJlfdKpFIFcuiKaOodsX88vR39ktDwnxrAFpJK2ejUBxo49yB7FcfOHdpCF?= =?us-ascii?q?4hL9W+aVJjd1nHdld6i+hxa26ESg0uP8WtWt3FZEsyZIkcTAumoC1xzU7ciHRf?= =?us-ascii?q?998Vm71TmT0ADT7/lIIUEylaXFN54s2qA8moYXvEjZHSL7mF/6gLKSe0k64OSk?= =?us-ascii?q?9ufqbqj+qp+ZLYB0iwX+Mqo0msy4BOQ1KgoOUHaV+eSyyr3u5kL5QLJNjv05lq?= =?us-ascii?q?nWrorWKtgcpq68GwNVyJos6w6jDze619QVhWIHI0xBeBKGiYjpJl7PLevkDfa/?= =?us-ascii?q?n1uskDBry+rAPr36GJrBNHfDkLD/feU110kJ0wc3zNZC97pIG7oBJ7T1QUa3u9?= =?us-ascii?q?vGXTEjNAnh4evpBp1D34USVHjHObOePbua5V2F6OwxC+aLY4ARtXD2LP1ztK2m?= =?us-ascii?q?tmMwhVJIJfrh5pAQcn3tRvk=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FsAAD+nQtZf7XAVdFcGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBAQMBAQEJAQEBgwGBC4EMtnUFF0McEIV4hE9XAQEBAQEBAQECAQIQAQE?= =?us-ascii?q?JCwsIJjGCMyALBEYnAi8BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA?= =?us-ascii?q?QkCDTdHDRkBATcBgRQBBQE1iFWBSw6kfT+LHYJXOoMJAQEFh1cBAQEBAQUCAR0?= =?us-ascii?q?DBQkBCIQ9ghCBXopKDIMNkB2BBIxJhTOBaIttDYpwhnUCkm0zgRWBJD4uIAgZF?= =?us-ascii?q?YUqDxyCAyA2iQEBAQE?= X-IPAS-Result: =?us-ascii?q?A0FsAAD+nQtZf7XAVdFcGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBgwGBC4EMtnUFF0McEIV4hE9XAQEBAQEBAQECAQIQAQEJCwsIJjGCMyALB?= =?us-ascii?q?EYnAi8BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQkCDTdHDRkBATc?= =?us-ascii?q?BgRQBBQE1iFWBSw6kfT+LHYJXOoMJAQEFh1cBAQEBAQUCAR0DBQkBCIQ9ghCBX?= =?us-ascii?q?opKDIMNkB2BBIxJhTOBaIttDYpwhnUCkm0zgRWBJD4uIAgZFYUqDxyCAyA2iQE?= =?us-ascii?q?BAQE?= X-IronPort-AV: E=Sophos;i="5.38,289,1491264000"; d="scan'208";a="6678141" X-IronPort-Outbreak-Status: No, level 0, Unknown - Unknown Received: from mail-pf0-f181.google.com ([209.85.192.181]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 04 May 2017 21:36:55 +0000 Received: by mail-pf0-f181.google.com with SMTP id q66so13404619pfi.3 for ; Thu, 04 May 2017 14:36:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aLP6hqF0kjpHyPj6qOoCqvr5Zh0eViG/3RzdzTFNOUM=; b=IazdkSkLqghQXEgrbzLnCkYeWXlN7l/ilvAqjSJYwnbE0L9HDVTKwAoBYkaRP4d7Bg KeirhdaviWc3KLmxWJRDBTYRJReLWVledfctYZC524IIwSVkus5pnkV3JmHVRfmg1j53 MIAVFmiZxiI6KgS4pcR27SWl0KrknQvZkdxhmgNEQW6ng86guHsUV/Vb7c9expGqoLxh cZOER12NGhGgCTmAMBSax2/8j9mTDKF+r2OKemQxKI/iWVsPM/5b8xFw0rL8+K4BVqAO wLSkohuQxrsNevIqjAn6a0uDBtmepy1uZ56Qr/u4O0JFAjlqHjTyxbb6/KdbrT5Ru0mf 2Lhw== X-Gm-Message-State: AN3rC/6SbBdWp62+ZP4tdu5kk8j/MM1dCmWmyH7yNkVq5j9Yb+QEg5uj fcZzPwKBSSBzWsJG X-Received: by 10.99.170.2 with SMTP id e2mr47740852pgf.204.1493933813866; Thu, 04 May 2017 14:36:53 -0700 (PDT) Received: from jeffv-z840.mtv.corp.google.com ([172.22.113.21]) by smtp.gmail.com with ESMTPSA id n126sm5260007pgn.32.2017.05.04.14.36.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 May 2017 14:36:53 -0700 (PDT) To: selinux@tycho.nsa.gov Subject: [PATCH] Add attribute expansion options Date: Thu, 4 May 2017 14:36:49 -0700 Message-Id: <20170504213649.29165-1-jeffv@google.com> X-Mailer: git-send-email 2.13.0.rc1.294.g07d810a77f-goog 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: From: Jeff Vander Stoep via Selinux Reply-To: Jeff Vander Stoep Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP This commit adds attribute expansion statements to the policy language allowing compiler defaults to be overridden. Always expands an attribute example: expandattribute { foo } true; CIL example: (expandtypeattribute (foo) true) Never expand an attribute example: expandattribute { bar } false; CIL example: (expandtypeattribute (bar) false) Adding the annotations directly to policy was chosen over other methods as it is consistent with how targeted runtime optimizations are specified in other languages. For example, in C the "inline" command. Motivation expandattribute true: Android has been moving away from a monolithic policy binary to a two part split policy representing the Android platform and the underlying vendor-provided hardware interface. The goal is a stable API allowing these two parts to be updated independently of each other. Attributes provide an important mechanism for compatibility. For example, when the vendor provides a HAL for the platform, permissions needed by clients of the HAL can be granted to an attribute. Clients need only be assigned the attribute and do not need to be aware of the underlying types and permissions being granted. Inheriting permissions via attribute creates a convenient mechanism for independence between vendor and platform policy, but results in the creation of many attributes, and the potential for performance issues when processes are clients of many HALs. [1] Annotating these attributes for expansion at compile time allows us to retain the compatibility benefits of using attributes without the performance costs. [2] expandattribute false: Commit 0be23c3f15fd added the capability to aggresively remove unused attributes. This is generally useful as too many attributes assigned to a type results in lengthy policy look up times when there is a cache miss. However, removing attributes can also result in loss of information used in external tests. On Android, we're considering stripping neverallow rules from on-device policy. This is consistent with the kernel policy binary which also did not contain neverallows. Removing neverallow rules results in a 5-10% decrease in on-device policy build and load and a policy size decrease of ~250k. Neverallow rules are still asserted at build time and during device certification (CTS). If neverallow rules are absent when secilc is run, some attributes are being stripped from policy and neverallow tests in CTS may be violated. [3] This change retains the aggressive attribute stripping behavior but adds an override mechanism to preserve attributes marked as necessary. [1] https://github.com/SELinuxProject/cil/issues/9 [2] Annotating all HAL client attributes for expansion resulted in system_server's dropping from 19 attributes to 8. Because these attributes were not widely applied to other types, the final policy size change was negligible. [3] data_file_type and service_manager_type are stripped from AOSP policy when using secilc's -G option. This impacts 11 neverallow tests in CTS. Test: Build and boot Marlin with all hal_*_client attributes marked for expansion. Verify (using seinfo and sesearch) that permissions are correctly expanded from attributes to types. Test: Mark types being stripped by secilc with "preserve" and verify that they are retained in policy and applied to the same types. Signed-off-by: Jeff Vander Stoep --- checkpolicy/policy_define.c | 82 ++++++++++++++++++++++++++++++ checkpolicy/policy_define.h | 1 + checkpolicy/policy_parse.y | 5 ++ checkpolicy/policy_scan.l | 2 + libsepol/cil/src/cil.c | 15 ++++++ libsepol/cil/src/cil_build_ast.c | 72 ++++++++++++++++++++++++++ libsepol/cil/src/cil_build_ast.h | 2 + libsepol/cil/src/cil_copy_ast.c | 26 ++++++++++ libsepol/cil/src/cil_flavor.h | 1 + libsepol/cil/src/cil_internal.h | 16 ++++-- libsepol/cil/src/cil_post.c | 8 +++ libsepol/cil/src/cil_reset_ast.c | 1 + libsepol/cil/src/cil_resolve_ast.c | 53 ++++++++++++++++++- libsepol/cil/src/cil_tree.c | 11 ++++ libsepol/include/sepol/policydb/policydb.h | 6 ++- libsepol/src/module_to_cil.c | 11 ++++ 16 files changed, 307 insertions(+), 5 deletions(-) diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c index 949ca711..63e3c53f 100644 --- a/checkpolicy/policy_define.c +++ b/checkpolicy/policy_define.c @@ -1139,6 +1139,88 @@ int define_attrib(void) return 0; } +int expand_attrib(void) +{ + char *id; + ebitmap_t attrs; + type_datum_t *attr; + ebitmap_node_t *node; + uint32_t i; + int rc = -1; + int flags = 0; + + if (pass == 1) { + for (i = 0; i < 2; i++) { + while ((id = queue_remove(id_queue))) { + free(id); + } + } + return 0; + } + + ebitmap_init(&attrs); + while ((id = queue_remove(id_queue))) { + if (!id) { + yyerror("No attribute name for expandattribute statement?"); + goto exit; + } + + if (!is_id_in_scope(SYM_TYPES, id)) { + yyerror2("attribute %s is not within scope", id); + goto exit; + } + + attr = hashtab_search(policydbp->p_types.table, id); + if (!attr) { + yyerror2("attribute %s is not declared", id); + goto exit; + } + + if (attr->flavor != TYPE_ATTRIB) { + yyerror2("%s is a type, not an attribute", id); + goto exit; + } + + if (attr->flags & TYPE_FLAGS_EXPAND_ATTR) { + yyerror2("%s already has the expandattribute option specified", id); + goto exit; + } + if (ebitmap_set_bit(&attrs, attr->s.value - 1, TRUE)) { + yyerror("Out of memory!"); + goto exit; + } + + free(id); + } + + id = (char *) queue_remove(id_queue); + if (!id) { + yyerror("No option specified for attribute expansion."); + goto exit; + } + + if (!strcmp(id, "T")) { + flags = TYPE_FLAGS_EXPAND_ATTR_TRUE; + } else { + flags = TYPE_FLAGS_EXPAND_ATTR_FALSE; + } + + ebitmap_for_each_bit(&attrs, node, i) { + if (!ebitmap_node_get_bit(node, i)){ + continue; + } + attr = hashtab_search(policydbp->p_types.table, + policydbp->sym_val_to_name[SYM_TYPES][i]); + attr->flags |= flags; + } + + rc = 0; +exit: + ebitmap_destroy(&attrs); + free(id); + return rc; +} + static int add_aliases_to_type(type_datum_t * type) { char *id; diff --git a/checkpolicy/policy_define.h b/checkpolicy/policy_define.h index 964baae0..9f4b6d0d 100644 --- a/checkpolicy/policy_define.h +++ b/checkpolicy/policy_define.h @@ -65,6 +65,7 @@ int define_typebounds(void); int define_type(int alias); int define_user(void); int define_validatetrans(constraint_expr_t *expr); +int expand_attrib(void); int insert_id(const char *id,int push); int insert_separator(int push); role_datum_t *define_role_dom(role_datum_t *r); diff --git a/checkpolicy/policy_parse.y b/checkpolicy/policy_parse.y index 3b6a2f86..1ac1c96b 100644 --- a/checkpolicy/policy_parse.y +++ b/checkpolicy/policy_parse.y @@ -103,6 +103,7 @@ typedef int (* require_func_t)(int pass); %token TYPES %token ALIAS %token ATTRIBUTE +%token EXPANDATTRIBUTE %token BOOL %token TUNABLE %token IF @@ -314,6 +315,7 @@ rbac_decl : attribute_role_def | role_attr_def ; te_decl : attribute_def + | expandattribute_def | type_def | typealias_def | typeattribute_def @@ -328,6 +330,9 @@ te_decl : attribute_def attribute_def : ATTRIBUTE identifier ';' { if (define_attrib()) return -1;} ; +expandattribute_def : EXPANDATTRIBUTE names bool_val ';' + { if (expand_attrib()) return -1;} + ; type_def : TYPE identifier alias_def opt_attr_list ';' {if (define_type(1)) return -1;} | TYPE identifier opt_attr_list ';' diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l index 2f7f2216..028bd25e 100644 --- a/checkpolicy/policy_scan.l +++ b/checkpolicy/policy_scan.l @@ -106,6 +106,8 @@ ALIAS | alias { return(ALIAS); } ATTRIBUTE | attribute { return(ATTRIBUTE); } +EXPANDATTRIBUTE | +expandattribute { return(EXPANDATTRIBUTE); } TYPE_TRANSITION | type_transition { return(TYPE_TRANSITION); } TYPE_MEMBER | diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c index a64c5284..9b9ccc36 100644 --- a/libsepol/cil/src/cil.c +++ b/libsepol/cil/src/cil.c @@ -159,6 +159,7 @@ static void cil_init_keys(void) CIL_KEY_SELINUXUSERDEFAULT = cil_strpool_add("selinuxuserdefault"); CIL_KEY_TYPEATTRIBUTE = cil_strpool_add("typeattribute"); CIL_KEY_TYPEATTRIBUTESET = cil_strpool_add("typeattributeset"); + CIL_KEY_EXPANDTYPEATTRIBUTE = cil_strpool_add("expandtypeattribute"); CIL_KEY_TYPEALIAS = cil_strpool_add("typealias"); CIL_KEY_TYPEALIASACTUAL = cil_strpool_add("typealiasactual"); CIL_KEY_TYPEBOUNDS = cil_strpool_add("typebounds"); @@ -623,6 +624,9 @@ void cil_destroy_data(void **data, enum cil_flavor flavor) case CIL_TYPEATTRIBUTESET: cil_destroy_typeattributeset(*data); break; + case CIL_EXPANDTYPEATTRIBUTE: + cil_destroy_expandtypeattribute(*data); + break; case CIL_TYPEALIASACTUAL: cil_destroy_aliasactual(*data); break; @@ -987,6 +991,8 @@ const char * cil_node_to_string(struct cil_tree_node *node) return CIL_KEY_TYPEALIAS; case CIL_TYPEATTRIBUTESET: return CIL_KEY_TYPEATTRIBUTESET; + case CIL_EXPANDTYPEATTRIBUTE: + return CIL_KEY_EXPANDTYPEATTRIBUTE; case CIL_TYPEALIASACTUAL: return CIL_KEY_TYPEALIASACTUAL; case CIL_TYPEBOUNDS: @@ -2038,6 +2044,15 @@ void cil_typeattributeset_init(struct cil_typeattributeset **attrset) (*attrset)->datum_expr = NULL; } +void cil_expandtypeattribute_init(struct cil_expandtypeattribute **expandattr) +{ + *expandattr = cil_malloc(sizeof(**expandattr)); + + (*expandattr)->attr_strs = NULL; + (*expandattr)->attr_datums = NULL; + (*expandattr)->expand = 0; +} + void cil_alias_init(struct cil_alias **alias) { *alias = cil_malloc(sizeof(**alias)); diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c index 4b03dc35..36cc6735 100644 --- a/libsepol/cil/src/cil_build_ast.c +++ b/libsepol/cil/src/cil_build_ast.c @@ -3176,6 +3176,75 @@ void cil_destroy_typeattributeset(struct cil_typeattributeset *attrset) free(attrset); } +int cil_gen_expandtypeattribute(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node) +{ + enum cil_syntax syntax[] = { + CIL_SYN_STRING, + CIL_SYN_STRING | CIL_SYN_LIST, + CIL_SYN_STRING, + CIL_SYN_END + }; + char *expand_str; + int syntax_len = sizeof(syntax)/sizeof(*syntax); + struct cil_expandtypeattribute *expandattr = NULL; + int rc = SEPOL_ERR; + + if (db == NULL || parse_current == NULL || ast_node == NULL) { + goto exit; + } + + rc = __cil_verify_syntax(parse_current, syntax, syntax_len); + if (rc != SEPOL_OK) { + goto exit; + } + + cil_expandtypeattribute_init(&expandattr); + + if (parse_current->next->cl_head == NULL) { + cil_list_init(&expandattr->attr_strs, CIL_TYPE); + cil_list_append(expandattr->attr_strs, CIL_STRING, parse_current->next->data); + } else { + rc = cil_fill_list(parse_current->next->cl_head, CIL_TYPE, &expandattr->attr_strs); + if (rc != SEPOL_OK) { + goto exit; + } + } + + expand_str = parse_current->next->next->data; + + if (expand_str == CIL_KEY_CONDTRUE) { + expandattr->expand = CIL_TRUE; + } else if (expand_str == CIL_KEY_CONDFALSE) { + expandattr->expand = CIL_FALSE; + } else { + cil_log(CIL_ERR, "Value must be either \'true\' or \'false\'"); + goto exit; + } + + ast_node->data = expandattr; + ast_node->flavor = CIL_EXPANDTYPEATTRIBUTE; + + return SEPOL_OK; + +exit: + cil_tree_log(parse_current, CIL_ERR, "Bad expandtypeattribute statement"); + cil_destroy_expandtypeattribute(expandattr); + return rc; +} + +void cil_destroy_expandtypeattribute(struct cil_expandtypeattribute *expandattr) +{ + if (expandattr == NULL) { + return; + } + + cil_list_destroy(&expandattr->attr_strs, CIL_TRUE); + + cil_list_destroy(&expandattr->attr_datums, CIL_FALSE); + + free(expandattr); +} + int cil_gen_typepermissive(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node) { enum cil_syntax syntax[] = { @@ -6013,6 +6082,9 @@ int __cil_build_ast_node_helper(struct cil_tree_node *parse_current, uint32_t *f } else if (parse_current->data == CIL_KEY_TYPEATTRIBUTESET) { rc = cil_gen_typeattributeset(db, parse_current, ast_node); *finished = CIL_TREE_SKIP_NEXT; + } else if (parse_current->data == CIL_KEY_EXPANDTYPEATTRIBUTE) { + rc = cil_gen_expandtypeattribute(db, parse_current, ast_node); + *finished = CIL_TREE_SKIP_NEXT; } else if (parse_current->data == CIL_KEY_TYPEALIAS) { rc = cil_gen_alias(db, parse_current, ast_node, CIL_TYPEALIAS); } else if (parse_current->data == CIL_KEY_TYPEALIASACTUAL) { diff --git a/libsepol/cil/src/cil_build_ast.h b/libsepol/cil/src/cil_build_ast.h index 54662035..33bae997 100644 --- a/libsepol/cil/src/cil_build_ast.h +++ b/libsepol/cil/src/cil_build_ast.h @@ -138,6 +138,8 @@ int cil_gen_aliasactual(struct cil_db *db, struct cil_tree_node *parse_current, void cil_destroy_aliasactual(struct cil_aliasactual *aliasactual); int cil_gen_typeattributeset(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node); void cil_destroy_typeattributeset(struct cil_typeattributeset *attrtypes); +int cil_gen_expandtypeattribute(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node); +void cil_destroy_expandtypeattribute(struct cil_expandtypeattribute *expandattr); int cil_gen_typebounds(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node); int cil_gen_typepermissive(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node); void cil_destroy_typepermissive(struct cil_typepermissive *typeperm); diff --git a/libsepol/cil/src/cil_copy_ast.c b/libsepol/cil/src/cil_copy_ast.c index 2d085dd7..d6685050 100644 --- a/libsepol/cil/src/cil_copy_ast.c +++ b/libsepol/cil/src/cil_copy_ast.c @@ -648,6 +648,29 @@ int cil_copy_typeattributeset(struct cil_db *db, void *data, void **copy, __attr return SEPOL_OK; } +int cil_copy_expandtypeattribute(__attribute__((unused)) struct cil_db *db, void *data, void **copy, __attribute__((unused)) symtab_t *symtab) +{ + struct cil_expandtypeattribute *orig = data; + struct cil_expandtypeattribute *new = NULL; + + fprintf(stderr, "%s %u\n", __func__, __LINE__); + cil_expandtypeattribute_init(&new); + + if (orig->attr_strs != NULL) { + cil_copy_list(orig->attr_strs, &new->attr_strs); + } + + if (orig->attr_datums != NULL) { + cil_copy_list(orig->attr_datums, &new->attr_datums); + } + + new->expand = orig->expand; + + *copy = new; + + return SEPOL_OK; +} + int cil_copy_alias(__attribute__((unused)) struct cil_db *db, void *data, void **copy, symtab_t *symtab) { struct cil_alias *orig = data; @@ -1808,6 +1831,9 @@ int __cil_copy_node_helper(struct cil_tree_node *orig, __attribute__((unused)) u case CIL_TYPEATTRIBUTESET: copy_func = &cil_copy_typeattributeset; break; + case CIL_EXPANDTYPEATTRIBUTE: + copy_func = &cil_copy_expandtypeattribute; + break; case CIL_TYPEALIAS: copy_func = &cil_copy_alias; break; diff --git a/libsepol/cil/src/cil_flavor.h b/libsepol/cil/src/cil_flavor.h index cd08b972..c01f967a 100644 --- a/libsepol/cil/src/cil_flavor.h +++ b/libsepol/cil/src/cil_flavor.h @@ -73,6 +73,7 @@ enum cil_flavor { CIL_ROLETYPE, CIL_ROLEBOUNDS, CIL_TYPEATTRIBUTESET, + CIL_EXPANDTYPEATTRIBUTE, CIL_TYPEALIASACTUAL, CIL_TYPEBOUNDS, CIL_TYPEPERMISSIVE, diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h index efa2cd6e..aee3f00c 100644 --- a/libsepol/cil/src/cil_internal.h +++ b/libsepol/cil/src/cil_internal.h @@ -174,6 +174,7 @@ char *CIL_KEY_SELINUXUSER; char *CIL_KEY_SELINUXUSERDEFAULT; char *CIL_KEY_TYPEATTRIBUTE; char *CIL_KEY_TYPEATTRIBUTESET; +char *CIL_KEY_EXPANDTYPEATTRIBUTE; char *CIL_KEY_TYPEALIAS; char *CIL_KEY_TYPEALIASACTUAL; char *CIL_KEY_TYPEBOUNDS; @@ -515,9 +516,11 @@ struct cil_type { int value; }; -#define CIL_ATTR_AVRULE 0x01 -#define CIL_ATTR_NEVERALLOW 0x02 -#define CIL_ATTR_CONSTRAINT 0x04 +#define CIL_ATTR_AVRULE (1 << 0) +#define CIL_ATTR_NEVERALLOW (1 << 1) +#define CIL_ATTR_CONSTRAINT (1 << 2) +#define CIL_ATTR_EXPAND_TRUE (1 << 3) +#define CIL_ATTR_EXPAND_FALSE (1 << 4) struct cil_typeattribute { struct cil_symtab_datum datum; struct cil_list *expr_list; @@ -531,6 +534,12 @@ struct cil_typeattributeset { struct cil_list *datum_expr; }; +struct cil_expandtypeattribute { + struct cil_list *attr_strs; + struct cil_list *attr_datums; + int expand; +}; + struct cil_typepermissive { char *type_str; void *type; /* type or alias */ @@ -977,6 +986,7 @@ void cil_roleattributeset_init(struct cil_roleattributeset **attrset); void cil_roletype_init(struct cil_roletype **roletype); void cil_typeattribute_init(struct cil_typeattribute **attribute); void cil_typeattributeset_init(struct cil_typeattributeset **attrset); +void cil_expandtypeattribute_init(struct cil_expandtypeattribute **expandattr); void cil_alias_init(struct cil_alias **alias); void cil_aliasactual_init(struct cil_aliasactual **aliasactual); void cil_typepermissive_init(struct cil_typepermissive **typeperm); diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c index e32a8fc9..1941fab3 100644 --- a/libsepol/cil/src/cil_post.c +++ b/libsepol/cil/src/cil_post.c @@ -1194,6 +1194,14 @@ static int cil_typeattribute_used(struct cil_typeattribute *attr, struct cil_db return CIL_FALSE; } + if (attr->used & CIL_ATTR_EXPAND_FALSE) { + return CIL_TRUE; + } + + if (attr->used & CIL_ATTR_EXPAND_TRUE) { + return CIL_FALSE; + } + if (attr->used & CIL_ATTR_CONSTRAINT) { return CIL_TRUE; } diff --git a/libsepol/cil/src/cil_reset_ast.c b/libsepol/cil/src/cil_reset_ast.c index de00679e..676e156e 100644 --- a/libsepol/cil/src/cil_reset_ast.c +++ b/libsepol/cil/src/cil_reset_ast.c @@ -549,6 +549,7 @@ int __cil_reset_node(struct cil_tree_node *node, __attribute__((unused)) uint32 case CIL_CLASSORDER: case CIL_CATORDER: case CIL_SENSITIVITYORDER: + case CIL_EXPANDTYPEATTRIBUTE: break; /* Nothing to reset */ default: break; diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c index 6da44ba1..8925b271 100644 --- a/libsepol/cil/src/cil_resolve_ast.c +++ b/libsepol/cil/src/cil_resolve_ast.c @@ -271,14 +271,24 @@ exit: int cil_type_used(struct cil_symtab_datum *datum, int used) { + int rc = SEPOL_ERR; struct cil_typeattribute *attr = NULL; if (FLAVOR(datum) == CIL_TYPEATTRIBUTE) { attr = (struct cil_typeattribute*)datum; attr->used |= used; + if ((attr->used & CIL_ATTR_EXPAND_TRUE) && + (attr->used & CIL_ATTR_EXPAND_FALSE)) { + cil_log(CIL_ERR, "Conflicting use of expandtypeattribute. " + "Expandtypeattribute may be set to true or false " + "but not both. \n"); + goto exit; + } } - return 0; + return SEPOL_OK; +exit: + return rc; } int cil_resolve_permissionx(struct cil_tree_node *current, struct cil_permissionx *permx, void *extra_args) @@ -453,6 +463,44 @@ exit: return rc; } +int cil_resolve_expandtypeattribute(struct cil_tree_node *current, void *extra_args) +{ + struct cil_expandtypeattribute *expandattr = current->data; + struct cil_symtab_datum *attr_datum = NULL; + struct cil_tree_node *attr_node = NULL; + struct cil_list_item *curr; + int used; + int rc = SEPOL_ERR; + + cil_list_init(&expandattr->attr_datums, CIL_TYPE); + + cil_list_for_each(curr, expandattr->attr_strs) { + rc = cil_resolve_name(current, (char *)curr->data, CIL_SYM_TYPES, extra_args, &attr_datum); + if (rc != SEPOL_OK) { + goto exit; + } + + attr_node = attr_datum->nodes->head->data; + + if (attr_node->flavor != CIL_TYPEATTRIBUTE) { + rc = SEPOL_ERR; + cil_log(CIL_ERR, "Attribute type not an attribute\n"); + goto exit; + } + used = expandattr->expand ? CIL_ATTR_EXPAND_TRUE : CIL_ATTR_EXPAND_FALSE; + rc = cil_type_used(attr_datum, used); + if (rc != SEPOL_OK) { + goto exit; + } + + cil_list_append(expandattr->attr_datums, CIL_TYPE, attr_datum); + } + + return SEPOL_OK; +exit: + return rc; +} + int cil_resolve_aliasactual(struct cil_tree_node *current, void *extra_args, enum cil_flavor flavor, enum cil_flavor alias_flavor) { int rc = SEPOL_ERR; @@ -3432,6 +3480,9 @@ int __cil_resolve_ast_node(struct cil_tree_node *node, void *extra_args) case CIL_TYPEATTRIBUTESET: rc = cil_resolve_typeattributeset(node, args); break; + case CIL_EXPANDTYPEATTRIBUTE: + rc = cil_resolve_expandtypeattribute(node, args); + break; case CIL_TYPEBOUNDS: rc = cil_resolve_bounds(node, args, CIL_TYPE, CIL_TYPEATTRIBUTE); break; diff --git a/libsepol/cil/src/cil_tree.c b/libsepol/cil/src/cil_tree.c index 9ff9d4b4..2cc2744a 100644 --- a/libsepol/cil/src/cil_tree.c +++ b/libsepol/cil/src/cil_tree.c @@ -703,6 +703,17 @@ void cil_tree_print_node(struct cil_tree_node *node) cil_log(CIL_INFO, "TYPE: %s\n", type->datum.name); return; } + case CIL_EXPANDTYPEATTRIBUTE: { + struct cil_expandtypeattribute *attr = node->data; + + fprintf(stderr, "%s %u\n", __func__, __LINE__); + cil_log(CIL_INFO, "(EXPANDTYPEATTRIBUTE "); + cil_tree_print_expr(attr->attr_datums, attr->attr_strs); + cil_log(CIL_INFO, "%s)\n",attr->expand ? + CIL_KEY_CONDTRUE : CIL_KEY_CONDFALSE); + + return; + } case CIL_TYPEATTRIBUTESET: { struct cil_typeattributeset *attr = node->data; diff --git a/libsepol/include/sepol/policydb/policydb.h b/libsepol/include/sepol/policydb/policydb.h index 4336a3f2..37e0c9e5 100644 --- a/libsepol/include/sepol/policydb/policydb.h +++ b/libsepol/include/sepol/policydb/policydb.h @@ -178,7 +178,11 @@ typedef struct type_datum { #define TYPE_ALIAS 2 /* alias in modular policy */ uint32_t flavor; ebitmap_t types; /* types with this attribute */ -#define TYPE_FLAGS_PERMISSIVE 0x01 +#define TYPE_FLAGS_PERMISSIVE (1 << 0) +#define TYPE_FLAGS_EXPAND_ATTR_TRUE (1 << 1) +#define TYPE_FLAGS_EXPAND_ATTR_FALSE (1 << 2) +#define TYPE_FLAGS_EXPAND_ATTR (TYPE_FLAGS_EXPAND_ATTR_TRUE | \ + TYPE_FLAGS_EXPAND_ATTR_FALSE) uint32_t flags; uint32_t bounds; /* bounds type, if exist */ } type_datum_t; diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c index ac095c30..7d8eb204 100644 --- a/libsepol/src/module_to_cil.c +++ b/libsepol/src/module_to_cil.c @@ -2244,6 +2244,17 @@ static int type_to_cil(int indent, struct policydb *pdb, struct avrule_block *UN cil_println(indent, "(typeattribute %s)", key); } + if (type->flags & TYPE_FLAGS_EXPAND_ATTR) { + cil_indent(indent); + cil_printf("(expandtypeattribute (%s) ", key); + if (type->flags & TYPE_FLAGS_EXPAND_ATTR_TRUE) { + cil_printf("true"); + } else if (type->flags & TYPE_FLAGS_EXPAND_ATTR_FALSE) { + cil_printf("false"); + } + cil_printf(")\n"); + } + if (ebitmap_cardinality(&type->types) > 0) { cil_indent(indent); cil_printf("(typeattributeset %s (", key);