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 1334F33F381 for ; Thu, 22 Jan 2026 11:40:30 +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=1769082032; cv=none; b=Hqw4tTg8gxu0BRwYMHy+nzR1nYcO2mX3cynNyXJEPtiA6deTFveKCSrclnF1DjJn5B3WrC/u8aS6KvXR4OXrqn8cBewK8x/pSkoElVyQT/79VUtw9skMS7zeaBhKmw7ss7dVkoxxa28+IqgXinGQqWhn3I2o/lBpADO2B2HaqKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769082032; c=relaxed/simple; bh=9OMXkf79i0yud/Xt/7mOIkrq/j3vaYJi7kQfEu2F6+U=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=WuRUdK4riWdahq/VoSfVVmMWwCvz1HpodQKR2C1Sdv8xmb9cWZqaS045QdV6Nkc8FLFgjBWFdjTHcTg3QiDcl/omIGFL9NikY8AmgG1o0p26mprmLebvLdn9CAl49oY7dH4JaDcrveClyHTxZPbUBda7fEacdPcANmSzNl5aP28= 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=o/KFDZLz; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Emt4E85l; arc=none smtp.client-ip=205.220.168.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="o/KFDZLz"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Emt4E85l" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60MB52Ft2629878 for ; Thu, 22 Jan 2026 11:40:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lB/jnqM/+vgWWBd3X2iWOgADfe3By0khUtihbejbxLI=; b=o/KFDZLzaNGGU2R6 IilZt8vWuxzoUQlrBD7/goUHbV/x++tJOh7FXVWNMjTB3GSbybOnPXZPTYY/3M9e ij8nV8w9cs8v+NPdG5hUgHNf+LPoGM04AWhzpbKCf4zurE5b6xDNy+mGFjLxoZCw j9z0j7wbpoSkiACJJdtP/8U8vHv1IJY1qVCn9f6m6+0EEoEv8lXF4ZZyiIB4OtiK fDmXdHU8Q8gI0ItXBVxJaqqEQtPS6ZQbdLtOfSBGatSJbbjX4Jg2EWyKCN1zBDXx atNnwQ7CerHZbUBkRodM7XIpax4oKRYmRDeT0+nvTf/RVFdHqYmT0rWVsuiPx7yk PcvPbg== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bujq1838w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 22 Jan 2026 11:40:30 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-501506ff58fso2368471cf.1 for ; Thu, 22 Jan 2026 03:40:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769082029; x=1769686829; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=lB/jnqM/+vgWWBd3X2iWOgADfe3By0khUtihbejbxLI=; b=Emt4E85l0D6kg30FD/1GfMfGDK6FtWJCXp/+2Z1By7flHgZfOq/Tb1YgJs1XjfmEQ1 AlC+vx8R6jCVTJDW5WQE6Pf/MkFRw3Gx1BxhVf/8cc92noWBn5n8Df3Xun234e86E0lZ lsmUHrv8SqtU0qQTXgelVjJ2NAgkhIt3kamnIrL+7xgIy3iw1iTZR/na/zY7mdMJrUYD oT9vAhrumVl9PfaTTmeeSZmOwXoHB+rqSIFSJBuRZ8teJUr0Bujr4GVnZG2t0imJkTFW nQ3r7fAf2l0+Qp2vvMP0sEi2UmInq1iaiijT7mamNZr+Snv6Kk4Ctfj6hxfq55lvl9ze OyCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769082029; x=1769686829; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lB/jnqM/+vgWWBd3X2iWOgADfe3By0khUtihbejbxLI=; b=tISFY2OIA9qPMAXP8V//eduI5MZZngZHZHEPSr1BNn3y37HgdTTdgDY2sh/P8dna1q sOoqo/J/j2o7zGBI4WkE/zOilnKUo15NYq2LIWa11ngqUhR24Ym9MEwea9enFjN1dENR lHvuFH9PuaN7ZhV4X8bHoahzP4rmPseuk0NXtHWcY6EJWlPAucAYVO1NULo57/cZWSFx mEeBHtRPTc2eGqzd+5PlDrEEgRltTs0eCJFE7qG/+PgPkjqN/XBaEUPs+PS7Mr4GW7n0 wGIp13kmA7FZZUjseozJmbyKIa/R6X0s0lx7F0xbw2FnUKhFzbDCkz1HRTCX/2aVa4fA T9/A== X-Forwarded-Encrypted: i=1; AJvYcCUeQHRQ/X2yLPqLVI9j3/ENE73V01mjVmhUtp691UEX3k0PdaKbbogHnnDyVEvGJenHY93p2wJNUpCFb2z3Fa6bEQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yz1ozdKyfJMUXoBOybl/oWx0IlH3xg6BjJ9K3QowKBKjme2FL09 +SQvZMtZesT0tKVlxJnG8D4uz3beY3aszAgdRaYYrt5VXjaPkkOwOKWVTB/HQ/JD7TyPxGJIKI1 ubH7wsdssYHZV2xPtcSM2QcfcmUtTqDp53+JKqnp/fw+4c+rpmtveABS5CIruMx8M/ZoPW4Yqdg == X-Gm-Gg: AZuq6aI8rc2PU46xqOKCyD5GarNuq4Vn/IseEjydB8vLx7LeHzGLspyNwAq3QWOQr+y ylXVl9/LU799tETk9r/8U1sZCn9qhURK51QPDvA1BULmLkCraiEzIzviBuPB2jL/YJufKV2PL46 +oxAmV7YglnqHySGc9dWmuJVUJ5CgIirJBuqxy+niom3z/CcjKskiQRzc8JC7CJgwYIwdAF3+3Z 5V0keqNY2R3wdRhzLCwWFfoLhO7POsmRoJDyNUn+eGzYJ3AGwhbPA5JjcfoAANIMzDEtU+mqlN0 dxDnkLqbhIVT27AX3hCIYwkrmeltQM/1lKTOZwdOUAN5cM/Q20lU/nEFJdLt9N6mNF6A1zmMv4K X5B60ri7veIQn3lypt7lCp+pShSOloS4jjfz0oUfiFn6aSUCGSA8iS+MlS8DNTiRi1M7Y X-Received: by 2002:ac8:5e49:0:b0:4e0:b24a:6577 with SMTP id d75a77b69052e-502a16520a1mr213141131cf.2.1769082029116; Thu, 22 Jan 2026 03:40:29 -0800 (PST) X-Received: by 2002:ac8:5e49:0:b0:4e0:b24a:6577 with SMTP id d75a77b69052e-502a16520a1mr213140831cf.2.1769082028460; Thu, 22 Jan 2026 03:40:28 -0800 (PST) Received: from [10.111.166.67] (Global_NAT1_IAD_FW.qualcomm.com. [129.46.232.65]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8942e60585fsm142076966d6.20.2026.01.22.03.40.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Jan 2026 03:40:28 -0800 (PST) Message-ID: Date: Thu, 22 Jan 2026 19:40:24 +0800 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Wei Deng Subject: Re: [PATCH] ofono: introduce dedicated SELinux domain ofono_t To: "Christopher J. PeBenito" , selinux-refpolicy@vger.kernel.org Cc: cheng.jiang@oss.qualcomm.com, shuai.zhang@oss.qualcomm.com, quic_mohamull@quicinc.com References: <20260121121506.2670094-1-wei.deng@oss.qualcomm.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: 7QHky9CMUb8rWd69lNf6cPuRWh6823xX X-Authority-Analysis: v=2.4 cv=O480fR9W c=1 sm=1 tr=0 ts=69720cae cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=C3Dk8TwHQYyIj7nOf9RCJw==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=NEAV23lmAAAA:8 a=EUspDBNiAAAA:8 a=CD4fJKqTayubIYM6_VUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-GUID: 7QHky9CMUb8rWd69lNf6cPuRWh6823xX X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIyMDA4NSBTYWx0ZWRfX/e7nc08WOVKN CvGj1FibOXz/YaAwdK/jVRPM7YzCGkiiF4QVHWSA/GGvEyKg0vqur6V+wzpFDIhPZMLq0cn+aKb psmjt90cc1gcYbr65tq/FtB4DHL6WeV0noe93ntK+ZWDJvuTxakZc9B+/pTGj7nvXxwI7RwNYI0 LlQ56bqRzYTPbRdt9/i2FbV1kQSQQZ3e13SxbgAP5okvJahtQiGcU3fWDO050moVhSTQ5JichWD /DJVEF7YRQICc+1kY7F6NWDxknMJTGF9kF6b6ZJ3ohmzNEnLf8bFROhdFLrMNmRLleuIzsvUD3V vsM1lBAcUVYbTU3g1MFaHh9NIMF8TV0caHFR4miYnvu3kgbJZVEtOnDThvGLuy7oKuwy+TiIzE+ tiirgYflhRb1h52c6OC561tiFdtp6sP444a3HH73k0z5CfxHen8/pRppmn8WZZO6ZPeHrb3L2T0 L/h7RdMIC6IU5gji5SA== 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-22_01,2026-01-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601220085 Hi Chris PeBenito, Thanks for your comments. On 1/22/2026 5:05 AM, Christopher J. PeBenito wrote: > On 1/21/26 7:15 AM, Wei Deng wrote: >> 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 > > Please add something descriptive about ofono here (a sentence or two) so readers can know what ofono does without having to look it up. OK, will add description about ofono here in the next patch. > > >> 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) >> +# -------------------------------------- > > Please remove these extra section titles here and below. OK, will remove. > > >> +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) > > Which sysfs entries are read?  We would like to tighten the controls on sysfs, so adding a coment here about what is read would be helpful, if possible. Based on our testing and AVC analysis, ofono requires read access to generic sysfs_t entries for device discovery and enumeration. Specifically, it accesses: - Bus traversal: Reading /sys/bus (to list available buses). - Device Symlinks: Reading and resolving symlinks in /sys/bus/pci/devices/ (e.g., /sys/bus/pci/devices/0001:00:00.0). - Device Properties: Reading uevent files within specific device paths (e.g., /sys/devices/platform/.../uevent) to identify hardware capabilities and driver binding. Since these paths are labeled with the generic sysfs_t type, the dev_read_sysfs interface is necessary to allow this enumeration. I will add a comment to the policy clarifying that this is used for PCI/Platform device discovery and uevent reading. > > >> +# 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; > > This should not reference types that are not defined in this module. You should call an interface in the files module, creating an appropriate one if needed.  This same change is needed several times below too. > > Please see https://github.com/SELinuxProject/refpolicy/wiki/StyleGuide > OK, thanks for your guide, will modify in the next patch. >> +# 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) > > -- Best Regards, Wei Deng