Skip to contentSkip to conversation

Sepolicy changes for brctl to access devpts

PATCH In review Wei Deng 2 participants 2 messages Jan 20 – Jan 21

lore
Share & tools
lore

Wei Deng

author
#0 lore raw

PATCH 1/1 Sepolicy changes for brctl to access devpts

Resolve selinux permission for brctl tool failed to launch in adb mode with enforcing mode enabled.

Below avc denials that are fixed with this patch -

avc: denied { read write } for pid=1407 comm="brctl" path="/dev/pts/0" dev="devpts" ino=3 scontext=system_u:system_r:brctl_t:s0 tcontext=system_u:object_r:initrc_devpts_t:s0 tclass=chr_file permissive=0

---
 policy/modules/admin/brctl.te | 2 ++
 1 file changed, 2 insertions(+)
policy/modules/admin/brctl.te +2 -0
index 026b0002d..e1f661c06 100644
@@ -23,6 +23,8 @@ allow brctl_t self:unix_stream_socket create_stream_socket_perms;
 allow brctl_t self:unix_dgram_socket create_socket_perms;
 allow brctl_t self:tcp_socket create_socket_perms;
 
+init_use_script_ptys(brctl_t);
+
 kernel_request_load_module(brctl_t)
 kernel_read_network_state(brctl_t)
 kernel_read_sysctl(brctl_t)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 21 lines · Wei Deng

Resolve selinux permission for brctl tool failed to launch in adb mode with enforcing mode enabled.

Below avc denials that are fixed with this patch -

avc: denied { read write } for pid=1407 comm="brctl" path="/dev/pts/0" dev="devpts" ino=3 scontext=system_u:system_r:brctl_t:s0 tcontext=system_u:object_r:initrc_devpts_t:s0 tclass=chr_file permissive=0

---
  policy/modules/admin/brctl.te | 2 ++
  1 file changed, 2 insertions(+)
policy/modules/admin/brctl.te +0 -0
index 026b0002d..e1f661c06 100644

policy/modules/admin/brctl.te allow brctl_t self:unix_stream_socket create_stream_socket_perms; · line 26

Quoted 4 lines
policy/modules/admin/brctl.te +1 -0
@@ -23,6 +23,8 @@ allow brctl_t self:unix_stream_socket create_stream_socket_perms;
  allow brctl_t self:unix_dgram_socket create_socket_perms;
  allow brctl_t self:tcp_socket create_socket_perms;
 
+init_use_script_ptys(brctl_t);

Merged, though I removed the unnecessary semicolon (;) at the end of the line. That raises an error in our lint checks.

https://github.com/SELinuxProject/refpolicy/pull/1066

Signature · 1 line
Chris PeBenito