Commit graph

228 commits

Author SHA1 Message Date
dcashman
b037a6c94b Add adbd socket perms to system_server.
Commit 2fdeab3789 added ability to debug
over adbd for zygote-spawned apps, required by removal of domain_deprecated
from untrusted_app.  This functionality is a core debugabble component
of the android runtime, so it is needed by system_server as well.

Bug: 26458796
Change-Id: I29f5390122b3644449a5c3dcf4db2d0e969f6a9a
2016-01-25 16:09:01 -08:00
Rubin Xu
0c8286fe74 SELinux rule for ro.device_owner and persist.logd.security
They are introduced for the device owner process logging feature.
That is, for enterprise-owned devices with device owner app provisioned,
the device owner may choose to turn on additional device-wide logging for
auditing and intrusion detection purposes. Logging includes histories of
app process startup, commands issued over ADB and lockscreen unlocking
attempts. These logs will available to the device owner for analysis,
potentially shipped to a remote server if it chooses to.

ro.device_owner will be a master switch to turn off logging, if the device
has no device owner provisioned. persist.logd.security is a switch that
device owner can toggle (via DevicePoliyManager) to enable/disable logging.
Writing to both properties should be only allowed by the system server.

Bug: 22860162
Change-Id: Iabfe2347b094914813b9d6e0c808877c25ccd038
2016-01-19 15:27:03 +00:00
Felipe Leme
549ccf77e3 Creates a new permission for /cache/recovery
This permission was created mostly for dumpstate (so it can include
recovery files on bugreports when an OTA fails), but it was applied to
uncrypt and recovery as well (since it had a wider access before).

Grant access to cache_recovery_file where we previously granted access
to cache_file. Add auditallow rules to determine if this is really
needed.

BUG: 25351711
Change-Id: I07745181dbb4f0bde75694ea31b3ab79a4682f18
2016-01-04 23:11:28 +00:00
dcashman
36f255ff52 Create sysfs_zram label.
Address following denials:
avc: denied { getattr } for path="/sys/devices/virtual/block/zram0/disksize" dev="sysfs" ino=14958 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { search } for name="zram0" dev="sysfs" ino=14903 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
avc: denied { read } for name="mem_used_total" dev="sysfs" ino=14970 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { write } for name="uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { open } for path="/sys/devices/virtual/block/zram0/uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { read } for pid=348 comm="vold" name="zram0" dev="sysfs" ino=15223 scontext=u:r:vold:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
avc: denied { search } for pid=3494 comm="ContactsProvide" name="zram0"dev="sysfs" ino=15223 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0

Bug: 22032619
Change-Id: I40cf918b7cafdba6cb3d42b04b1616a84e4ce158
2016-01-04 14:24:09 -08:00
Daichi Hirono
a20802ddb8 Add new rules for appfuse.
The new rules are used to allow to mount FUSE file system for priv-app.

Change-Id: I5ce2d261be501e2b3fef09b7666f1e5d1cddbe52
2015-12-24 11:32:41 +09:00
Amith Yamasani
107c55393c Add policies for system_server to delete fpdata folder
Bug: 26211308
Change-Id: I8fd2d14ea52d49a33e6cdbcdf90630eea89f7dd0
2015-12-17 12:33:06 -08:00
Nick Kralevich
cb835a2852 Add auditallow for bluetoothdomain rules
Let's see if it's safe to get rid of them.

Bug: 25768265
Bug: 25767747
Change-Id: Iaf022b4dafe1cc9eab871c8d7ec5afd3cf20bf96
2015-11-23 17:15:11 -08:00
Nick Kralevich
4fd216060c system_server: allow restorecon /data/system/users/0/fpdata
Addresses the following denial:

  avc: denied { relabelfrom } for pid=9971 comm="system_server" name="fpdata" dev="dm-0" ino=678683 scontext=u:r:system_server:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir permissive=0

Bug: 25801240
Change-Id: I043f48f410505acaee4bb97446945316f656a210
2015-11-19 18:26:51 -08:00
Calin Juravle
2469b32e15 Remove handling of dalvik-cache/profiles
Bug: 24698874
Bug: 17173268
Change-Id: I8c502ae6aad3cf3c13fae81722c367f45d70fb18
2015-11-16 11:05:10 +00:00
Calin Juravle
f255d775fc Add SElinux rules for /data/misc/trace
The directory is to be used in eng/userdebug build to store method
traces (previously stored in /data/dalvik-cache/profiles).

