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 4E0DD20D4FC for ; Wed, 21 Jan 2026 12:15:13 +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=1768997716; cv=none; b=GtMtSyBTcyVHZvZnoz0qwD7jXHNepfD0WVm6LbciTfrP9ohmhifirlgvpjpPg+cEWGp4M6p4WMpiL+BskN5JB8Lvzec6OMxeQ4h92Igsne2TBqueUPIdBGB+lzhxfFIbSBpJxPw0opFiYkT5hxZyhVKYFhAgVGQE2UUJETA61gI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768997716; c=relaxed/simple; bh=ks2/YuYqDJkyhNTDnA64MdlUloCUXNH37ilouT2WHHY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eiKTYO0gVptracE/PqpJOHybkQgl9bh6G+k+nzH/UXCiPoVcymFMuHlocYm/qTdn9SaQIxc6HphwEGwlFmzlBu98Ty9rXT0cNLBQ1zKbH2RENnRXjx9OZ5bm4mnEW1fJHQtuNw3KSghgOfF6DXb77uoI7clvnzyvcKnpxEsnJ9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=UtV1IKi8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=D/sb7u5P; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="UtV1IKi8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="D/sb7u5P" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60L9crQX824668 for ; Wed, 21 Jan 2026 12:15:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=G6T9Djlmpm/9l2nE79fnGlVDSNuP5/b1mBS 7iG19G7I=; b=UtV1IKi8i7WNbKNzcgOgAdvaG1oBzJ7ahVKvlFAddkD+7ZXJtUQ Wdx25G4BN8r/62ZfCfwHdqsp9tR5enE6E/sd+AhLROA2neeWaitN5GL31S75tASW 2VL2qpI3jWtFlrNT+PAKRff+ob0DxFkv2M33gKPpdyy8Y5EB8UHYAVWWGugl95mJ 9Zh+fGgqKT0zZUkDqECLPlt/oV5PiSj3L5DvJFy66mVgJjY8+R8+d0EXx+RdW50m 1Ko0bDvNYtpIgmipSqJItrGwi3nA7w1XDUROjedhbORbjVRHzvOM6Psi4pZBjLl5 IAfr4PbavfRqynGPH20vwnGcSZSlYeM+Mhg== Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bte5e3uk5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 21 Jan 2026 12:15:12 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-121d1800c4aso1392018c88.2 for ; Wed, 21 Jan 2026 04:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1768997712; x=1769602512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=G6T9Djlmpm/9l2nE79fnGlVDSNuP5/b1mBS7iG19G7I=; b=D/sb7u5PlN44frq3BQ0+YggyUQxCW3dCTwutjHQJZWB6VFgsfO3Nzy6ysEsJkf+TCX xqcMNAvaNbYvc/dtX8qtd37PPlGkv/cidPwKjBTYETfdTS90Hlon+OPtZKwSr/U34Thb DIC5KJ0wdy/ohK9a9Ps+BF9QYndSLrdpGqzSrotFc49pg53YUeY4+jF60E3nlc9+DiZg x6bn34KEt9U+9P5B+g3c4/4S/CHDMvVWzkBaGls0f2495lrEYYqlMtNi0INayT7EYZCg YGRcPENYc2JQIUg5U8KloBVuU6LNhRmVdmHKS5b9uk4L1D6c1sP00En5Au9scHLQfNUB Ma7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768997712; x=1769602512; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G6T9Djlmpm/9l2nE79fnGlVDSNuP5/b1mBS7iG19G7I=; b=bxky3MxJrnqaGZDp939L/0GwWhTLLtPFagHydMVU/j62BTYiRWU5u9NsBzTVtnKofw fCa2grizEaGhgHZg/KMhV9FBRQ7e7kDyrlRJbN7E1nc0ITq/htAXuEfA5puXm7l/uWkv vr3Me1KCjimn7INotSxyPZlYqpwsN3UmNzNTY9wCyh89SXItqv5am64e7dlG4G/Qseo0 XiPTEqVZ3dugwe5dwtl0XvVBPI8zUZsUORDjJwO2yxaArtnD+n/CMIhEg7XLwOqUP0z5 nwU/XgbXnVq7olMNdQGhEhBd5qtaQcY8IPSc9fh4QXSbvJ0R8yh5I6hvfUoH9S46tCgU 7E/Q== X-Gm-Message-State: AOJu0YzX2pFVze1l7OqGQOalZ/zNsytlgkAAoZa367HvmoHGiQ2GLNKZ HtvYvTByN+phO6QBRXYApVqAVlYLVVL+SDUOuyWjX/yfEPIMnubYdeyZEQd0uvxbamxbapT4X2v wI9kp6NJ8spb21kh0DhYdKMh4JBxEwbWxCF9ll6qW/sY91J/dsd02ScRiiGXAE/DiLK9XFvRLnf k99seQXg== X-Gm-Gg: AZuq6aJaEF7QIv6/uP42pDw0B4ckdawDdEg5676KsZWRLk+/x6jFV4iVWOY8UKPqxn6 wT2Swzwjx/EMaF/hmVxOTRVqmOvBR+9O02DZkK/K5TqqAPzNDE7tuG5HpWlzAaJqadhs4XyAWeT +N39FjHGgso2Xq7id5W3ROPD2/S8xwNu5pCUGb7p5S87/Hu3c8GToDJfLqwfxzMU3C3GNXLzPYW TwFFeKWijsWU+lkoLkRVXNGnZmWlakFIsS1V/QaE7pufoaOLwKtxIamIZ4vLTIbACuy75arwanH ySg5Ce/mH6GYAnatlXPrq3hfTQDgxlS6uGhODQJGeb5hd4Jt4R+j8P3djvBXeBpwfW8VOTx7ENQ UFgY/uv4VPVM8qVV1Yo9DcsVaFFZMbNVs X-Received: by 2002:a05:7301:801:b0:2b6:f2d5:2923 with SMTP id 5a478bee46e88-2b6f2d533e3mr1906304eec.7.1768997711589; Wed, 21 Jan 2026 04:15:11 -0800 (PST) X-Received: by 2002:a05:7301:801:b0:2b6:f2d5:2923 with SMTP id 5a478bee46e88-2b6f2d533e3mr1906295eec.7.1768997710937; Wed, 21 Jan 2026 04:15:10 -0800 (PST) Received: from hu-weiden-sha.qualcomm.com ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b710acfe04sm2834701eec.30.2026.01.21.04.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 04:15:10 -0800 (PST) From: Wei Deng To: selinux-refpolicy@vger.kernel.org Cc: cheng.jiang@oss.qualcomm.com, shuai.zhang@oss.qualcomm.com, quic_mohamull@quicinc.com Subject: [PATCH] ofono: introduce dedicated SELinux domain ofono_t Date: Wed, 21 Jan 2026 17:45:06 +0530 Message-Id: <20260121121506.2670094-1-wei.deng@oss.qualcomm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=BKa+bVQG c=1 sm=1 tr=0 ts=6970c350 cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=8T_gOxTpvBEIBUQ6rCkA:9 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-ORIG-GUID: _zu2LSnGWOal1Og2bTdwH0V2Wdop394f X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDEwMiBTYWx0ZWRfX/ErhnGvK1tEq vZcjW7yWeMvzPP4gn/bKQM8ngRTXgIQL5M/Hwfr97EHA9DPNC9FeEe0O17R+AVFNAasWdL4Zu9N p8/CEbK3fALXEXUZ1ZVNRL+hfylr8wdVmMzp4tSkOZH3q0OXc6KoNVzlGrQr3bz9BE6NTDG1Acs AMeUjXUioYP33nI4L+ggEckQzCinBWSgzgswAoRnLdwV26PZ+yDwio/LbG7k92cg2KBFhXnHqWK yq61VUIHuyZYrqheRpe13GMPchw2jmNpv19qtbWRznAEYR/w4iPvVY75GRZ5cndbMiDXq6fNAJh VeVXLStanWR06vjpCnNyKSTBC/4A7uUctk6cdwsDLFvQEELHezzyiox+/Pb6B0kk2JU9XfaibKt RHug6ym5sI3EAvGGeqDctV279l+3VZ55b+7XcBjfcNMNeeUCRkfWtKaezWzhov7ciVbjbp7yQtw QZ9k1Ohfyi4hxtxMtTw== X-Proofpoint-GUID: _zu2LSnGWOal1Og2bTdwH0V2Wdop394f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_01,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 suspectscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601210102 Currently, the ofono daemon runs in the generic `initrc_t` domain. While functional, this configuration lacks proper process isolation and violates the principle of least privilege. Define a dedicated domain (`ofono_t`) to confine the service, ensuring it operates in a restricted environment isolated from other init processes. Grant the necessary permissions to resolve AVC denials observed during the transition to enforcing mode: * DBus: Allow service registration on the system bus and communication with `org.bluez`. * Network: Allow `net_admin` capability and netlink socket creation (route and kobject_uevent) for rmnet and udev handling. * Filesystem: Authorize read access to configuration files in `/etc` and `/usr`, and traversal of `/sys` and `/run/udev`. * Logging: Allow write access to `/dev/log` for syslog integration. Signed-off-by: Wei Deng --- policy/modules/services/ofono.fc | 1 + policy/modules/services/ofono.if | 1 + policy/modules/services/ofono.te | 83 ++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 policy/modules/services/ofono.fc create mode 100644 policy/modules/services/ofono.if create mode 100644 policy/modules/services/ofono.te diff --git a/policy/modules/services/ofono.fc b/policy/modules/services/ofono.fc new file mode 100644 index 000000000..7b62f91a0 --- /dev/null +++ b/policy/modules/services/ofono.fc @@ -0,0 +1 @@ +/usr/sbin/ofonod -- gen_context(system_u:object_r:ofono_exec_t,s0) diff --git a/policy/modules/services/ofono.if b/policy/modules/services/ofono.if new file mode 100644 index 000000000..7d99d1aa8 --- /dev/null +++ b/policy/modules/services/ofono.if @@ -0,0 +1 @@ +## ofono diff --git a/policy/modules/services/ofono.te b/policy/modules/services/ofono.te new file mode 100644 index 000000000..faa48f1ed --- /dev/null +++ b/policy/modules/services/ofono.te @@ -0,0 +1,83 @@ +policy_module(ofono, 1.0) + +######################################## +# +# Declarations +# + +type ofono_t; +type ofono_exec_t; + +init_daemon_domain(ofono_t, ofono_exec_t) + +######################################## +# +# Local Policy +# + +# 1. Self Rules (Capabilities & Sockets) +# -------------------------------------- +allow ofono_t self:capability net_admin; + +# Socket permissions +allow ofono_t self:bluetooth_socket create_stream_socket_perms; +allow ofono_t self:netlink_kobject_uevent_socket create_socket_perms; +allow ofono_t self:netlink_route_socket create_netlink_socket_perms; +allow ofono_t self:unix_dgram_socket { connect create write }; + +# 2. File System Access +# --------------------- +# Generic sysfs access using standard interface +dev_read_sysfs(ofono_t) + +# Read configuration files in /etc +files_read_etc_files(ofono_t) + +# Read files in /usr +files_read_usr_files(ofono_t) +allow ofono_t usr_t:file map; + +# Udev runtime access +gen_require(` + type udev_runtime_t; +') +allow ofono_t udev_runtime_t:dir search_dir_perms; +allow ofono_t udev_runtime_t:file read_file_perms; + +# 3. Logging +# ---------- +logging_send_syslog_msg(ofono_t) + +# Access to devlog +gen_require(` + type devlog_t; +') +allow ofono_t devlog_t:sock_file write_sock_file_perms; + +# 4. IPC / DBus / Network +# ----------------------- +# Connect to the system DBus +dbus_system_bus_client(ofono_t) + +gen_require(` + type system_dbusd_t; + type system_dbusd_runtime_t; + class dbus { acquire_svc send_msg }; +') + +# DBus specific service interactions +allow ofono_t system_dbusd_t:dbus { acquire_svc send_msg }; + +# Manual socket handling for system_dbusd +allow ofono_t system_dbusd_runtime_t:dir search_dir_perms; +allow ofono_t system_dbusd_runtime_t:sock_file write_sock_file_perms; + +# Bluetooth interactions via DBus +gen_require(` + type bluetooth_t; +') +allow bluetooth_t ofono_t:dbus send_msg; +allow ofono_t bluetooth_t:dbus send_msg; + +# Init interactions +init_dbus_chat(ofono_t) -- 2.25.1