From patchwork Thu Sep 29 11:39:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janis Danisevskis X-Patchwork-Id: 9356385 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 49D16600C8 for ; Thu, 29 Sep 2016 11:45:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3808229970 for ; Thu, 29 Sep 2016 11:45:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2814A29973; Thu, 29 Sep 2016 11:45:52 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (smtp.nsa.gov [8.44.101.8]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EC8029970 for ; Thu, 29 Sep 2016 11:45:49 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,414,1470700800"; d="scan'208";a="18091267" IronPort-PHdr: =?us-ascii?q?9a23=3Adq9I4xPCjOGU49WP5mUl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0Kfj5rarrMEGX3/hxlliBBdydsKMezbOH+Py4EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkIt?= =?us-ascii?q?f6KuS9SU1pX8i7j60qaQSj0AvCC6b7J2IUf+hiTqne5Sv7FfLL0swADCuHpCdr?= =?us-ascii?q?ce72ppIVWOg0S0vZ/or9Ze6SAYh9YNv44FCP27LJIDSqZEATgcPms0/Jej9UWb?= =?us-ascii?q?DFjH2nxJSWgSkxxVEyDZ/Rr6WdH3qSK8ue1jnGGBMMTwQaozWDjn66ZwVDf0mS?= =?us-ascii?q?wHMHg/62iRhctuyOpArAmJuw10w4mSZpqccvV5YOeVf8wRTHBdBO5NRidBBcW6?= =?us-ascii?q?dIJJAO0fbshCqIyohVIIrAD2KQCqBfji1CRLh2S+ia822uIgCinP2gA6GNMC9n?= =?us-ascii?q?/TqYOmZ+8pTempwfyQnn34ZPRM1GKmsIU=3D?= X-IPAS-Result: =?us-ascii?q?A2FmBABP/uxX/wHyM5BdGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxQBAQEBAR6BU7pMJYdmTAEBAQEBAQEBAgECWyeCMgQDAxUFORBVAg1fAgEDA?= =?us-ascii?q?QIPKAYBAQwgCwECAwkBARcpCAgDAS0DAQUBCxEHBwsFGAQBiCsEogeBMj4yila?= =?us-ascii?q?FMAEBBYEBhyIBAQEHAQEBARsIEIQXghCIaxEBhXoBmXuPcolYJYVvjycxgRFUg?= =?us-ascii?q?w8OHIFRcYUmeIEoAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 29 Sep 2016 11:45:47 +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 u8TBjdSK026898; Thu, 29 Sep 2016 07:45:41 -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 u8TBeClX019160 for ; Thu, 29 Sep 2016 07:40:12 -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 u8TBeAUx026602 for ; Thu, 29 Sep 2016 07:40:11 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1B2AQBH/exXfylSfUpdHAEBBAEBCgEBgz8BAQEBAYFxtkOEFYYeAoFfTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ9RNAEFARwHEiKIKwSiBYEyPjKKVoUwAQEFgQGHIgEBAQEBAQQCARwIEIQXghCLZQuDB5l8j3KJWIYUjycxgRGDYw4cgVFxh0YBAQE X-IPAS-Result: A1B2AQBH/exXfylSfUpdHAEBBAEBCgEBgz8BAQEBAYFxtkOEFYYeAoFfTAECAQEBAQECEwEBCQsLCReFEwIBAxIuAQE3AQ9RNAEFARwHEiKIKwSiBYEyPjKKVoUwAQEFgQGHIgEBAQEBAQQCARwIEIQXghCLZQuDB5l8j3KJWIYUjycxgRGDYw4cgVFxh0YBAQE X-IronPort-AV: E=Sophos;i="5.30,414,1470715200"; d="scan'208";a="5735898" 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; 29 Sep 2016 07:39:53 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A2Qht/B0Gq/7Tl9SBsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?sekUIvad9pjvdHbS+e9qxAeQG96KsbQd2qGN7OjJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMz?= =?us-ascii?q?fbWvXNeDxJ/on8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM8?= =?us-ascii?q?5fxGdvOE7B102kvpT4yqVk6Thdt8gs/M9YC+26I/x5HvRkC2E9PmQ04tD7nQXS?= =?us-ascii?q?RguIoH0HWyMZlQQMSxPI5Rf2RJDwvm7+t/Fh8DWLNs3xC7YvUHKt6LkvAATkkw?= =?us-ascii?q?8bJjU59yfRkcU2g6VF5FqjuBd22ZKOSJ2EP/p5OKXGdJUVQnQScNxWUnljC4W9?= =?us-ascii?q?dMMjBuwAJutGtIr8vBNarxe3Awi3LOrpxiVPh3Ow1qo/hbdyWTra1RAtSopd+E?= =?us-ascii?q?/fq8/4YftKXA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FZAQD4/OxXfylSfUpdHAEFAQsBGAEBB?= =?us-ascii?q?AEBCgEBgxQBAQEBAYFxtkOEFYYeAoFfTAEBAQEBAQEBAgECEAEBCQsLCRcxgjI?= =?us-ascii?q?KGjkQVQINXwIBAxIuAQE3AQ9RNAEFARwHEiKIKwSiBoEyPjKKVoUwAQEFgQGHI?= =?us-ascii?q?wEBAQEBAQQCARwIEIQXghCLZQuDB5l8j3KJWIYUjycxgRGDcRyBUXGHRgEBAQ?= X-IPAS-Result: =?us-ascii?q?A0FZAQD4/OxXfylSfUpdHAEFAQsBGAEBBAEBCgEBgxQBAQE?= =?us-ascii?q?BAYFxtkOEFYYeAoFfTAEBAQEBAQEBAgECEAEBCQsLCRcxgjIKGjkQVQINXwIBA?= =?us-ascii?q?xIuAQE3AQ9RNAEFARwHEiKIKwSiBoEyPjKKVoUwAQEFgQGHIwEBAQEBAQQCARw?= =?us-ascii?q?IEIQXghCLZQuDB5l8j3KJWIYUjycxgRGDcRyBUXGHRgEBAQ?= X-IronPort-AV: E=Sophos;i="5.30,414,1470700800"; d="scan'208";a="18091078" Received: from mail-wm0-f41.google.com ([74.125.82.41]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 29 Sep 2016 11:39:28 +0000 Received: by mail-wm0-f41.google.com with SMTP id b4so22267912wmb.0 for ; Thu, 29 Sep 2016 04:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20120917; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=84ZkGcHnNjgHz6Nwf7Z1v5yqmV44xitxx6WoNrRtJ/Q=; b=lO/J0tvX92zn2lHIh2xAqeynBt0DLgDt9HB63VxH50z0/6JPyMMjMbT7qEmKzShE8I TKyoYuk04cPCk7qMBAgG2mS1WKvXh1Hb0wz2rL4c6+DpvVPpxLXpqLZLtoEzz41UXSFo UswSndzHBctGtivaWI96JOLGhoan5OS61KRP+S6GIMLMuNTv/yu1cqKRMup7gML0sig3 BlZc0ux5ijnScQ5S2ttCrFxKSfif/Uvu79ccr/IgUlJP5jRBf54bsqRUdWVR0z40o9Mb vmDCqnbJqniu+kNdu9HBu8rcHnq1/LnEcgnttiSk9+MYJ5jzc6sGmIkwn8S6OFE9sJWY pwrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=84ZkGcHnNjgHz6Nwf7Z1v5yqmV44xitxx6WoNrRtJ/Q=; b=IssBTYcs7nEMVKNDwR3sNhtOU2JtcMQTdYsr84hkDmwEJ71feP/PP1BVdJZDaQGSwp YGPfFFv4pBtTzYk7+P4/wOJSDxRdjRY93XwZkFQph3fS3DpEvVrLEq9evgdTrBsgRgDN PYtdbs3rgrD7ZXQMXV0GZUjMJ5j0fo2HdMBqqzKqXM6/y7bDrHrR+mQYAU+W1Q+pypQI XZy4sMpCA7z24oDJ23eA2Hw4PhSMz//uKoZ18bq41QucRSrrucU38SirHDNr0mVKflQU NJ4/MEFpafhlgeFvJj9EAYAvWTP3MdZBZSxvhlHH2OdFVyqjXw8j8P+OuU/WKS0f/ynN MUNQ== X-Gm-Message-State: AA6/9RkCVucoBvBLkJcto+PdRUHlh60hAtVwaivZeRrYMHIAqRFaV5ZvoIMRoKga8OPg0Q== X-Received: by 10.28.223.67 with SMTP id w64mr2274350wmg.84.1475149166813; Thu, 29 Sep 2016 04:39:26 -0700 (PDT) Received: from localhost.localdomain (cpc8-nmal18-2-0-cust977.croy.cable.virginm.net. [94.174.27.210]) by smtp.gmail.com with ESMTPSA id rk14sm13660190wjb.6.2016.09.29.04.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Sep 2016 04:39:26 -0700 (PDT) From: Janis Danisevskis To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov, sds@tycho.nsa.gov, jwcart2@tycho.nsa.gov Subject: [PATCH 3/3] libselinux: makes android label back ends configurable Date: Thu, 29 Sep 2016 12:39:19 +0100 Message-Id: <1475149159-21757-3-git-send-email-jdanis@android.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475149159-21757-1-git-send-email-jdanis@android.com> References: <1475149159-21757-1-git-send-email-jdanis@android.com> 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: Cc: Janis Danisevskis MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Android label back ends are not configurable by NO_ANDROID_BACKEND, which is set if on ANDROID_HOST != y. Signed-off-by: Janis Danisevskis --- libselinux/src/Makefile | 3 +++ libselinux/src/label.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile index cba8383..7169230 100644 --- a/libselinux/src/Makefile +++ b/libselinux/src/Makefile @@ -87,6 +87,9 @@ DISABLE_FLAGS+= -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \ SRCS= callbacks.c freecon.c label.c label_file.c \ label_backends_android.c regex.c label_support.c \ matchpathcon.c setrans_client.c sha1.c +else +DISABLE_FLAGS+= -DNO_ANDROID_BACKEND +SRCS:= $(filter-out label_backends_android.c, $(SRCS)) endif SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(DISABLE_FLAGS) diff --git a/libselinux/src/label.c b/libselinux/src/label.c index eb0e766..60639cf 100644 --- a/libselinux/src/label.c +++ b/libselinux/src/label.c @@ -35,6 +35,12 @@ #define CONFIG_DB_BACKEND(fnptr) &fnptr #endif +#ifdef NO_ANDROID_BACKEND +#define CONFIG_ANDROID_BACKEND(fnptr) NULL +#else +#define CONFIG_ANDROID_BACKEND(fnptr) (&(fnptr)) +#endif + typedef int (*selabel_initfunc)(struct selabel_handle *rec, const struct selinux_opt *opts, unsigned nopts); @@ -44,8 +50,8 @@ static selabel_initfunc initfuncs[] = { CONFIG_MEDIA_BACKEND(selabel_media_init), CONFIG_X_BACKEND(selabel_x_init), CONFIG_DB_BACKEND(selabel_db_init), - &selabel_property_init, - &selabel_service_init, + CONFIG_ANDROID_BACKEND(selabel_property_init), + CONFIG_ANDROID_BACKEND(selabel_service_init), }; static void selabel_subs_fini(struct selabel_sub *ptr)