Bug: 25612377

Change-Id: Ia4365a8d1f13d33ee54115dc5e3bf62786503993
2015-11-11 10:33:51 +00:00
Nick Kralevich
142f97b758 system_server: clean up stale rules
979adffd45 added an auditallow
to see if system_server was relabeling system_data_file.
The auditallow rule hasn't triggered, so remove the allow rule.

a3c97a7660 added an auditallow
to see if system_server was executing toolbox. The auditallow
rule hasn't triggered, so remove the allow rule. AFAIK,
system_server never executes ANY file, so further tightening here
is feasible.

Change-Id: Ia0a93f3833e32c3e2c898463bd8813701a6dd20a
2015-11-07 09:20:16 -08:00
Jeff Vander Stoep
d22987b4da Create attribute for moving perms out of domain
Motivation: Domain is overly permissive. Start removing permissions
from domain and assign them to the domain_deprecated attribute.
Domain_deprecated and domain can initially be assigned to all
domains. The goal is to not assign domain_deprecated to new domains
and to start removing domain_deprecated where it is not required or
reassigning the appropriate permissions to the inheriting domain
when necessary.

Bug: 25433265
Change-Id: I8b11cb137df7bdd382629c98d916a73fe276413c
2015-11-03 23:11:11 +00:00
Nick Kralevich
82bdd796e1 system_server: (eng builds) remove JIT capabilities
23cde8776b removed JIT capabilities
from system_server for user and userdebug builds. Remove the capability
from eng builds to be consistent across build types.

Add a neverallow rule (compile time assertion + CTS test) to verify
this doesn't regress on our devices or partner devices.

Bug: 23468805
Bug: 24915206
Change-Id: Ib2154255c611b8812aa1092631a89bc59a27514b
2015-10-14 09:41:47 -07:00
Lorenzo Colitti
e24aab286a am c3712143: Allow system_server to bind ping sockets.
* commit 'c37121436be95ae2ed75cb83605940455446ef4e':
  Allow system_server to bind ping sockets.
2015-09-09 14:43:22 +00:00
Lorenzo Colitti
c37121436b Allow system_server to bind ping sockets.
This allows NetworkDiagnostics to send ping packets from specific
source addresses in order to detect reachability problems on the
reverse path.

This addresses the following denial:

[  209.744636] type=1400 audit(1441805730.510:14): avc: denied { node_bind } for pid=8347 comm="Thread-202" saddr=2400:xxxx:xxxx:xxxx:40b1:7e:a1d7:b3ae scontext=u:r:system_server:s0 tcontext=u:object_r:node:s0 tclass=rawip_socket permissive=0

Bug: 23661687
Change-Id: Ia93c14bc7fec17e2622e1b48bfbf591029d84be2
2015-09-09 23:08:27 +09:00
Jeff Vander Stoep
a3aa1db39c am 0243e5cf: system_server.te: remove policy load permissions
* commit '0243e5cf4f8898b7acedc24efd58fdcd163e3048':
  system_server.te: remove policy load permissions
2015-09-01 22:38:11 +00:00
Jeff Vander Stoep
0243e5cf4f system_server.te: remove policy load permissions
Remove system server's permission to dynamically update SELinux
policy on the device.

1) This functionality has never been used, so we have no idea if
it works or not.

2) If system_server is compromised, this functionality allows a
complete bypass of the SELinux policy on the device. In particular,
an attacker can force a regression of the following patch
  * https://android-review.googlesource.com/138510
see also https://code.google.com/p/android/issues/detail?id=181826

3) Dynamic policy update can be used to bypass neverallow protections
enforced in CTS, by pushing a policy to the device after certification.
Such an updated policy could bring the device out of compliance or
deliberately introduce security weaknesses.

Bug: 22885422
Bug: 8949824
Change-Id: I3c64d64359060561102e1587531836b69cfeef00
2015-09-01 15:23:30 -07:00
Nick Kralevich
b08688628c am 7af012fc: Merge "Only allow toolbox exec where /system exec was already allowed."
* commit '7af012fc94a34dd42e72d32c246a47140ec2861a':
  Only allow toolbox exec where /system exec was already allowed.
