summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGargi Misra <gmisra@qti.qualcomm.com>2026-03-10 11:31:17 +0530
committerKhem Raj <raj.khem@gmail.com>2026-03-18 14:33:28 -0700
commit00616ccdaf0ce9e54ac7c75fabdb2d8f079c7578 (patch)
tree6beeb368aa38ac5527e75aa038d45e073c6f31de
parent786f3323d771f50c627506adfe0713333d672a0a (diff)
downloadmeta-openembedded-00616ccdaf0ce9e54ac7c75fabdb2d8f079c7578.tar.gz
refpolicy-targeted: Added sepolicy for adb service
- Labeled adb binary - Moved adb shell from initrc_t to unconfined_t - meta-selinux does not provide adb domain added policy in meta-oe instead of refpolicy: SELinuxProject/refpolicy#1085 Signed-off-by: Gargi Misra <gmisra@qti.qualcomm.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/0001-Added-sepolicy-for-adb-service.patch76
-rw-r--r--meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend5
2 files changed, 81 insertions, 0 deletions
diff --git a/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/0001-Added-sepolicy-for-adb-service.patch b/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/0001-Added-sepolicy-for-adb-service.patch
new file mode 100644
index 0000000000..f766bc3123
--- /dev/null
+++ b/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/0001-Added-sepolicy-for-adb-service.patch
@@ -0,0 +1,76 @@
1From c110d893be565ade574ee2933c6e89197f833006 Mon Sep 17 00:00:00 2001
2From: Gargi Misra <gmisra@qti.qualcomm.com>
3Date: Thu, 5 Mar 2026 12:39:42 +0530
4Subject: [PATCH] refpolicy-targeted: Added sepolicy for adb service
5
6 - Labeled adb binary
7 - Moved adb shell from initrc_t to unconfined_t
8
9Upstream-Status: Inappropriate [meta-oe Specific]
10
11Signed-off-by: Gargi Misra <gmisra@qti.qualcomm.com>
12---
13 policy/modules/services/adbd.fc | 5 +++++
14 policy/modules/services/adbd.if | 5 +++++
15 policy/modules/services/adbd.te | 25 +++++++++++++++++++++++++
16 3 files changed, 35 insertions(+)
17 create mode 100644 policy/modules/services/adbd.fc
18 create mode 100644 policy/modules/services/adbd.if
19 create mode 100644 policy/modules/services/adbd.te
20
21diff --git a/policy/modules/services/adbd.fc b/policy/modules/services/adbd.fc
22new file mode 100644
23index 000000000..6f5bb9269
24--- /dev/null
25+++ b/policy/modules/services/adbd.fc
26@@ -0,0 +1,5 @@
27+/usr/bin/adbd -- gen_context(system_u:object_r:adbd_exec_t,s0)
28+
29+
30+
31+
32diff --git a/policy/modules/services/adbd.if b/policy/modules/services/adbd.if
33new file mode 100644
34index 000000000..612fc0106
35--- /dev/null
36+++ b/policy/modules/services/adbd.if
37@@ -0,0 +1,5 @@
38+## <summary>adb service.</summary>
39+
40+
41+
42+
43diff --git a/policy/modules/services/adbd.te b/policy/modules/services/adbd.te
44new file mode 100644
45index 000000000..f7e8ac7d0
46--- /dev/null
47+++ b/policy/modules/services/adbd.te
48@@ -0,0 +1,25 @@
49+policy_module(adbd)
50+
51+########################################
52+#
53+# Declarations
54+#
55+
56+type adbd_t;
57+type adbd_exec_t;
58+
59+init_daemon_domain(adbd_t, adbd_exec_t)
60+
61+# Move adb from system_r:initrc_t to unconfined_r:unconfined_t
62+unconfined_shell_domtrans(adbd_t)
63+
64+# Minimal Rules Required for adbd service
65+allow adbd_t self:capability sys_resource;
66+
67+dev_rw_usbfs(adbd_t)
68+files_read_etc_files(adbd_t)
69+term_use_ptmx(adbd_t)
70+term_use_generic_ptys(adbd_t)
71+
72+
73+
74--
752.43.0
76
diff --git a/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend b/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend
new file mode 100644
index 0000000000..429b3ea9b5
--- /dev/null
+++ b/meta-oe/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend
@@ -0,0 +1,5 @@
1FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
2
3SRC_URI:append = " \
4 file://0001-Added-sepolicy-for-adb-service.patch \
5 "