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 14D6E3FE664 for ; Wed, 29 Apr 2026 13:41:54 +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=1777470125; cv=none; b=FAlPAwy2VLInK1goXU5+3e+DFSGl4kjDsadVTU3d7cQcYcUn5Ql4HEl03Rbfeo8CHlsun+ZgoEbcnmXQowevrThlRk9ADKOkGIN8G/qbHVe1L3MfjGizpMPgKWfgQA+3Gjoag+p0Gc36hWhJ4jcSpo5A3eycb7g7XwkFTlEcbhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777470125; c=relaxed/simple; bh=1Pv0m8eR/chjvp5aSQ5BTBcCyshrDsAl7+TE5n6pxoA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vE64B2umr5+jN9cXfdWI7u0Utqc9pGM6B/LWdW0Iqne81HDvazKx3Qf61DA6yi4Nu35h0vbQPZs37Q18qhS+u7jnQq9C9jpO33yXur9qUxw+4ST5YASu5GAcUl1hJEB49HrNLvIYaleCDpE3LdeH/KKcqJuYaWoq7csLI3zlVVs= 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=HdV5Yook; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VhjzymnM; 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="HdV5Yook"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VhjzymnM" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63T8qINN1729747 for ; Wed, 29 Apr 2026 13:41:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=DoAwEbRB3OV lKBTuWzNNUb/pSY2VD194wj990ZfZoLg=; b=HdV5Yook9G2+tdeSczIG1vM4VN6 y3000Wzw71CVdlh7gYa630gz08KktezhaYWseo3+gkgimlfBXgkOhTmketvqFAHQ ysTQhpYPHLYY/R5c5JLmAJ0t8HQsYgW3unxJOq8uPMoUURL1Zs9hdOndUeuq6EKq xEXEM3XkehL7wEcs5niqjgn49PfDy2xs7rTlwrUAaf0LfiI+3H86K6DkjEYV4Q8j IgSTLK0mOCEWDK90yQwbDzXQV97Rl651dzx540A4Wl6IQnfUF/E2dIPBY3lCRMjC hdsEbMIzbBNNPwl8H4iBOzDR8zMxfi1x3sGUO0wn4RKDgKJ2k8vtJMVqUBg== 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 4due5ks8bj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 29 Apr 2026 13:41:50 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-12c72715b26so639618c88.2 for ; Wed, 29 Apr 2026 06:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1777470109; x=1778074909; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DoAwEbRB3OVlKBTuWzNNUb/pSY2VD194wj990ZfZoLg=; b=VhjzymnM6PjgARpMy2EA/LItHgrPgOO2ldNts6AniQ7yHgiI789fKHjsdpNkfBdbd0 SxLTM9H2mjuc3yKUWfbgmxV0TQ17anR3MXR8l4SkoRsVL6xrcVF1Eyxe/o0RAXDCrS/1 3bCWb/F6bE68/6qRQDEx8emwJLl7PUihIQJO7DaP1fCNa02JHGqxTdoHFURseudvvHLE PUE9Cwylzo/iuXNGkmy50oc/5Nk2sUGT+o7VYNYMup7e5z1jyCKWH2S8Gynk96BBesuH cqAQWaIvIwBU+QbTuvY3eKM8Ordv+CO5sDJPe8yTOwrsqEt3JFB4Hb1OBKECCMV4ZhPt nUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777470109; x=1778074909; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DoAwEbRB3OVlKBTuWzNNUb/pSY2VD194wj990ZfZoLg=; b=RwSl0KAzKQZM2oiuJzN7OXe4dshzxt2CFw1UrcwfMrjcd+q13IlhqHhnhA8xv5jBy3 egYd1DGKwiR2cMBFlmAVI5kJY5oHPomDardXSCb22SHI0Lel8dQ/evcSKLtDiC9knPMw /99zoLwQFTzVlmCVjvbRbz3YlMx42JU/1k7H2wMPBp9rcC7Tv9A8G8+TD3NdSFaNBTJ6 FZ/0LAc41d7zwE0Lx8uwFnIr4AstquOY6butc1MmV49EQED8X1H6o6xCD0oYs0rWNRJr KusYR2S6K5Mki6jkDSoKHjZg2EkkFbadNTb/qLtu4iUop/9iJLyiA6WqpG/DIrA+DOfz 40KA== X-Gm-Message-State: AOJu0YxfvgyCyb8I5hJ31YJQ0UYdG/T3NOEZYf0MvjUGkIXul38rU4jj qZ0NDfQiAGTwkhBXlz9ffFCHl2N6F4pIYKKRUcmJ3EU0ZvJ+gEWq2zk4z+iCHwXpAj3pDGSI4dc xMOHVCxkGaFg7IwlzB/uZwyAZRF6XvQf0qjCLya/kAD3hC1oErWrpTZWh3WNXgDU9U0ZtO2MM89 vkUcpspw== X-Gm-Gg: AeBDievgpk7mPVkjziflIEeHGwssdYyx0ctyRvx7stPA0lYdIPsXdl85qCcKEsevedX wVUBMhxaSikYFOj/NDEuw6a1WEUPJOJmujRgtoMSSToNB6t3qj5KX/DqCV8x/pK+l2MrXkZ82i+ QHPfbB5LqUxKGOcrHWq9+J/XeCUwikObkOcPMGvk0yIyFcgOlG6leFdUVp3zb3Z6a20mzB6m7OM fsoVlfzZzMgz8ktZRRCiseHCX9A9w1HnGeJQqhx91u3DrBjEBfC+58QoFiBgBrU5sE+FNsvdlbX VeSkuPN7GtLSeOzK4rW0EKZexTSr7kw3flctq+YqoT1KRvNinJgwofw/9o8/hcSan2k2NusZdOS v/zFzFIH8pzY59Ed3zF/gtzv0lBrrhzXzLjSNFsLrAbYLVRHlXK9sAnQ= X-Received: by 2002:a05:7022:e1e:b0:12c:888b:aaab with SMTP id a92af1059eb24-12ddd46c3ecmr1512096c88.0.1777470109336; Wed, 29 Apr 2026 06:41:49 -0700 (PDT) X-Received: by 2002:a05:7022:e1e:b0:12c:888b:aaab with SMTP id a92af1059eb24-12ddd46c3ecmr1512074c88.0.1777470108612; Wed, 29 Apr 2026 06:41:48 -0700 (PDT) Received: from hu-weiden-sha.qualcomm.com ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12de3261596sm2483423c88.11.2026.04.29.06.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2026 06:41:48 -0700 (PDT) From: Wei Deng To: selinux-refpolicy@vger.kernel.org, pebenito@ieee.org Cc: cheng.jiang@oss.qualcomm.com, shuai.zhang@oss.qualcomm.com, quic_mohamull@quicinc.com Subject: [PATCH v2] obex: transfer obexd to obex_t Date: Wed, 29 Apr 2026 19:11:43 +0530 Message-Id: <20260429134143.1217836-1-wei.deng@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260403063120.2752877-1-wei.deng@oss.qualcomm.com> References: <20260403063120.2752877-1-wei.deng@oss.qualcomm.com> 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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDI5MDEzOSBTYWx0ZWRfX9JRL8UIaVMBF DV/n/mwyUh01esWwVeNDZ9/YugFRC0KTxI3pSWeGvBAmKmsnxi3h5h8uO26iCMopCzMdktEbttL IyRYzxw5ffaWohmEIm8iY76TPwdmduHDw+9K4HjCQB0XLu9z8KhHA5Y+GvoGPH5o1voOSJjFesc It+TuUKXmUsyW1Mhh8eoeKzA4isN1kf/Vi/IGrUFuylE/qpsdc97lN0GE3cKBSaT7yrhsKeOdh0 LtELV8M6EtkvoEnkS60U+ezsSQFupBlvfn5FU7jJKIlDlPBFXA5cyT/aZGe7Bd6dKQT/Y6lOBq5 hofqceiXxCW9YPAs0LO2HzFKyKxnRLMJrG1QOZD/sWqVf8Tp36c3o/VejP7KLl//dQkxLK9NMum VlXsl/0ufRDHP6RYAG2zk+LFXrUV+/4GCh+T+Jdr9xjAObk9UYMOjKtokprPPcQmVjcyV2oTBUx jBNl4YPXjSfk72OhAeg== X-Proofpoint-GUID: MjguI803ww02MwmfZmadcjaRQFlede46 X-Proofpoint-ORIG-GUID: MjguI803ww02MwmfZmadcjaRQFlede46 X-Authority-Analysis: v=2.4 cv=CL4amxrD c=1 sm=1 tr=0 ts=69f20a9e cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=5SooU358vrkR0v2tF0AA:9 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-28_05,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 clxscore=1015 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604290139 obexd was running under init_t instead of obex_t because obex.te only declared userdom_user_application_domain(), which does not set up a domain transition from init_t. Add init_daemon_domain() so that obexd exec'd by init/systemd correctly transitions to obex_t. Also add the permissions observed to be required when obexd runs as obex_t: read sysfs nodes (dev_read_sysfs), register on the D-Bus system bus (dbus_connect_system_bus), and get attributes of bluetooth var-lib directories via the new bluetooth_getattr_var_lib_dirs() interface. Fixes: avc: denied { read } for pid=1751 comm="obexd" name="enabled" dev="sysfs" ino=21530 scontext=system_u:system_r:obex_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0 avc: denied { acquire_svc } for service=org.bluez.obex spid=1755 scontext=system_u:system_r:obex_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0 tclass=dbus permissive=0 exe="/usr/bin/dbus-daemon" sauid=998 hostname=? addr=? terminal=? avc: denied { getattr } for pid=1826 comm="obexd" path="/var/lib/bluetooth" dev="sda2" ino=1038914 scontext=system_u:system_r:obex_t:s0 tcontext=system_u:object_r:bluetooth_var_lib_t:s0 tclass=dir permissive=0 Signed-off-by: Wei Deng --- Changes in v2: - Complete rework: investigation showed the AVC denial was not bluetooth_t -> init_t (systemd), but bluetooth_t -> init_t (obexd running in the wrong domain because obex.te lacked a domain transition from init_t). The v1 fix of adding init_dbus_chat() to bluetooth.te was therefore incorrect. - Fix the root cause by adding init_daemon_domain() to obex.te so obexd correctly transitions to obex_t when started by init/systemd. - Add permissions needed by obexd once it runs as obex_t: dev_read_sysfs, dbus_connect_system_bus, and bluetooth_getattr_var_lib_dirs (new interface in bluetooth.if). policy/modules/services/bluetooth.if | 19 +++++++++++++++++++ policy/modules/services/obex.te | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if index d0e581426..f8226969f 100644 --- a/policy/modules/services/bluetooth.if +++ b/policy/modules/services/bluetooth.if @@ -255,6 +255,25 @@ interface(`bluetooth_admin',` admin_pattern($1, bluetooth_runtime_t) ') +######################################## +## +## Get the attributes of bluetooth lib directories. +## +## +## +## Domain allowed access. +## +## +# +interface(`bluetooth_getattr_var_lib_dirs',` + gen_require(` + type bluetooth_var_lib_t; + ') + + allow $1 bluetooth_var_lib_t:dir getattr_dir_perms; + files_search_var_lib($1) +') + ######################################## ## ## Get status of bluetooth_unit_t service diff --git a/policy/modules/services/obex.te b/policy/modules/services/obex.te index 5e2f20578..6803123b1 100644 --- a/policy/modules/services/obex.te +++ b/policy/modules/services/obex.te @@ -9,6 +9,7 @@ attribute_role obex_roles; type obex_t; type obex_exec_t; +init_daemon_domain(obex_t, obex_exec_t) userdom_user_application_domain(obex_t, obex_exec_t) role obex_roles types obex_t; @@ -20,6 +21,8 @@ role obex_roles types obex_t; allow obex_t self:fifo_file rw_fifo_file_perms; allow obex_t self:socket create_stream_socket_perms; +dev_read_sysfs(obex_t) + dev_read_urand(obex_t) files_read_etc_files(obex_t) @@ -32,10 +35,12 @@ userdom_search_user_home_content(obex_t) optional_policy(` bluetooth_use(obex_t) + bluetooth_getattr_var_lib_dirs(obex_t) ') optional_policy(` dbus_system_bus_client(obex_t) + dbus_connect_system_bus(obex_t) optional_policy(` bluetooth_dbus_chat(obex_t) -- 2.34.1