Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70F6F8BF3 for ; Tue, 13 Aug 2024 09:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723542277; cv=none; b=UuSOMSf8l11SdRA0naCEJKtcrNQ8VAZb0jegVDevLJNaSni3HgiKpYje8+8MpyH/PQUIOMGEoL77Qn67JMjcNjiVu/42gIsjtURYjtnDJjN2MteStlylboj0eYP+DAOBe4zQkFX8fr67+c6YC8KYHtFVhYTJe9R3U710xjYB9qE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723542277; c=relaxed/simple; bh=asv9dAIQkdp+ZJ71A7ooqeJ2krqt7GATppiaLKcVUGQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=NDd+3R2kuQ0a89smTarM3/9Yc92adFXQ1A3+sJmsbWzSDua42tmEx7wQ3gqdpVBdGOyE9GaiGEhurNJyTx+0vIjqcNZvvGI2u7OIdvHiHTNUXnDgbqKlA9tUaai0Dc4SdjfbYZMe2yuvBU24dKdq8IGBalTIzr3ijF6HI76gKdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=n/kQZK6x; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="n/kQZK6x" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47D4ZhQD019288 for ; Tue, 13 Aug 2024 09:44:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= RV7SNIOcYssWJUFKPt+trdoRZwNfinw+jj4pEvgSowg=; b=n/kQZK6xSr8wliMB Dtx/uuXbq2i+TyCVy0zfIYSuNjlikBoVIAfqOAPtqdeheJhumtc50IGaWMzMVjIw nQ3rs3EscHSWpW6GM2S2MUh542dNGBKX9uT3vjYnW6cL8z885wI9FNg8bowh/rIf ru/Ph2fxSlX2JYKc3W4KuFa9f065w9YKQXV0iDx2jJtwOg0rU4nBhq0xgxeqrI06 sCeTQk7esngU0yF7yCyzvEK6mgyI6QjISIuuCE5xRb4Li0OW9bBgegMriqPOKh/z TdEsPN8fqOqqclgt7vjDCiDt3M3/j8fccjvvkuepsWN6PJgzgv9arv09nE2xdNCv R4oJPw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40x18df0rs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 13 Aug 2024 09:44:34 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47D9iXNl022945 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 13 Aug 2024 09:44:33 GMT Received: from [10.218.30.62] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 13 Aug 2024 02:44:31 -0700 Message-ID: <3a37d49f-b663-4130-a727-b53660ebfa4d@quicinc.com> Date: Tue, 13 Aug 2024 15:14:19 +0530 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] Adding SE Policy rules to allow usage of unix stream sockets by dbus and bluetooth contexts when Gatt notifications are turned on by remote. To: CC: , , References: <20240806100652.20702-1-quic_nakella@quicinc.com> Content-Language: en-US From: Naga Bhavani Akella In-Reply-To: <20240806100652.20702-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: OFhQir7ECDHlZYBpV3FZObVzwDyOXgwG X-Proofpoint-ORIG-GUID: OFhQir7ECDHlZYBpV3FZObVzwDyOXgwG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-13_02,2024-08-13_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408130069 Hi team, Could you please help us review the following changes. On 8/6/2024 3:36 PM, Naga Bhavani Akella wrote: > Below are the avc denials that are resolved - > > 1. AVC avc: denied { use } for pid=916 comm="dbus-daemon" > path="socket:[71126]" dev="sockfs" ino=71126 > scontext=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tclass=fd permissive=0 > > 2. AVC avc: denied { read write } for pid=913 comm="dbus-daemon" > path="socket:[25037]" dev="sockfs" ino=25037 > scontext=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tclass=unix_stream_socket permissive=0 > > 3. AVC avc: denied { use } for pid=910 comm="bluetoothd" > path="socket:[23966]" dev="sockfs" ino=23966 > scontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tclass=fd permissive=0 > > 4. AVC avc: denied { read write } for pid=2229 comm="bluetoothd" > path="socket:[27264]" dev="sockfs" ino=27264 > scontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tclass=unix_stream_socket permissive=0 > > Signed-off-by: Naga Bhavani Akella > --- > policy/modules/services/bluetooth.if | 23 +++++++++++++++++++++++ > policy/modules/services/bluetooth.te | 4 ++++ > policy/modules/services/dbus.te | 1 + > 3 files changed, 28 insertions(+) > > diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if > index bd3dff2ff..1c1526ad1 100644 > --- a/policy/modules/services/bluetooth.if > +++ b/policy/modules/services/bluetooth.if > @@ -187,6 +187,29 @@ interface(`bluetooth_dontaudit_read_helper_state',` > dontaudit $1 bluetooth_helper_t:file read_file_perms; > ') > > +##################################### > +## > +## Connect to bluetooth over a unix domain > +## stream socket. The socket can be used > +## for read and write. This is required for > +# bluetooth helper context. > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`bluetooth_helper_use',` > + gen_require(` > + type bluetooth_helper_t; > + ') > + > + files_search_runtime($1) > + allow $1 bluetooth_helper_t:unix_stream_socket rw_socket_perms; > + allow $1 bluetooth_helper_t:fd use; > +') > + > ######################################## > ## > ## All of the rules required to > diff --git a/policy/modules/services/bluetooth.te b/policy/modules/services/bluetooth.te > index 534f1b36d..d008252d1 100644 > --- a/policy/modules/services/bluetooth.te > +++ b/policy/modules/services/bluetooth.te > @@ -76,6 +76,10 @@ filetrans_pattern(bluetooth_t, bluetooth_conf_t, bluetooth_conf_rw_t, { dir file > allow bluetooth_t bluetooth_lock_t:file manage_file_perms; > files_lock_filetrans(bluetooth_t, bluetooth_lock_t, file) > > +optional_policy(` > + bluetooth_helper_use(bluetooth_t) > +') > + > manage_dirs_pattern(bluetooth_t, bluetooth_tmp_t, bluetooth_tmp_t) > manage_files_pattern(bluetooth_t, bluetooth_tmp_t, bluetooth_tmp_t) > files_tmp_filetrans(bluetooth_t, bluetooth_tmp_t, { dir file }) > diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te > index 672aeddf4..86b88a1d8 100644 > --- a/policy/modules/services/dbus.te > +++ b/policy/modules/services/dbus.te > @@ -266,6 +266,7 @@ optional_policy(` > > optional_policy(` > bluetooth_use(system_dbusd_t) > + bluetooth_helper_use(system_dbusd_t) > ') > > optional_policy(` - Bhavani