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 7B6C525B2FA for ; Thu, 9 Apr 2026 11:36:12 +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=1775734573; cv=none; b=IindcKRP2z7o0Lv5BpJEW08IufmaZ8Lj34x6XWjCVZIhgy28kO/uWRspTMagfSQtqozjaKtvWWHDtUEJNZchTz/5KDA9V1D1xmpNnxYrM0dCHoVlhkyhsF1zkxpWNz+tBDRAV6SYkF6sD5jkqvFRfAxzX1FqJVz/+0JVfXQoPgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775734573; c=relaxed/simple; bh=E1KEWKH9Ev59Oe96dw0vjPZ4MR5luhJvTyMZybNOvZI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Mgz08IqwsNrvWMgOvKIil7OnnKy7BAkCrZ04/VzLLgexqfhFjWZzq34Ymm0DyTOCAhDYX3K+a+3NnH78wIGwOyfqYLuUnCE9YBQ4Z8Ffx9F9SQR5n7ExxQo2Bp/cg+u59fzj8vpuKAhvVzhtoliN6QHnScKmW+6X2PGmgE9LExU= 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=jucuxYtL; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IxH1JO3R; 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="jucuxYtL"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IxH1JO3R" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6397NqTG674529 for ; Thu, 9 Apr 2026 11:36:11 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= YuBvS48+7uIQxiLB98utQ4kf6PrtN8tEvoIHjgKaQw4=; b=jucuxYtLT+Jnlq70 hitBy7ZkllLaVg2CFWsXpHn+F5PJU7TeH6sPt4Xj5YAD5za6P/jkaIgHGR8j175n J3ZuOkvDmK0xGWR3HivLbg37UtJ5r8TXTxA4QE7wKxtXlwn92iQGj4zkW0UNo9wC L38cwR2EJNM5BiMEsV2OsVuGb8b8PHLORproTE8gZxaOjTWqAjeOPf56grNc+ttT iXI2VAKFZ/B6w5IBXnfYTJUP4vp0LeraWlGb+x3a7B8oF0lw+je5X/Q5I6LTQ4Kh 6aeZ4gWEY9/7aHrsrWKgXEKBgAuK48Vils99hURdK7383Sowk61Th351cj9ZubIs wN3GrA== 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 4ddtbmutap-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 09 Apr 2026 11:36:11 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-12c01ccbe16so571913c88.1 for ; Thu, 09 Apr 2026 04:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775734570; x=1776339370; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YuBvS48+7uIQxiLB98utQ4kf6PrtN8tEvoIHjgKaQw4=; b=IxH1JO3RHVAa7B000jW5RKNSVgQU18kGi1cck27gqMDsNuKPEyDPoNkz7eD+PIE1Pc 60ecZR0plgSdCqMKa7ZLgNQYvKldrsWVZT08sPXfDRkX2cTZE59orJ9y6ZHNyZ/rt9QY pOdUAnvrdtAryiNZEvmzB0Ay82NYd9GmAM2qv4GwFCzWmdj2J6pXm1gDxCwU8sJ+IWXr RNogfPNP2aZtpt9PXt6kPq1OFH8Lm8r1Gr+WfjUm7en0gcudBN6hez4e7elXSBJtcYeN DcoDSbQ9Dit/DLj5Iytamk3Hj5chIuZsJQpR4Hxbyy/LctAMa58VEVSBAYyOe+urj+vN EQ1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775734570; x=1776339370; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YuBvS48+7uIQxiLB98utQ4kf6PrtN8tEvoIHjgKaQw4=; b=LxqnSZK7fuGLWtotj53L209yEspOY0Xdjn7JphIjaO7qzkqeb9+Q6xpm8dW9tSv4ST L2hzT3OVRyQmIXEOu24rSM4vMaTV6Evyeil0P5+0CTmGl7dtSJfMWmzjbjW+SBctTq0W a30aYcdY0aLOBU273FSgV3/k0o55/KqkK89OcaOzVwbFgBthgdGLm/lMV/uo1AzcKDmV MDFymchtRj8IIN5aqZrsm3RTLJAPSLffaREcQPdeYyxsGcnhfT/+4RAK+2M348oLAHVj 97qZANn9W+xuWqc/gbUy0Q+6d+s4yiKBlCsBNG+7GZpG3mq9sI7+7yc6BZmbxg4WYJc2 DPLw== X-Forwarded-Encrypted: i=1; AJvYcCWFg/UDufLhE3mhMg9LTCfv/MpJ65iZOgB2BYS4URmxphQ6EPSz+kl0rtdNi3e1FROkY7AIt3NGv5Gm23i0qqNdjQ==@vger.kernel.org X-Gm-Message-State: AOJu0YygDU7yw3+X+r9YEJrhKJDo18ksFAoApsZABnWBc1Yd8GFYTRZR jrXmNMMairy1Jyfy10TRSKbaVjV8UzgbkyY8GfzMFKVKopDh0BKeHwHslOZu+oVbujj/xhrA5ae uYNL7AdZorHmFwomwG7e8wOUqYwcp25r0rpGFjekF0HZisCDASXhdn7aF8W+RWXN6THuDGKGbwA == X-Gm-Gg: AeBDiesWaABsBJAQa/LkZkKuafuRswyJAdLXLm/v7YN6FafYOkv7ALB7Xv5eLkUHjjX BG6ZCNsXdmMpqJNQbFK+L13t0NVKuFizs1C0y9Ofk/Nav4RC/ISPVC3LgoH25YwuOplyVLIN141 iXxiLALzF26KEHSr5lwiv6xrBCbD8ZxaQ9XRCNldFfcwcP2dGa26ldUSx1SWCk/9488hdAidOGr PkiuDF8N342rr8smggaE8kPpxYiKcvpoGpucASoxIG+PiJ/RUMXP3tE7nXZHNcuNbtUKUFXdEC0 5CgHaFDTW7GVUf9mZGA+mfo10To5jUXDFxcvUCpes25g53HABzQ3CDNPUdfnk+76Jzbag8Jl1ns qxalhKxtGLCO8NN6FPrNNn09QqwxyYL8bxqUZnAO5HGI= X-Received: by 2002:a05:7301:7c0e:b0:2d3:dff7:13b5 with SMTP id 5a478bee46e88-2d3dff741b9mr974757eec.1.1775734569960; Thu, 09 Apr 2026 04:36:09 -0700 (PDT) X-Received: by 2002:a05:7301:7c0e:b0:2d3:dff7:13b5 with SMTP id 5a478bee46e88-2d3dff741b9mr974740eec.1.1775734569178; Thu, 09 Apr 2026 04:36:09 -0700 (PDT) Received: from [10.239.96.29] ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2d4bd1d91c5sm1408168eec.4.2026.04.09.04.36.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2026 04:36:08 -0700 (PDT) Message-ID: Date: Thu, 9 Apr 2026 19:36:04 +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 Subject: Re: [PATCH] sepolicy: Allow bluetooth to send D-Bus messages to systemd 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: <20260403063120.2752877-1-wei.deng@oss.qualcomm.com> <7ee9976c-821e-4aec-83e9-3a820f097901@ieee.org> <6dfcae79-bc3d-4258-a2c1-4cbd33e7df56@oss.qualcomm.com> <4fb4970f-ac24-47d8-9c62-5e20e0d3b5bd@ieee.org> Content-Language: en-US From: Wei Deng In-Reply-To: <4fb4970f-ac24-47d8-9c62-5e20e0d3b5bd@ieee.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: sN5KKrJDErcA_BdoTHDZfcaNto96IZXz X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA5MDEwNCBTYWx0ZWRfX1/HRszxF8o5u Ou0K4QsIAY3BlOeXfUr6zU+qvfDJ/lzvJZzqtQi/Mky97KqitUHrL3WI32e3REv8YTzDFsdJh90 H0ELZcw4H3yIQrOcxvpsr2sJ1jS0pG5tR4gvgMoGJ9sXKpaH6z+I357VkrXNIZ5vFttVDRyVtnH 8h7yhzgOTf/vdXg/ONjf7ekMJjctG7hC4JpHRxBwFFdfLwT50eShL8mRY7/m1o644iuCsu4PtC6 VqmngNM3W6PFhg4Aps+CpP8Fo7r7xW80dChweuaj2qnDQq77PYeu+vtAgtYBetBrUGINxR/pgzr 6r8TSqCgPHdEYYtVWIlFWA5JPQsj2LTFvmmZKhfBi76l4+soYz0HARuXRDQCIhe3XBi/Qi3xL3P vt+fjuDdXIWDRyTurqzHQC/AtS4Dr09gjS47sQLom69+0ZNGXhtUTpxoe5PNTLOhLIlhlOWdGg8 siBH7wWqorrwmHXQNyw== X-Authority-Analysis: v=2.4 cv=YM2vDxGx c=1 sm=1 tr=0 ts=69d78f2b cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=tq2IA33d5Lrupf6AI8AA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-ORIG-GUID: sN5KKrJDErcA_BdoTHDZfcaNto96IZXz 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-09_03,2026-04-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604090104 Hi Chris, On 4/7/2026 8:40 PM, Christopher J. PeBenito wrote: > On 4/4/26 5:19 AM, Wei Deng wrote: >> Hi Chris, >> >> Thanks for the review. >> >> On 4/3/2026 10:01 PM, Christopher J. PeBenito wrote: >>> On 4/3/26 2:31 AM, Wei Deng wrote: >>>> Add init_dbus_chat() for bluetooth_t to allow bluetoothd to send >>>> D-Bus method_return messages back to systemd (init_t) over the >>>> system bus. >>>> >>>> Below avc denial is fixed with this patch: >>>> >>>> avc:  denied  { send_msg } for  msgtype=method_return dest=:1.11 >>>> scontext=system_u:system_r:bluetooth_t:s0 >>>> tcontext=system_u:system_r:init_t:s0 tclass=dbus permissive=0 >>>> >>>> Signed-off-by: Wei Deng >>>> --- >>>>    policy/modules/services/bluetooth.te | 1 + >>>>    1 file changed, 1 insertion(+) >>>> >>>> diff --git a/policy/modules/services/bluetooth.te b/policy/modules/services/bluetooth.te >>>> index ceb42d147..a73cb5db0 100644 >>>> --- a/policy/modules/services/bluetooth.te >>>> +++ b/policy/modules/services/bluetooth.te >>>> @@ -136,6 +136,7 @@ userdom_dontaudit_search_user_home_dirs(bluetooth_t) >>>>    optional_policy(` >>>>        dbus_system_bus_client(bluetooth_t) >>>>        dbus_connect_system_bus(bluetooth_t) >>>> +  init_dbus_chat(bluetooth_t) >>>>        init_dbus_send_script(bluetooth_t) >>>>          optional_policy(` >>> Can you confirm this response is going to systemd/pid1? Is there a fuller set of log messages corresponding to this denial? The init_dbus_send_script() makes me wonder. >> The two log entries list here: >> >>    type=SERVICE_START msg=audit(19.419:292): pid=1 uid=0 >>      subj=system_u:system_r:init_t:s0 >>      msg='unit=bluetooth comm="systemd" >>      exe="/usr/lib/systemd/systemd" ... res=success' >> >>    type=USER_AVC msg=audit(19.547:319): >>      subj=system_u:system_r:system_dbusd_t:s0 >>      msg='avc: denied { send_msg } for msgtype=method_return >>      dest=:1.11 spid=684 tpid=843 >>      scontext=system_u:system_r:bluetooth_t:s0 >>      tcontext=system_u:system_r:init_t:s0 >>      tclass=dbus permissive=0 >>      exe="/usr/bin/dbus-daemon"' >> >>> Can you confirm this response is going to systemd/pid1? >>> Is there a fuller set of log messages corresponding to this denial? >> Yes. The SERVICE_START entry shows pid=1 with >> exe="/usr/lib/systemd/systemd" running under init_t, confirming that >> init_t is systemd's SELinux domain. > > These two audit messages are not related, as they have different event IDs (292 vs 319). Additionally, SERVICE_START messages are expected to come from pid=1. > > Can you confirm this response is going to systemd/pid1? > Is there a fuller set of log messages corresponding to > this denial? You are right. I apologize for the confusion. The two audit messages are unrelated, as they have different event IDs. Here is the full AVC denial: type=USER_AVC msg=audit(1773416627.807:455): pid=801 uid=997 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0 msg='avc: denied { send_msg } for msgtype=method_return dest=:1.27 spid=1942 tpid=1944 scontext=system_u:system_r:bluetooth_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=dbus permissive=0 exe="/usr/bin/dbus-daemon"' The tpid=1944 is obexd, not systemd/pid1, as confirmed by: ps -p 1944 -o pid,ppid,comm,exe,label PID PPID COMMAND EXE LABEL 1944 1 obexd /usr/libexec/bluetooth/obexd system_u:system_r:init_t:s0 So the real issue is not bluetooth_t -> init_t (systemd), but bluetooth_t -> init_t (obexd running in the wrong domain). The root cause is that obex.te currently uses userdom_user_application_domain(), which does not create a domain transition from init_t. obexd therefore inherits systemd's domain instead of transitioning to obex_t. The fix is to replace userdom_user_application_domain() with init_daemon_domain() in obex.te: -attribute_role obex_roles; - type obex_t; type obex_exec_t; -userdom_user_application_domain(obex_t, obex_exec_t) -role obex_roles types obex_t; +init_daemon_domain(obex_t, obex_exec_t) With this change, obexd correctly transitions to obex_t: ps -eZ | grep obexd system_u:system_r:obex_t:s0 986 ? 00:00:00 obexd This shifts the denial from bluetooth_t -> init_t to bluetooth_t -> obex_t, which is the correct relationship to address in policy. If this approach is acceptable, I will submit a follow-up patch to update the obex policy accordingly, including fixing the resulting AVC denials for obex_t. Would you have any concerns or suggestions? > >>> The init_dbus_send_script() makes me wonder. >> They target different domains: >> >>    init_dbus_send_script(): bluetooth_t -> initrc_t (SysV init scripts) >>    init_dbus_chat():        bluetooth_t <-> init_t  (systemd itself) >> >> Both are needed for cross-platform compatibility. > > initrc_t also exists on systemd systems for generic commands run from systemd units. However, if these rules are needed for sysvinit vs systemd, then these two rules should be put in an if/else of an init_systemd block. > > -- Best Regards, Wei Deng