2015-08-25 23:43:46 +00:00
Stephen Smalley
a3c97a7660 Only allow toolbox exec where /system exec was already allowed.
When the toolbox domain was introduced, we allowed all domains to exec it
to avoid breakage.  However, only domains that were previously allowed the
ability to exec /system files would have been able to do this prior to the
introduction of the toolbox domain.  Remove the rule from domain.te and add
rules to all domains that are already allowed execute_no_trans to system_file.
Requires coordination with device-specific policy changes with the same Change-Id.

Change-Id: Ie46209f0412f9914857dc3d7c6b0917b7031aae5
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-08-25 12:46:07 -04:00
Nick Kralevich
e9ac2d6d5d am 48d98e35: Merge "system_server: remove old dalvik JIT rules on user/userdebug builds"
* commit '48d98e35419f74fe515ec560277726081c2fd0e3':
  system_server: remove old dalvik JIT rules on user/userdebug builds
2015-08-24 22:09:38 +00:00
Nick Kralevich
23cde8776b system_server: remove old dalvik JIT rules on user/userdebug builds
On user and userdebug builds, system_server only loads executable
content from /data/dalvik_cache and /system. JITing for system_server
is only supported on eng builds. Remove the rules for user and
userdebug builds.

Going forward, the plan of record is that system_server will never
use JIT functionality, instead using dex2oat or interpreted mode.

Inspired by https://android-review.googlesource.com/98944

Change-Id: I54515acaae4792085869b89f0d21b87c66137510
2015-08-23 21:34:55 -07:00
Nick Kralevich
4734a636d3 am acfd140c: Merge "eliminate some anr_data_file permissions."
* commit 'acfd140c045d0bd295389a508ef6952acefb91fc':
  eliminate some anr_data_file permissions.
2015-08-22 19:21:42 +00:00
Nick Kralevich
979adffd45 eliminate some anr_data_file permissions.
Init is now responsible for creating /data/anr, so it's
unnecessary to grant system_server and dumpstate permissions
to relabel this directory. Remove the excess permissions.

Leave system_data_file relabelfrom, since it's possible we're
still using it somewhere.

See commits:
  https://android-review.googlesource.com/161650
  https://android-review.googlesource.com/161477
  https://android-review.googlesource.com/161638

Bug: 22385254
Change-Id: I1fd226491f54d76ff51b03d4b91e7adc8d509df9
2015-08-12 17:01:57 -07:00
Jeffrey Vander Stoep
cd68c3a84e am 6f7de297: Merge "Do not allow apps to access network address file"
* commit '6f7de297b3e67942cdc525b6f626a811ddf5132e':
  Do not allow apps to access network address file
2015-07-29 16:26:31 +00:00
Jeff Vander Stoep
e45cad770c Do not allow apps to access network address file
Bug: 18068520
Bug: 21852542
Change-Id: I876b37ac31dd44201ea1c1400a7c2c16c6a10049
2015-07-29 08:24:06 -07:00
William Roberts
75d095a214 am 7028bdcc: neverallow: domain execute data_file_type
* commit '7028bdccd5b3e91928d345990587738212973f1d':
  neverallow: domain execute data_file_type
2015-07-09 19:00:21 +00:00
William Roberts
7028bdccd5 neverallow: domain execute data_file_type
To help reduce code injection paths, a neverallow is placed
to prevent domain, sans untrusted_app and shell, execute
on data_file_type. A few data_file_type's are also exempt
from this rule as they label files that should be executable.

Additional constraints, on top of the above, are placed on domains
system_server and zygote. They can only execute data_file_type's
of type dalvikcache_data_file.

Change-Id: I15dafbce80ba2c85a03c23128eae4725703d5f02
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-07-08 00:45:24 +00:00
Tao Bao
51b33ac90b Allow system server and uncrypt to operate pipe file
System server and uncrypt need to communicate with a named pipe on the
/cache partition. It will be created and deleted by system server.

Bug: 20012567
Bug: 20949086
(cherry picked from commit 70c6dbf06c)
Change-Id: I4ddc523c2a0f4218877dae8f8a9b7fcf3f786625
2015-06-09 14:59:59 -07:00
Narayan Kamath
01898ea4aa Revert "Allow system_server to link,relabel and create_dir dalvikcache_data_file."
This reverts commit e929ad8b524a7e444008b657adaafff97b5dea79.

