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
7e7003ca
Commit
7e7003ca
authored
12 years ago
by
Stephen Smalley
Committed by
Android Git Automerger
12 years ago
Browse files
Options
Downloads
Plain Diff
am
e8848726
: Add policy for run-as program.
* commit '
e8848726
': Add policy for run-as program.
parents
ab1a61f2
e8848726
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
file.te
+1
-1
1 addition, 1 deletion
file.te
file_contexts
+1
-0
1 addition, 0 deletions
file_contexts
mls
+4
-5
4 additions, 5 deletions
mls
runas.te
+69
-0
69 additions, 0 deletions
runas.te
shell.te
+1
-1
1 addition, 1 deletion
shell.te
with
76 additions
and
7 deletions
file.te
+
1
−
1
View file @
7e7003ca
...
@@ -12,7 +12,7 @@ type sysfs_writable, fs_type, sysfs_type, mlstrustedobject;
...
@@ -12,7 +12,7 @@ type sysfs_writable, fs_type, sysfs_type, mlstrustedobject;
type sysfs_bluetooth_writable, fs_type, sysfs_type, mlstrustedobject;
type sysfs_bluetooth_writable, fs_type, sysfs_type, mlstrustedobject;
type sysfs_nfc_power_writable, fs_type, sysfs_type, mlstrustedobject;
type sysfs_nfc_power_writable, fs_type, sysfs_type, mlstrustedobject;
type inotify, fs_type, mlstrustedobject;
type inotify, fs_type, mlstrustedobject;
type devpts, fs_type;
type devpts, fs_type
, mlstrustedobject
;
type tmpfs, fs_type;
type tmpfs, fs_type;
type shm, fs_type;
type shm, fs_type;
type mqueue, fs_type;
type mqueue, fs_type;
...
...
This diff is collapsed.
Click to expand it.
file_contexts
+
1
−
0
View file @
7e7003ca
...
@@ -89,6 +89,7 @@
...
@@ -89,6 +89,7 @@
/system/bin/ash u:object_r:shell_exec:s0
/system/bin/ash u:object_r:shell_exec:s0
/system/bin/mksh u:object_r:shell_exec:s0
/system/bin/mksh u:object_r:shell_exec:s0
/system/bin/sh -- u:object_r:shell_exec:s0
/system/bin/sh -- u:object_r:shell_exec:s0
/system/bin/run-as -- u:object_r:runas_exec:s0
/system/bin/app_process u:object_r:zygote_exec:s0
/system/bin/app_process u:object_r:zygote_exec:s0
/system/bin/servicemanager u:object_r:servicemanager_exec:s0
/system/bin/servicemanager u:object_r:servicemanager_exec:s0
/system/bin/surfaceflinger u:object_r:surfaceflinger_exec:s0
/system/bin/surfaceflinger u:object_r:surfaceflinger_exec:s0
...
...
This diff is collapsed.
Click to expand it.
mls
+
4
−
5
View file @
7e7003ca
...
@@ -34,11 +34,10 @@ mlsconstrain process { sigkill sigstop signal setsched setpgid setcap setrlimit
...
@@ -34,11 +34,10 @@ mlsconstrain process { sigkill sigstop signal setsched setpgid setcap setrlimit
# Socket constraints
# Socket constraints
#
#
# These permissions are between the process and its local socket,
# Create/relabel operations: Subject must be equivalent to object unless
# not between a process/socket and its peer.
# the subject is trusted. Sockets inherit the range of their creator.
# Equivalence is the normal situation; anything else requires trust.
mlsconstrain socket_class_set { create relabelfrom relabelto }
mlsconstrain socket_class_set { read write create getattr setattr relabelfrom relabelto bind connect listen accept getopt setopt shutdown }
((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);
((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject or t2 == mlstrustedsubject);
# Datagram send: Sender must be dominated by receiver unless one of them is
# Datagram send: Sender must be dominated by receiver unless one of them is
# trusted.
# trusted.
...
...
This diff is collapsed.
Click to expand it.
runas.te
0 → 100644
+
69
−
0
View file @
7e7003ca
type runas, domain, mlstrustedsubject;
type runas_exec, file_type;
bool support_runas true;
if (support_runas) {
# ndk-gdb invokes adb shell ps to find the app PID.
r_dir_file(shell, untrusted_app)
dontaudit shell domain:dir r_dir_perms;
dontaudit shell domain:file r_file_perms;
# 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 untrusted_app:process sigkill;
dontaudit shell self:capability { sys_ptrace kill };
# ndk-gdb invokes adb shell run-as.
domain_auto_trans(shell, runas_exec, runas)
allow runas shell:fd use;
allow runas devpts:chr_file { read write };
# run-as reads package information.
allow runas system_data_file:file r_file_perms;
# run-as checks and changes to the app data dir.
dontaudit runas self:capability dac_override;
allow runas self:capability dac_read_search;
allow runas app_data_file:dir { getattr search };
# run-as switches to the app UID/GID.
allow runas self:capability { setuid setgid };
# run-as switches to the app security context.
allow runas rootfs:file r_file_perms; # read /seapp_contexts
selinux_check_context(runas) # validate context
allow runas untrusted_app:process dyntransition; # setcon
# run-as runs lib/gdbserver from the app data dir.
allow untrusted_app system_data_file:file rx_file_perms;
# run-as may also run sh or system commands.
allow untrusted_app shell_exec:file rx_file_perms;
allow untrusted_app system_file:file rx_file_perms;
# gdbserver reads the zygote.
allow untrusted_app zygote_exec:file r_file_perms;
# (grand)child death notification.
allow untrusted_app shell:process sigchld;
# child shell or gdbserver pty access.
allow untrusted_app devpts:chr_file { getattr read write };
# gdbserver creates a socket in the app data dir.
allow untrusted_app app_data_file:sock_file { create unlink };
# ndk-gdb invokes adb forward to forward the gdbserver socket.
allow adbd app_data_file:dir search;
allow adbd app_data_file:sock_file write;
allow adbd untrusted_app:unix_stream_socket connectto;
# ndk-gdb invokes adb pull of app_process, linker, and libc.so.
allow adbd zygote_exec:file r_file_perms;
allow adbd system_file:file r_file_perms;
}
This diff is collapsed.
Click to expand it.
shell.te
+
1
−
1
View file @
7e7003ca
type shell, domain;
type shell, domain
, mlstrustedsubject
;
type shell_exec, file_type;
type shell_exec, file_type;
domain_auto_trans(init, shell_exec, shell)
domain_auto_trans(init, shell_exec, shell)
allow shell rootfs:dir r_dir_perms;
allow shell rootfs:dir r_dir_perms;
...
...
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