Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 C6CDB16D4DD for ; Tue, 6 Aug 2024 10:07:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722938840; cv=none; b=FTBs0fnWtOv1HB/TCeQDw2ezrPxTkwHMT9dOijGtCW4jJECyIVyD5AMcAlOYrwsAfkDG+QWyvopTKozcRjT4H3YHkYzxZz49ZrCkAuBFy9sCn4EeVPXaeMaWmqLOR1WUS42PMlUqYLr2JSFDmWXYuIYdWuLpmLL0Ua54F6yel4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722938840; c=relaxed/simple; bh=cJBICR5UXNA5WSLXy0RzqfxGUC7JdOdoyC4aTxTUWr0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VvwTH7PODw6NacGOgOayHaCiCZIWKTnREiBt2bKIXoVuYPvH+y6/QEOvfum6p+pLK82ziyjic6Ak6L+8H9dPi0VDCACjW355298N5aDyZ2hzSW0vkDpHfIXrPSBm1MaV1R7IqwQYc1/e0cXpK0HQdqNR/eY8cBjpGkAV7f3bqdo= 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=Nt1W7poo; arc=none smtp.client-ip=205.220.168.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="Nt1W7poo" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4761wHXq023722 for ; Tue, 6 Aug 2024 10:07:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-type:date:from:message-id:mime-version:subject:to; s= qcppdkim1; bh=8cNQk3vFNuxp37ur5NXWl2S43By1oBK7M7wtKEUHEnE=; b=Nt 1W7pooSHefzlZMVboflOaZmwnzosFp6oil3qpYL8UB173dbprJ1JlwmjYZCl54SD 9K/fL8o9E1/l41JdiCqS257aj8SSLHTLukeKwmVrwf+vZifrpUnRj183nZa32bVT 1grjrhYDGIMm2aJoNujj5U4LySCy2X7d5Hv9KlXQyCA7hLswz20YJRr1+Bo94Z+S vNtS45aTMOaDM2Hs1hpmS4ysw840U0pRm572ljZjxuJi1h19A8ViPrqzIlJ0OHU6 0RVxAUwAzV82eiHZmi5vTkNF5Hm2hEu55YWmrQzh3UaP34Vazpwxid1NHPU3GXSA bVCziqU/JXDytqK4vmfQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40sbgrxw1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 10:07:17 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476A7Hma024374 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 10:07:17 GMT Received: from hu-nakella-hyd.qualcomm.com (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, 6 Aug 2024 03:07:14 -0700 From: Naga Bhavani Akella To: CC: , , , Naga Bhavani Akella Subject: [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. Date: Tue, 6 Aug 2024 15:36:52 +0530 Message-ID: <20240806100652.20702-1-quic_nakella@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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-ORIG-GUID: Sf6g-0gDK1O3Lrf2whlbn-GPbgKuJVOd X-Proofpoint-GUID: Sf6g-0gDK1O3Lrf2whlbn-GPbgKuJVOd 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-06_08,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 spamscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060071 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(` --