Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2364706ybp; Sat, 12 Oct 2019 08:52:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxePKCq05ILduPZnklybD8oZQbSBMlO2jS03RLeutclwCNgmfJHbGLI3wfCY1Es1Rs4i/Pt X-Received: by 2002:aa7:dc47:: with SMTP id g7mr19413617edu.153.1570895573984; Sat, 12 Oct 2019 08:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570895573; cv=none; d=google.com; s=arc-20160816; b=IP6Hr8w2VDTHuggDMD2o0MP5MPWkF6mz3Nr5K9W2ZK14Hj5Q6RYapzhgJQhAxi1MgF Cpcik1rqdbiLTVLJKVnKvNIn+2i/P4888GWdwY9wN34p19wKI4D2w95W05WGI8YzTmN9 wgDNvD2pGJOMDCGyiPYk9YNiyLprBWeaigvWcr/Sej7dlqrlDlKq95xHqkcVbN+ABEt7 6N6FlBbLJKhcUyz8t8MRmpg0jCE+14Sjz2FD5X9Rh2Hsb/9em+Si5wyfBIZip1qoKAwX 3sCisBcR5iGP3rubASrzgv84B9374ZWF8bG3KqzVyRXoKDwokYN+QQX3yphRfahv2Pem IzvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=90uc31M2JRZ5OAuJrX9lWo4MGDC8G6SrcVEYRY594VM=; b=yl2Q3eyB8AgXD92eo5fETXqB2ijokMnW9RdNtvSBWrgSmsqVe7zhOHpkqYZIrqMOcV pDigQ/WdRBRl/f7RngrHdNvOPb8PdchvSN2Y8cYXbIHnMvZcV0hTQdK5q2VnRI/5Po5o Fl8hqvkYgeYGfS89ZvNokkrU5oUy1NBNL2vuExt5jO76Hji4G8LnuimUYONC7B80kGo8 YsZU8/xd2qDIbIWGq633z4VmyB5Wkod5OZepeDyQJ25G42HKp/fya6gHVGCZ0xt8MkkM yKtbT0rf22EXmGciuFW8cbljZ/cW3dyDTV9feQs8KrbA31ubxrfIjaD7ldWedCH1Axro JcMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=XkAsp1vE; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ieee.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dc10si3094907ejb.81.2019.10.12.08.52.51; Sat, 12 Oct 2019 08:52:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=XkAsp1vE; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ieee.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727939AbfJLPwu (ORCPT + 11 others); 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-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