bug: 20889739
Change-Id: I6729f4e26041b481f2442a2d8c3dfb42e2d4144a
2015-06-05 13:45:39 +01:00
Narayan Kamath
41f233f465 Allow system_server to link,relabel and create_dir dalvikcache_data_file.
Required by the installation flow for split APKs.

bug: 20889739

Change-Id: I3e14335f3bcfe76d1d24d233f53a728a6d90e8a1
2015-06-04 11:07:24 +00:00
Tao Bao
12e8b61bc0 Merge "Allow system server and uncrypt to operate pipe file" into mnc-dev 2015-05-28 21:47:45 +00:00
Tao Bao
70c6dbf06c Allow system server and uncrypt to operate pipe file
System server and uncrypt need to communicate with a named pipe on the
/cache partition. It will be created and deleted by system server.

Bug: 20012567
Bug: 20949086
Change-Id: I9494a67016c23294e803ca39d377ec321537bca0
2015-05-27 17:06:40 -07:00
Jim Miller
83554d2c92 Merge "Selinux: Allow system_server to create fpdata dir." into mnc-dev 2015-05-22 01:42:29 +00:00
Jim Miller
a39b131e9d Selinux: Allow system_server to create fpdata dir.
Fixes avc errors;
avc: denied { relabelto } for name="fpdata" dev="mmcblk0p28" ino=586465 scontext=u:r:system_server:s0 tcontext=u:object_r:fingerprintd_data_file:s0 tclass=dir permissive=0
avc: denied { read } for name="fpdata" dev="mmcblk0p28" ino=586409 scontext=u:r:system_server:s0 tcontext=u:object_r:fingerprintd_data_file:s0 tclass=dir permissive=0

Change-Id: I3ba16af14632d803e09ac1490af9a0b652cba3a6
2015-05-21 17:43:28 -07:00
Chad Brubaker
b3df4389f3 Merge "Rename keystore methods and delete unused permissions" into mnc-dev 2015-05-21 17:26:54 +00:00
Jim Miller
264eb6566a Add selinux policy for fingerprintd
Change-Id: Ibcb714248c28abf21272986facaade376dcbd7ef
2015-05-19 18:28:45 -07:00
dcashman
807d8d0249 Label /dev/rtc0 as rtc_device.
Grant access to system_server, as it is used by AlarmManagerService.

(cherry-pick of c7594898db)

Change-Id: I8b5795cb4739bb7fb6b2673d0b1b12be40db7a7f
2015-05-18 14:18:11 -07:00
dcashman
c7594898db Label /dev/rtc0 as rtc_device.
Grant access to system_server, as it is used by AlarmManagerService.

Change-Id: I4f099fe30ba206db07d636dd454d43d3df9d3015
2015-05-18 14:01:37 -07:00
Chad Brubaker
eaa1a1e975 Rename keystore methods and delete unused permissions
Keystore is going through an API cleanup to make names more clear and
remove unclear methods.

(cherry-picked from commit cbc8f79655)

Change-Id: I06354ccd0a9a73fd20168bfce9350c451cfaced3
2015-05-18 12:19:19 -07:00
Chad Brubaker
77a824600b Add keystore user_changed permission
user_changed will be used for state change methods around android user
creation/deletion.

(cherry-picked from commit 520bb816b8)

Change-Id: I295ca9adfc4907b5d7bcf0555f6e5a9a3379635b
2015-05-18 16:26:41 +01:00
Chad Brubaker
cbc8f79655 Rename keystore methods and delete unused permissions
Keystore is going through an API cleanup to make names more clear and
remove unclear methods.

Change-Id: I06354ccd0a9a73fd20168bfce9350c451cfaced3
2015-05-14 13:49:24 -07:00
Adam Lesinski
3526a6696f Allow system_server to read/write /proc/uid_cputime/ module
Bug:20182139
Change-Id: I1829a83c7d8e2698715e424a688a2753d65de868
2015-05-13 04:47:32 +00:00
Chad Brubaker
520bb816b8 Add keystore user_changed permission
user_changed will be used for state change methods around android user
creation/deletion.

