From patchwork Mon Sep 30 10:48:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11166515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C2461709 for ; Mon, 30 Sep 2019 10:48:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B831216F4 for ; Mon, 30 Sep 2019 10:48:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SZyWzRmM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730629AbfI3Ks7 (ORCPT ); Mon, 30 Sep 2019 06:48:59 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:60911 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730819AbfI3Ks6 (ORCPT ); Mon, 30 Sep 2019 06:48:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569840537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mQEWCI4zrRbNDLydgsD/oUtWE4aVLGVSgvae4a4jNFM=; b=SZyWzRmMKhQKvDtjYPmO5+1P0MaVX4DG+rfMTmE0S1Jjl9u4tw/sUBMPuq7WuAxNx+f4fF 34abVVIrITXOFjD9Lmt1EycBid4SNLLDTeJhpqLgCWwmbeqH/X60idy44hqorkF/hqBLSe r4cH/BVlGfHUANPAkEs4pSpZ3uDbgIY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-7-gX3WbtM72JJlJk0SBZ-w-1; Mon, 30 Sep 2019 06:48:56 -0400 Received: by mail-wm1-f70.google.com with SMTP id z205so5753381wmb.7 for ; Mon, 30 Sep 2019 03:48:56 -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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3SwD3Kkv8vnB+IDCfPWJogQpWTS/cY3Ka0V1TrAc0g0=; b=fhNIlh/WJvpJjgPQiSUYR8ICgRuiTIBsEI+iXzj4Filpn+XXoSm4SKJmbpsZdZt9dt d+LWSifiqfI7ALLywdLuZlM7zUptb4XPdAQxuY66klTly/c5aek1EVU8oNfENV2SYRJ8 EtWDZkrY+YnWgYWSnqdvPWKAeTyQx+oHcNO9pxQV5DMshwuPvniJGOl/YAO8ONI1gOaj xxVAcLwq53khXxvKUy5ajQzOfit+OmTnz+oXDf3QmzHSchbiHp8Ee+xygZzl7q8Mannw LftwUQvwOmzrEipExmWUuXXE9BQArW8LmCr+eTY2hjd01Wpo0QbSPbufsPqTWS9ZdRDJ agVg== X-Gm-Message-State: APjAAAURx/DZ6EF9k6Ffxdm5z0ukjVN8bcjSD1toj+8cUb4UuvkHQ/Ut +s9VIi4oIVUphKk4egkaw8oKGTMHjm16WDhTvRlSxeniNvkfipFLUeF15xSo0gw78eQFMIE4iws z0hrrNtZizMf4AzdgiA== X-Received: by 2002:a7b:c404:: with SMTP id k4mr18023678wmi.90.1569840535086; Mon, 30 Sep 2019 03:48:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzur8udK5NuQSzjltPIWuL+vA/yt/7StoOU1vwDncjIy43oWFsV/PCod3zUOPK42jPBaDtv6A== X-Received: by 2002:a7b:c404:: with SMTP id k4mr18023663wmi.90.1569840534862; Mon, 30 Sep 2019 03:48:54 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i73sm27081254wmg.33.2019.09.30.03.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 03:48:53 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH testsuite 1/3] policy: consolidate macros for home dirs access Date: Mon, 30 Sep 2019 12:48:48 +0200 Message-Id: <20190930104850.5482-2-omosnace@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930104850.5482-1-omosnace@redhat.com> References: <20190930104850.5482-1-omosnace@redhat.com> MIME-Version: 1.0 X-MC-Unique: 7-gX3WbtM72JJlJk0SBZ-w-1 X-Mimecast-Spam-Score: 0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Use userdom_search_generic_user_home_dirs(), which is always defined, and redefine it to match what overlayfs was doing (just in case), Signed-off-by: Ondrej Mosnacek --- policy/test_overlayfs.te | 6 ++---- policy/test_policy.if | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/policy/test_overlayfs.te b/policy/test_overlayfs.te index 6f1756e..f56ef78 100644 --- a/policy/test_overlayfs.te +++ b/policy/test_overlayfs.te @@ -50,8 +50,7 @@ fs_mount_xattr_fs(test_overlay_mounter_t) corecmd_shell_entry_type(test_overlay_mounter_t) corecmd_exec_bin(test_overlay_mounter_t) -userdom_search_admin_dir(test_overlay_mounter_t) -userdom_search_user_home_content(test_overlay_mounter_t) +userdom_search_generic_user_home_dirs(test_overlay_mounter_t) mount_exec(test_overlay_mounter_t) mount_rw_pid_files(test_overlay_mounter_t) @@ -122,8 +121,7 @@ corecmd_exec_bin(test_overlay_client_t) kernel_read_system_state(test_overlay_client_t) kernel_read_proc_symlinks(test_overlay_client_t) -userdom_search_admin_dir(test_overlay_client_t) -userdom_search_user_home_content(test_overlay_client_t) +userdom_search_generic_user_home_dirs(test_overlay_client_t) fs_getattr_xattr_fs(test_overlay_client_t) diff --git a/policy/test_policy.if b/policy/test_policy.if index 5f4000f..40e7499 100644 --- a/policy/test_policy.if +++ b/policy/test_policy.if @@ -61,8 +61,13 @@ interface(`userdom_sysadm_entry_spec_domtrans_to',` ') ') -ifdef(`userdom_search_generic_user_home_dirs', `', ` dnl +ifdef(`userdom_search_admin_dir', ` dnl interface(`userdom_search_generic_user_home_dirs', ` - userdom_search_user_home_dirs($1) + userdom_search_user_home_content($1) + userdom_search_admin_dir($1) +') +', ` dnl +interface(`userdom_search_generic_user_home_dirs', ` + userdom_search_user_home_content($1) ') ') From patchwork Mon Sep 30 10:48:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11166517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E238112B for ; Mon, 30 Sep 2019 10:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CB2D206BB for ; Mon, 30 Sep 2019 10:49:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fi/NAM1s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730824AbfI3KtB (ORCPT ); Mon, 30 Sep 2019 06:49:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47265 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730819AbfI3KtA (ORCPT ); Mon, 30 Sep 2019 06:49:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569840539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Te7BJZAe86InjFPZpLM7gkllmIbHYi4gHqkSeuHEL4Y=; b=Fi/NAM1sLWmLdWUf91URi7CQUEexqaC4bcZNPgtfDgqUb+8tm+PRdrl9l8w5JB996s8YSg DATZ7cls+ZqT/WnqbOQ2Ff8CdriLHO9hpOlNfUFBJIBH3s6Ip5YUfnaQSFOdic0gzXigNl wA0ct2Ynvk8LP+K46JlCDvTqh+fAsv8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-wuMQaOXHNpqXjtW9-C9PLQ-1; Mon, 30 Sep 2019 06:48:57 -0400 Received: by mail-wr1-f69.google.com with SMTP id b6so4365114wrx.0 for ; Mon, 30 Sep 2019 03:48:57 -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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x4dDWvD863WnKkG6dQE65TW0I/Db5xEu7HCzS8sROPI=; b=U/jDA21bqxCvhMyHEGfd/DD3ExZgGiC4q2dEXSHz0DcbA+YP4jI7WMqvdi5cZp25dQ apVVG3DRmNMjqzOstfGz7lJ1EbomZuCu/tRgMF2XL1Vl7Sz+ybXNmPnAuA0629Z5XPDi SHnJuzX6SUU1O9P1lxp+guPyu/3ClJJco7vu97rT1T3ZO2k/7gYAHMaa7NiFheEy6Aqj K7hoHmYsM6l1zoMGdK4dcw/GUfgkljwvFEtC2V/fbGlbf39V+JFLs+zmpu1XGpC+Yer7 Q3xoxHUdu/Xi8jA1YPsp0n1tyFyF1qVYU/cSUOC0XmlcI/4dHlQXGe+qcN83kwPeKRKv qy1w== X-Gm-Message-State: APjAAAXNNmD7qf2ovbpeA5Ae+fgNpP+OwOj1WVsY99fPhB0hs28K7TLw QPmsgdCA/rHHW9uTXG7hFUifWVGi4eMDdimqGfr7go3U5/9LfmMMeTZ1GvkrowVVvPJ7WwbRP6v 5zz7WkqNYqSGWj1aLAg== X-Received: by 2002:a05:600c:2153:: with SMTP id v19mr17065667wml.146.1569840536046; Mon, 30 Sep 2019 03:48:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqybmNXWmYsFluY3QDHpT7w2Yv/tw72WtIxspBB9Of/h61FTvILbhsnhp4BTy2H2FpP0xuPZPQ== X-Received: by 2002:a05:600c:2153:: with SMTP id v19mr17065659wml.146.1569840535826; Mon, 30 Sep 2019 03:48:55 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i73sm27081254wmg.33.2019.09.30.03.48.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 03:48:55 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH testsuite 2/3] policy: add fallbacks for Fedora-specific macros Date: Mon, 30 Sep 2019 12:48:49 +0200 Message-Id: <20190930104850.5482-3-omosnace@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930104850.5482-1-omosnace@redhat.com> References: <20190930104850.5482-1-omosnace@redhat.com> MIME-Version: 1.0 X-MC-Unique: wuMQaOXHNpqXjtW9-C9PLQ-1 X-Mimecast-Spam-Score: 0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org dev_rw_infiniband_dev() and mount_rw_pid_files() are not defined in refpolicy. Fall back to dev_rw_generic_files() and mount_rw_runtime_files() if they are not defined. Signed-off-by: Ondrej Mosnacek --- policy/test_policy.if | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/policy/test_policy.if b/policy/test_policy.if index 40e7499..e31345e 100644 --- a/policy/test_policy.if +++ b/policy/test_policy.if @@ -71,3 +71,17 @@ interface(`userdom_search_generic_user_home_dirs', ` userdom_search_user_home_content($1) ') ') + +# Workarounds for refpolicy: + +ifdef(`dev_rw_infiniband_dev', `', ` dnl +interface(`dev_rw_infiniband_dev', ` + dev_rw_generic_files($1) +') +') + +ifdef(`mount_rw_pid_files', `', ` dnl +interface(`mount_rw_pid_files', ` + mount_rw_runtime_files($1) +') +') From patchwork Mon Sep 30 10:48:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11166519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60D4A112B for ; Mon, 30 Sep 2019 10:49:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 360D4216F4 for ; Mon, 30 Sep 2019 10:49:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Cx8XW0tY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730383AbfI3KtE (ORCPT ); Mon, 30 Sep 2019 06:49:04 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48709 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729870AbfI3KtE (ORCPT ); Mon, 30 Sep 2019 06:49:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569840543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wDmwmE0HNQ5tRAfHtKAbS8QJGf1L4RWctr1w7KHviMA=; b=Cx8XW0tY7MY0CMi9JTuBSWXND1pT4QygeZSTh4/edZkyr7WYyVYMiw1y8+kPQw+C7JWlUI gmgzGw2KVLJeE1aR2b0iuhPaniCv8GzBszhp7qYuB2hv3VtOrRhcEdDGip8dE4LDq+madK 6JxAnLtj2SvxyVh/AtWZexwsJRPw/fc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-6wD1Yr-_MR-gM4hAfyOD8Q-1; Mon, 30 Sep 2019 06:48:58 -0400 Received: by mail-wr1-f69.google.com with SMTP id n3so4346896wrt.9 for ; Mon, 30 Sep 2019 03:48:58 -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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5v53W6hoYMweBa+McQa3Fq6y1mhOiYeLwB8uv6eBX3Q=; b=tnxqL1Km1JwovI8TpzRW+0zPAGhoZtcqjJLkCbVFkx/MwhCoUuWKaMXCShDJvbiF5i VKDXZWC6zNLiFbP2i3DunZUhRApJ61q+DPKdHFm5yGc6O1cZ1tIgK8RPJBSqfmwzGCcc M8sk8p4WBYMhGtRwFWqWfgMrtrohhflLXK9uWBuDhHRs8+TBjMABILmlSHful4sGxeWq hGXPcVeE1i0/eTb/AABDcZFAn7vEbB8LkSaQ6rzqghFR/+PtS6DDPiYY4NowY2RxtOiu 9kCtxbPClK8HyLDHoiT70Edeo/5OR3g512h3XjS7yVjngj7qehhy8AfCfsZrjyBmH2nj Mihw== X-Gm-Message-State: APjAAAUjEJ/j0oNvZVVjQlRXsbznao8dsnwYwprgXfoQR656P7qQ6B6/ /rI8YwOcvYkl5uxevfXPUL/9VKnR48N2u0KJ1kCis/M43fTHjkbWiNBQfE/++meETEhbF2xo/lg lHSgU8y6uVAVoTU6vLg== X-Received: by 2002:a1c:6508:: with SMTP id z8mr17465496wmb.93.1569840537356; Mon, 30 Sep 2019 03:48:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4xX5NH3+9ZBQn+Ipovca4EKgGSTcWdFQlwJk9ztPKJH3e3ayMoiBiEOLJleDQaivs29B4uQ== X-Received: by 2002:a1c:6508:: with SMTP id z8mr17465483wmb.93.1569840537113; Mon, 30 Sep 2019 03:48:57 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i73sm27081254wmg.33.2019.09.30.03.48.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 03:48:56 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH testsuite 3/3] travis: test building the test policy package Date: Mon, 30 Sep 2019 12:48:50 +0200 Message-Id: <20190930104850.5482-4-omosnace@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930104850.5482-1-omosnace@redhat.com> References: <20190930104850.5482-1-omosnace@redhat.com> MIME-Version: 1.0 X-MC-Unique: 6wD1Yr-_MR-gM4hAfyOD8Q-1 X-Mimecast-Spam-Score: 0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Download, build, and install Fedora policy & refpolicy and try building the test policy package against both of them. Signed-off-by: Ondrej Mosnacek --- .travis.yml | 24 ++++++++++++++++++-- travis-ci/enable-policy.sh | 10 +++++++++ travis-ci/setup-policy-fedora.sh | 35 +++++++++++++++++++++++++++++ travis-ci/setup-policy-refpolicy.sh | 22 ++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 travis-ci/enable-policy.sh create mode 100644 travis-ci/setup-policy-fedora.sh create mode 100644 travis-ci/setup-policy-refpolicy.sh diff --git a/.travis.yml b/.travis.yml index fbbe98d..c8cd44e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: c -dist: xenial +dist: bionic addons: apt: @@ -8,6 +8,14 @@ addons: - astyle - libselinux1-dev - libsctp-dev + - checkpolicy + - semodule-utils + +cache: + directories: + - selinux-policy + - container-selinux + - refpolicy before_install: # FYI: known good with HEAD at 8551fc60fc515cd290ba38ee8c758c1f4df52b56 @@ -17,7 +25,19 @@ before_install: perl Makefile.PL && make && sudo make install) + # install libbpf from sources + - git clone https://github.com/libbpf/libbpf + - (cd libbpf/src && make PREFIX=/usr/local) + - (cd libbpf/src && sudo make install PREFIX=/usr/local) + # install Fedora policy and refpolicy + - bash travis-ci/setup-policy-fedora.sh + - bash travis-ci/setup-policy-refpolicy.sh + # establish a fake "selinuxfs" mount (policy/Makefile just greps for selinuxfs) + - sudo mkdir -p /tmp/fake-selinuxfs + - sudo mount -t tmpfs tmpfs /tmp/fake-selinuxfs + - echo 31 >/tmp/fake-selinuxfs/policyvers script: - tools/check-syntax -f && git diff --exit-code - - make + - bash travis-ci/enable-policy.sh targeted && make POLDEV=/usr/share/selinux/targeted + - bash travis-ci/enable-policy.sh refpolicy && make POLDEV=/usr/share/selinux/refpolicy diff --git a/travis-ci/enable-policy.sh b/travis-ci/enable-policy.sh new file mode 100644 index 0000000..ae53fbe --- /dev/null +++ b/travis-ci/enable-policy.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +# create a dummy /etc/selinux/config +sudo mkdir -p /etc/selinux +sudo tee /etc/selinux/config >/dev/null <