Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60EB7C4360C for ; Sat, 12 Oct 2019 15:52:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3691C206CD for ; Sat, 12 Oct 2019 15:52:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="XkAsp1vE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727939AbfJLPwu (ORCPT ); Sat, 12 Oct 2019 11:52:50 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38425 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbfJLPwt (ORCPT ); Sat, 12 Oct 2019 11:52:49 -0400 Received: by mail-qt1-f195.google.com with SMTP id j31so18526561qta.5 for ; Sat, 12 Oct 2019 08:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=90uc31M2JRZ5OAuJrX9lWo4MGDC8G6SrcVEYRY594VM=; b=XkAsp1vEZoUVnV1NN7KgPcTyceq7lS+Q+tlxj50Z5/6IiR7Haq0Tk9eiIaySoNF4i9 z+yHtxw8n0irMjSziimY8+yJY10Jbj7Is3ZxaYGBtI0FmpRO6cR096cSEOUWUJN7sXeR gwFQOyeRJjViUS+41mYR+8lv97v2nhvRUjJkc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=90uc31M2JRZ5OAuJrX9lWo4MGDC8G6SrcVEYRY594VM=; b=Zk5upzyy5HZzqI2USR7dos+GGjSq5/2WXpDVtNgkcuqZfRdYliJ3jwdiNpaw+h9rbE VzozERBuL5WQAUwpc3tVZ1z8BXcWjWDmO/exp6iXKWgeV/OIlWgsJZp3Mp9OBrWur3oT Uz+1N1GPLUmBLXdPOe5vJ8c0NUsEhnM7TSr7BK9sDVD6LsOyKVx9zySDwAvlzE9wI2uU /XURR8khfJQ4ckVOYmkngfNH/i3JtgVKlmG01iSkTi9ZwoZVEJYSXBz8VlAY/eRUMhNi ABLVkLv6+4i6OSh7TQlmTG4NbrDJNlVhM5hpsIE+MFlQVETel+lKtYjXeK2X/RXsCFLW ya1A== X-Gm-Message-State: APjAAAXwJw0LoEI8XfvsCqQ6wNAq18BGE5eY1q1mX8jpJgm1HsviHjSG 6KHQL/qeS8EEng0YX/nSrgm4EHJ8Cdk= X-Google-Smtp-Source: APXvYqz/qOvZ+hq+kbyw+HIz3oBPCGsNEVU6ud/9WViZn7NSPIgKmc6vb8kBQs121a3heRakRIOAcw== X-Received: by 2002:ac8:16eb:: with SMTP id y40mr23684181qtk.67.1570895567158; Sat, 12 Oct 2019 08:52:47 -0700 (PDT) Received: from [192.168.1.190] (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id m19sm5813503qke.22.2019.10.12.08.52.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Oct 2019 08:52:46 -0700 (PDT) Subject: Re: [PATCH 06/10] Allow alsa_t to create alsa_runtime_t file as well To: Laurent Bigonville , selinux-refpolicy@vger.kernel.org References: <20191011122416.14651-1-bigon@debian.org> <20191011122416.14651-6-bigon@debian.org> From: Chris PeBenito Message-ID: <765a8329-6944-b8fd-de32-e344896c4302@ieee.org> Date: Sat, 12 Oct 2019 11:52:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20191011122416.14651-6-bigon@debian.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 10/11/19 8:24 AM, Laurent Bigonville wrote: > From: Laurent Bigonville > > When alsactl is started as a daemon, it creates a pidfile > (/run/alsactl.pid), that needs to be allowed > > ---- > time->Sun Oct 6 10:59:09 2019 > type=AVC msg=audit(1570352349.743:45): avc: denied { write open } for pid=804 comm="alsactl" path="/run/alsactl.pid" dev="tmpfs" ino=25882 scontext=system_u:system_r:alsa_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1570352349.743:45): avc: denied { create } for pid=804 comm="alsactl" name="alsactl.pid" scontext=system_u:system_r:alsa_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=1 > ---- > time->Sun Oct 6 11:54:38 2019 > type=AVC msg=audit(1570355678.226:657): avc: denied { open } for pid=9186 comm="alsactl" path="/run/alsactl.pid" dev="tmpfs" ino=25882 scontext=system_u:system_r:alsa_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1570355678.226:657): avc: denied { read } for pid=9186 comm="alsactl" name="alsactl.pid" dev="tmpfs" ino=25882 scontext=system_u:system_r:alsa_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=1 > ---- > time->Sun Oct 6 11:54:38 2019 > type=AVC msg=audit(1570355678.230:659): avc: denied { unlink } for pid=804 comm="alsactl" name="alsactl.pid" dev="tmpfs" ino=25882 scontext=system_u:system_r:alsa_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=1 > > Signed-off-by: Laurent Bigonville > --- > policy/modules/admin/alsa.fc | 1 + > policy/modules/admin/alsa.te | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/policy/modules/admin/alsa.fc b/policy/modules/admin/alsa.fc > index 75ea9ebf..16ccb7ca 100644 > --- a/policy/modules/admin/alsa.fc > +++ b/policy/modules/admin/alsa.fc > @@ -4,6 +4,7 @@ HOME_DIR/\.asoundrc -- gen_context(system_u:object_r:alsa_home_t,s0) > /etc/asound\.conf -- gen_context(system_u:object_r:alsa_etc_t,s0) > > /run/alsa(/.*)? gen_context(system_u:object_r:alsa_runtime_t,s0) > +/run/alsactl.pid -- gen_context(system_u:object_r:alsa_runtime_t,s0) Needs escaping ( \.pid ) > > /usr/bin/ainit -- gen_context(system_u:object_r:alsa_exec_t,s0) > /usr/bin/alsactl -- gen_context(system_u:object_r:alsa_exec_t,s0) > diff --git a/policy/modules/admin/alsa.te b/policy/modules/admin/alsa.te > index e567dd32..9d053c4d 100644 > --- a/policy/modules/admin/alsa.te > +++ b/policy/modules/admin/alsa.te > @@ -58,8 +58,9 @@ allow alsa_t alsa_etc_t:file map; > can_exec(alsa_t, alsa_exec_t) > > allow alsa_t alsa_runtime_t:dir manage_dir_perms; > +allow alsa_t alsa_runtime_t:file manage_file_perms; > allow alsa_t alsa_runtime_t:lnk_file manage_lnk_file_perms; > -files_pid_filetrans(alsa_t, alsa_runtime_t, dir) > +files_pid_filetrans(alsa_t, alsa_runtime_t, { dir file }) > > manage_dirs_pattern(alsa_t, alsa_tmp_t, alsa_tmp_t) > manage_files_pattern(alsa_t, alsa_tmp_t, alsa_tmp_t) > -- Chris PeBenito