Change-Id: I295ca9adfc4907b5d7bcf0555f6e5a9a3379635b
2015-05-12 13:24:43 -07:00
William Roberts
2f5a6a96bd Replace unix_socket_connect() and explicit property sets with macro
A common source of mistakes when authoring sepolicy is properly
setting up property sets. This is a 3 part step of:
1. Allowing the unix domain connection to the init/property service
2. Allowing write on the property_socket file
3. Allowing the set on class property_service

The macro unix_socket_connect() handled 1 and 2, but could be
confusing for first time policy authors. 3 had to be explicitly
added.

To correct this, we introduce a new macros:
set_prop(sourcedomain, targetprop)

This macro handles steps 1, 2 and 3.

No difference in sediff is expected.

(cherrypicked from commit 625a3526f1)

Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
Signed-off-by: William Roberts <william.c.roberts@linux.intel.com>
2015-05-07 10:32:06 -07:00
William Roberts
625a3526f1 Replace unix_socket_connect() and explicit property sets with macro
A common source of mistakes when authoring sepolicy is properly
setting up property sets. This is a 3 part step of:
1. Allowing the unix domain connection to the init/property service
2. Allowing write on the property_socket file
3. Allowing the set on class property_service

The macro unix_socket_connect() handled 1 and 2, but could be
confusing for first time policy authors. 3 had to be explicitly
added.

To correct this, we introduce a new macros:
set_prop(sourcedomain, targetprop)

This macro handles steps 1, 2 and 3.

No difference in sediff is expected.

Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
Signed-off-by: William Roberts <william.c.roberts@linux.intel.com>
2015-05-07 00:02:59 +00:00
Nick Kralevich
1301f2b64b am 2a7a4037: am 2234f9ff: gatekeeperd: neverallow non-system_server binder call
* commit '2a7a403724370ebe16f05602685a654ca4448d59':
  gatekeeperd: neverallow non-system_server binder call
2015-04-10 04:34:58 +00:00
Nick Kralevich
2234f9ff57 gatekeeperd: neverallow non-system_server binder call
The current neverallow rule (compile time assertion)

  neverallow { domain -gatekeeperd -system_server } gatekeeper_service:service_manager find;

asserts that no rule is present which allows processes other than
system_server from asking servicemanager for a gatekeeperd token.

However, if system_server leaks the token to other processes, it may
be possible for those processes to access gatekeeperd directly, bypassing
servicemanager.

Add a neverallow rule to assert that no process other than system_server
are allowed to make binder calls to gatekeeperd. Even if another process
was to manage to get a binder token to gatekeeperd, it would be useless.

Remove binder_service() from gatekeeperd. The original use of the
binder_service() macro was to widely publish a binder service.
If this macro is present and the calling process has a gatekeeperd
binder token, it's implicitly possible for the following processes
to make a binder call to gatekeeperd:

 * all app processes
 * dumpstate
 * system_server
 * mediaserver
 * surfaceflinger

Removing binder_service revokes this implicit access.

Add explicit access for system_server to make binder calls to
gatekeeperd.

Add explicit access for gatekeeperd to make calls to keystore.
This was implicitly granted via binder_service() before, but now
needs to be explicit.

Change-Id: I23c1573d04ab670a42660d5922b39eecf4265b66
2015-04-09 12:55:38 -07:00
dcashman
710c5a2af9 am 29f90b1e: am 7f2bb0c1: Merge "Enforce more specific service access."
* commit '29f90b1eb7376b39d94cd5d981a15ff8317a5cdb':
  Enforce more specific service access.
2015-04-09 17:47:22 +00:00
dcashman
bd7f5803f9 Enforce more specific service access.
Move the remaining services from tmp_system_server_service to appropriate
attributes and remove tmp_system_server and associated logging:

registry
restrictions
rttmanager
scheduling_policy
search
sensorservice
serial
servicediscovery
statusbar
task
textservices
telecom_service
trust_service
uimode
updatelock
usagestats
usb
user
vibrator
voiceinteraction
wallpaper
webviewupdate
wifip2p
wifi
window

Bug: 18106000
Change-Id: Ia0a6d47099d82c53ba403af394537db6fbc71ca0
2015-04-09 09:45:54 -07:00
dcashman
2686b6ab80 am 18867dbb: am 03a6f64f: Enforce more specific service access.
* commit '18867dbb42f128db00f6c8ee4f05fd098d9eaaa4':
  Enforce more specific service access.
2015-04-08 22:07:21 +00:00