Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemSEPolicy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemSEPolicy
Commits
b63e485b
Commit
b63e485b
authored
11 years ago
by
Nick Kralevich
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Confine shell domain in -user builds only."
parents
59469370
712ca0a4
No related branches found
No related tags found
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
attributes
+3
-0
3 additions, 0 deletions
attributes
domain.te
+8
-5
8 additions, 5 deletions
domain.te
init_shell.te
+3
-1
3 additions, 1 deletion
init_shell.te
shell.te
+4
-12
4 additions, 12 deletions
shell.te
shell_user.te
+3
-8
3 additions, 8 deletions
shell_user.te
shelldomain.te
+40
-0
40 additions, 0 deletions
shelldomain.te
with
61 additions
and
26 deletions
attributes
+
3
−
0
View file @
b63e485b
...
@@ -50,6 +50,9 @@ attribute mlstrustedobject;
...
@@ -50,6 +50,9 @@ attribute mlstrustedobject;
# Domains that are allowed all permissions ("unconfined").
# Domains that are allowed all permissions ("unconfined").
attribute unconfineddomain;
attribute unconfineddomain;
# All domains used for shells.
attribute shelldomain;
# All domains used for apps.
# All domains used for apps.
attribute appdomain;
attribute appdomain;
...
...
This diff is collapsed.
Click to expand it.
domain.te
+
8
−
5
View file @
b63e485b
...
@@ -39,11 +39,11 @@ allow domain init:unix_stream_socket connectto;
...
@@ -39,11 +39,11 @@ allow domain init:unix_stream_socket connectto;
# Root fs.
# Root fs.
allow domain rootfs:dir r_dir_perms;
allow domain rootfs:dir r_dir_perms;
allow domain rootfs:file r_file_perms;
allow domain rootfs:file r_file_perms;
allow domain rootfs:lnk_file
{ read getattr }
;
allow domain rootfs:lnk_file
r_file_perms
;
# Device accesses.
# Device accesses.
allow domain device:dir search;
allow domain device:dir search;
allow domain dev_type:lnk_file r
ead
;
allow domain dev_type:lnk_file r
_file_perms
;
allow domain devpts:dir search;
allow domain devpts:dir search;
allow domain device:file read;
allow domain device:file read;
allow domain socket_device:dir search;
allow domain socket_device:dir search;
...
@@ -69,12 +69,12 @@ allow domain fs_type:dir getattr;
...
@@ -69,12 +69,12 @@ allow domain fs_type:dir getattr;
allow domain system_file:dir r_dir_perms;
allow domain system_file:dir r_dir_perms;
allow domain system_file:file r_file_perms;
allow domain system_file:file r_file_perms;
allow domain system_file:file execute;
allow domain system_file:file execute;
allow domain system_file:lnk_file r
ead
;
allow domain system_file:lnk_file r
_file_perms
;
# Read files already opened under /data.
# Read files already opened under /data.
allow domain system_data_file:dir { search getattr };
allow domain system_data_file:dir { search getattr };
allow domain system_data_file:file { getattr read };
allow domain system_data_file:file { getattr read };
allow domain system_data_file:lnk_file r
ead
;
allow domain system_data_file:lnk_file r
_file_perms
;
# Read apk files under /data/app.
# Read apk files under /data/app.
allow domain apk_data_file:dir { getattr search };
allow domain apk_data_file:dir { getattr search };
...
@@ -87,7 +87,7 @@ allow domain dalvikcache_data_file:file r_file_perms;
...
@@ -87,7 +87,7 @@ allow domain dalvikcache_data_file:file r_file_perms;
# Read already opened /cache files.
# Read already opened /cache files.
allow domain cache_file:dir r_dir_perms;
allow domain cache_file:dir r_dir_perms;
allow domain cache_file:file { getattr read };
allow domain cache_file:file { getattr read };
allow domain cache_file:lnk_file r
ead
;
allow domain cache_file:lnk_file r
_file_perms
;
# Read timezone related information
# Read timezone related information
r_dir_file(domain, zoneinfo_data_file)
r_dir_file(domain, zoneinfo_data_file)
...
@@ -110,6 +110,9 @@ r_dir_file(domain, cgroup)
...
@@ -110,6 +110,9 @@ r_dir_file(domain, cgroup)
allow domain debugfs:dir r_dir_perms;
allow domain debugfs:dir r_dir_perms;
allow domain debugfs:file w_file_perms;
allow domain debugfs:file w_file_perms;
# Get SELinux enforcing status.
selinux_getenforce(domain)
# security files
# security files
allow domain security_file:dir { search getattr };
allow domain security_file:dir { search getattr };
allow domain security_file:file getattr;
allow domain security_file:file getattr;
...
...
This diff is collapsed.
Click to expand it.
init_shell.te
+
3
−
1
View file @
b63e485b
# Restricted domain for shell processes spawned by init
# Restricted domain for shell processes spawned by init
type init_shell, domain;
type init_shell, domain
, shelldomain
;
domain_auto_trans(init, shell_exec, init_shell)
domain_auto_trans(init, shell_exec, init_shell)
unconfined_domain(init_shell)
unconfined_domain(init_shell)
# inherits from shelldomain.te
This diff is collapsed.
Click to expand it.
shell.te
+
4
−
12
View file @
b63e485b
# Domain for shell processes spawned by ADB
# Domain for shell processes spawned by ADB
type shell, domain;
type shell, domain
, shelldomain, mlstrustedsubject
;
type shell_exec, exec_type, file_type;
type shell_exec, exec_type, file_type;
unconfined_domain(shell)
# Run app_process.
# Run app_process.
# XXX
Split
into its own domain?
# XXX
Transition
into its own domain?
app_domain(shell)
app_domain(shell)
# shell is also permissive to permit setenforce.
#
userdebug/eng
shell is also permissive to permit setenforce.
permissive shell;
permissive shell;
# ndk-gdb invokes adb shell ps to find the app PID.
# inherits from shelldomain.te
r_dir_file(shell, non_system_app_set)
# ndk-gdb invokes adb shell ls to check the app data dir.
allow shell app_data_file:dir search;
# ndk-gdb invokes adb shell kill -9 to kill the gdbserver.
allow shell non_system_app_set:process sigkill;
This diff is collapsed.
Click to expand it.
shell_user.te
+
3
−
8
View file @
b63e485b
# Domain for shell processes spawned by ADB
# Domain for shell processes spawned by ADB
type shell, domain;
type shell, domain
, shelldomain, mlstrustedsubject
;
type shell_exec, exec_type, file_type;
type shell_exec, exec_type, file_type;
unconfined_domain(shell)
# Run app_process.
# Run app_process.
# XXX
Split
into its own domain?
# XXX
Transition
into its own domain?
app_domain(shell)
app_domain(shell)
# ndk-gdb invokes adb shell ps to find the app PID.
# inherits from shelldomain.te
r_dir_file(shell, non_system_app_set)
# ndk-gdb invokes adb shell ls to check the app data dir.
allow shell app_data_file:dir search;
This diff is collapsed.
Click to expand it.
shelldomain.te
0 → 100644
+
40
−
0
View file @
b63e485b
# Rules for all shell domains (e.g. console service and adb shell).
# Access /data/local/tmp.
allow shelldomain shell_data_file:dir create_dir_perms;
allow shelldomain shell_data_file:file create_file_perms;
allow shelldomain shell_data_file:file rx_file_perms;
# Access sdcard.
allow shelldomain sdcard_type:dir rw_dir_perms;
allow shelldomain sdcard_type:file create_file_perms;
# adb bugreport
unix_socket_connect(shelldomain, dumpstate, dumpstate)
allow shelldomain rootfs:dir r_dir_perms;
allow shelldomain devpts:chr_file rw_file_perms;
allow shelldomain tty_device:chr_file rw_file_perms;
allow shelldomain console_device:chr_file rw_file_perms;
allow shelldomain input_device:chr_file rw_file_perms;
allow shelldomain system_file:file x_file_perms;
allow shelldomain shell_exec:file rx_file_perms;
allow shelldomain zygote_exec:file rx_file_perms;
r_dir_file(shelldomain, apk_data_file)
allow shelldomain dalvikcache_data_file:file { write setattr };
# Set properties.
unix_socket_connect(shelldomain, property, init)
allow shelldomain shell_prop:property_service set;
allow shelldomain ctl_dumpstate_prop:property_service set;
# ndk-gdb invokes adb shell ps to find the app PID.
r_dir_file(shelldomain, non_system_app_set)
# ndk-gdb invokes adb shell ls to check the app data dir.
allow shelldomain app_data_file:dir search;
# ps and ps -Z output for app processes.
r_dir_file(shelldomain, appdomain)
allow shelldomain appdomain:process getattr;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment