Commit graph

351 commits

Author SHA1 Message Date
Fyodor Kupolov
3189945192 Allow system_server to delete directories in preloads
(cherry picked from commit 028ed753b5)

avc: denied { rmdir } for name="apps" scontext=u:r:system_server:s0 tcontext=u:object_r:preloads_data_file:s0 tclass=dir permissive=0
avc: denied { rmdir } for name="demo" scontext=u:r:system_server:s0 tcontext=u:object_r:preloads_data_file:s0 tclass=dir permissive=0

Bug: 28855287
Change-Id: Ia470f94d1d960cc4ebe68cb364b8425418acdbd4
2016-09-15 09:31:05 -07:00
Wei Wang
88323b2e6d allow system_server to set bootanim scheduling priority
(cherry picked from commit 1617c0ce89)

Addresses the following denial:
     avc: denied { setsched } for pid=1405 comm="Binder:1094_3" scontext=u:r:system_server:s0 tcontext=u:r:bootanim:s0 tclass=process permissive=0

Maybe fix bug 30118894.

Bug: 30118894
Change-Id: I29be26c68094c253778edc8e4fef2ef1a238ee2e
2016-09-14 10:15:15 -07:00
Alex Light
b7ebb32fb2 Allow cppreopts to work with selinux
(cherry picked from commit d3edd6b577)

Bug: 29278988
Change-Id: I199572377a6b5c33116c718a545159ddcf50df30
2016-09-12 21:53:27 +00:00
Jeff Vander Stoep
bff9801521 Enforce ioctl command whitelisting on all sockets
Remove the ioctl permission for most socket types. For others, such as
tcp/udp/rawip/unix_dgram/unix_stream set a default unprivileged whitelist
that individual domains may extend (except where neverallowed like
untrusted_app). Enforce via a neverallowxperm rule.

Change-Id: I15548d830f8eff1fd4d64005c5769ca2be8d4ffe
2016-09-11 01:25:25 +00:00
Jeff Vander Stoep
7ef80731f2 audit domain_deprecated perms for removal
Grant permissions observed.

Bug: 28760354
Change-Id: Ie63cda709319bbf635ef7bffbba3477c2cccc11b
2016-09-10 07:42:55 -07:00
Christopher Wiley
1e1705190f Allow system_server to call wificond via Binder
WifiStateMachin: type=1400 audit(0.0:24): avc: denied { call } for
scontext=u:r:system_server:s0 tcontext=u:r:wificond:s0 tclass=binder
permissive=0

Bug: 29607308
Test: Above denial disapears

Change-Id: I9b5cfe414683991ffb6308eea612ca6750f1b8ec
(cherry picked from commit 71fb20be40)
2016-08-26 13:15:52 -07:00
Christopher Wiley
bf18eca5ce Separate permissions to set WiFi related properties
wificond would like to be able to set WiFi related properties
without access to the rest of the system properties.  Today,
this only involves marking the driver as loaded or unloaded.

avc: denied { write } for name="property_service" dev="tmpfs" ino=10100
scontext=u:r:wificond:s0 tcontext=u:object_r:property_socket:s0
tclass=sock_file permissive=0

Bug: 29579539
Test: No avc denials related to system properties across
      various WiFi events.

Change-Id: I6d9f1de3fbef04cb7750cc3753634f9e02fdb71f
(cherry picked from commit 1ebfdd6a14)
2016-08-26 13:15:52 -07:00
Chad Brubaker
28a896bf9a Allow system_server to make keystore_data_file links
am: a67411c952

Change-Id: If2ab59c09b2ccf444281fdf9003e36119eb7295f
2016-08-23 01:21:02 +00:00
Chad Brubaker
a67411c952 Allow system_server to make keystore_data_file links
Bug: 28746284
Change-Id: Ib5e294402c549d8ed6764722220484c5655951a9
2016-08-22 13:47:12 -07:00
dcashman
5e6aa65f62 resolve merge conflicts of 5423db6 to stage-aosp-master
Change-Id: I16706423534069f69bd0305ac500a9cd74db55a6
2016-08-05 15:01:15 -07:00
Daniel Micay
5423db6eb3 restrict access to timing information in /proc
These APIs expose sensitive information via timing side channels. This
leaves access via the adb shell intact along with the current uses by
dumpstate, init and system_server.

The /proc/interrupts and /proc/stat files were covered in this paper:

https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/

The /proc/softirqs, /proc/timer_list and /proc/timer_stats files are
also relevant.

Access to /proc has been greatly restricted since then, with untrusted
apps no longer having direct access to these, but stricter restrictions
beyond that would be quite useful.

Change-Id: Ibed16674856569d26517e5729f0f194b830cfedd
2016-08-05 13:57:25 -04:00
John Stultz
e4025649cf sepolicy: Add CAP_WAKE_ALARM to system_server.te
am: 19b6485f5e

Change-Id: I0574ab7e70a8b3d906a5b11368239d58d1d64e70
2016-08-03 06:51:46 +00:00
John Stultz
19b6485f5e sepolicy: Add CAP_WAKE_ALARM to system_server.te
With v4.8+ kernels, CAP_WAKE_ALARM is needed to set
alarmtimers via timerfd (this change is likely to be
backported to stable as well).

However, with selinux enabled, we also need to allow
the capability on the system_server so this enables it.

Change-Id: I7cd64d587906f3fbc8a129d48a4db07373c74c7e
Signed-off-by: John Stultz <john.stultz@linaro.org>
2016-08-02 20:15:44 -07:00
Daniel Rosenberg
c15090b315 sepolicy: Add policy for sdcardfs and configfs
Change-Id: I4c318efba76e61b6ab0be9491c352f281b1c2bff
Bug: 19160983
2016-07-22 13:34:23 -07:00
dcashman
aeebec14ac resolve merge conflicts of b71cf12 to nyc-dev-plus-aosp
Change-Id: I7100dbed3739dd96717438108a9562153b11613b
2016-06-16 12:57:27 -07:00
dcashman
17cfd3fce7 Keep pre-existing sysfs write permissions.
Commit: b144ebab48 added the sysfs_usb
type and granted the read perms globally, but did not add write
permissions for all domains that previously had them.  Add the ability
to write to sysfs_usb for all domains that had the ability to write to
those files previously (sysfs).

Address denials such as:
type=1400 audit(1904.070:4): avc:  denied  { write } for  pid=321 comm="ueventd" name="uevent" dev="sysfs" ino=1742 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_usb:s0 tclass=file permissive=0

Bug: 28417852
Change-Id: I4562ea73f2158ebefba74b58ca572f2176d1b849
2016-06-14 14:13:14 -07:00
Narayan Kamath
80fc29277c Merge "sepolicy: broaden system_server access to foreign_dex_data_file." into nyc-dev
am: ed413a827d

* commit 'ed413a827d285fb1f820189d4df25563cefcf5e6':
  sepolicy: broaden system_server access to foreign_dex_data_file.

Change-Id: Ibd428847a8292cdb47a03aadba133705f653447b
2016-06-06 13:47:57 +00:00
Narayan Kamath
d82df3bdb8 sepolicy: broaden system_server access to foreign_dex_data_file.
The system_server needs to rename these files when an app is upgraded.

bug: 28998083
Change-Id: Idb0c1ae774228faaecc359e4e35603dbb534592a
2016-06-02 15:44:12 +01:00
Fyodor Kupolov
72f0fbb2f7 SELinux policies for /data/preloads directory
am: 49ac2a3d7a

* commit '49ac2a3d7a40d998e3b1be0b0172be8f651bc935':
  SELinux policies for /data/preloads directory

Change-Id: Ib928cda316ef31f361ad09ef29b264eb9df754d5
2016-05-24 22:18:41 +00:00
Fyodor Kupolov
49ac2a3d7a SELinux policies for /data/preloads directory
A new directory is created in user data partition that contains preloaded
content such as a retail mode demo video and pre-loaded APKs.

The new directory is writable/deletable by system server. It can only be
readable (including directory list) by privileged or platform apps

Bug: 28855287
Change-Id: I3816cd3a1ed5b9a030965698a66265057214f037
2016-05-24 20:17:45 +00:00
Narayan Kamath
0bc35bd324 sepolicy: broaden system_server access to foreign_dex_data_file{dir}.
am: 13bdd39cf1

* commit '13bdd39cf1c4aa1f86623820aea167abf1b263f2':
  sepolicy: broaden system_server access to foreign_dex_data_file{dir}.

Change-Id: I9e41715e443f233275252c6a4cb5cce904c45f9c
2016-05-17 08:40:40 +00:00
Narayan Kamath
13bdd39cf1 sepolicy: broaden system_server access to foreign_dex_data_file{dir}.
The system_server needs to clear these markers along with other app
data that it's responsible for clearing.

bug: 28510916
Change-Id: If9ba8b5b372cccefffd03ffddc51acac8e0b4649
2016-05-16 18:01:16 +01:00
Andreas Gampe
3119945aaa Merge changes from topic \'dump_bluetooth_through_debuggerd\' into nyc-dev
am: 50c2909f23

* commit '50c2909f23df270f75d23e16de2bb9e5363b54dd':
  Sepolicy: Allow debuggerd to dump backtraces of Bluetooth
  Sepolicy: Refactor long lines for debuggerd backtraces

Change-Id: I0d3f68a422a4d8b14148343983f1d6a8a85ac268
2016-05-13 16:32:35 +00:00
Andreas Gampe
50c2909f23 Merge changes from topic 'dump_bluetooth_through_debuggerd' into nyc-dev
* changes:
  Sepolicy: Allow debuggerd to dump backtraces of Bluetooth
  Sepolicy: Refactor long lines for debuggerd backtraces
2016-05-13 16:27:57 +00:00
Andreas Gampe
cbfa8ddfb6 Sepolicy: Allow debuggerd to dump backtraces of Bluetooth
Allow to dump traces of the Bluetooth process during ANR
and system-server watchdog dumps.

Bug: 28658141
Change-Id: Ie78bcb25e94e1ed96ccd75f7a35ecb04e7cb2b82
2016-05-12 17:28:34 -07:00
Andreas Gampe
0983db4aa9 Sepolicy: Refactor long lines for debuggerd backtraces
Split single lines in preparation for new additions.

Bug: 28658141
Change-Id: I89f6a52bd2d145c53dd6bb39177578f51a352acf
2016-05-12 17:27:52 -07:00
Jeff Vander Stoep
e806cc9699 move gpsd domain to device specific policy am: 3ba2d46616
am: 30a5ea5c72

* commit '30a5ea5c72e61ac2a2025d938e644847ea31efc7':
  move gpsd domain to device specific policy

Change-Id: If892add123561972e6008615ce055de5c6befa9c
2016-05-13 00:15:05 +00:00
Jeff Vander Stoep
3ba2d46616 move gpsd domain to device specific policy
Only used by Flounder.

Bug: 8435593
Change-Id: I06655e897ab68a1724190950e128cd390617f2bd
2016-05-12 15:46:07 -07:00
Philip Cuadra
70f3aa9cc9 Merge "Add CAP_IPC_LOCK and pinner to system_server" into nyc-dev
am: 95fd38169b

* commit '95fd38169b867c0e45d11a9dbae698bc65e43a89':
  Add CAP_IPC_LOCK and pinner to system_server

Change-Id: I8619709d24449150e39b21461fca20788aba60f4
2016-05-12 22:05:22 +00:00
Philip Cuadra
95fd38169b Merge "Add CAP_IPC_LOCK and pinner to system_server" into nyc-dev 2016-05-12 21:55:29 +00:00
Philip Cuadra
96da70eb4f Add CAP_IPC_LOCK and pinner to system_server
Add pinner service to system_service services.
Add CAP_IPC_LOCK permissions to system_server in order to allow
system_server to pin more memory than the lockedmem ulimit.

bug 28251566

Change-Id: I990c73d25fce4f2cc9a2db0015aa238fa7b0e984
2016-05-04 17:39:41 -07:00
Christopher Tate
68d3d9f362 Allow the system to rename wallpaper files
am: 39cfed0b23

* commit '39cfed0b23c542cf4b95e0e2835c1886914f88ce':
  Allow the system to rename wallpaper files

Change-Id: I4404f9f9d9ffb78af3c50beefd1b1f220662d181
2016-05-02 17:48:45 +00:00
Christopher Tate
39cfed0b23 Allow the system to rename wallpaper files
Fast system -> lock wallpaper migration wants rename, not copy.

Bug 27599080

Change-Id: I4b07dff210fe952afb4675eecba3c5f7bf262e83
2016-04-29 18:42:50 -07:00
Treehugger Robot
3e23ae97eb Merge "reduce duplicate SELinux rules" am: b4720ae
am: d266768

* commit 'd266768a276670274f99feede6ecbccf7a7b480f':
  reduce duplicate SELinux rules

Change-Id: Id2ebcc7fb73442f34b643f074c7317ebfe60c41c
2016-04-23 19:15:25 +00:00
Nick Kralevich
349368244c reduce duplicate SELinux rules
When using domain_trans(init, foo_exec, foo), don't add the
following rule:

  allow foo init:process sigchld;

This is already allowed for all domains in domain.te:

  # Allow reaping by init.
  allow domain init:process sigchld;

So adding it over and over again is redundant and bloats the
policy. More specifically, when I run:

  sepolicy-analyze out/target/product/bullhead/root/sepolicy dups

this change reduces the number of duplicate policy statements
from 461 to 389.

Change-Id: I8632e5649a54f63eb1f79ea6405c4b3f515f544c
2016-04-23 11:14:06 -07:00
Andreas Gampe
c46ef41cfe Merge "Selinux: Policies for otapreopt_chroot and postinstall_dexopt" into nyc-dev
am: 8785a647a1

* commit '8785a647a15a5bf49c64756f59a48e1b4d551be3':
  Selinux: Policies for otapreopt_chroot and postinstall_dexopt

Change-Id: Icf7e37c3f1e6141d04a21a1b8ce4cd88bf185dbc
2016-04-22 16:09:29 +00:00
TreeHugger Robot
8785a647a1 Merge "Selinux: Policies for otapreopt_chroot and postinstall_dexopt" into nyc-dev 2016-04-22 16:04:33 +00:00
Andreas Gampe
e5d8a947bd Selinux: Policies for otapreopt_chroot and postinstall_dexopt
Give mount & chroot permissions to otapreopt_chroot related to
postinstall.

Add postinstall_dexopt for otapreopt in the B partition. Allow
the things installd can do for dexopt. Give a few more rights
to dex2oat for postinstall files.

Allow postinstall files to call the system server.

Bug: 25612095
Change-Id: If7407473d50c9414668ff6ef869c2aadd14264e7
2016-04-21 22:41:56 -07:00
mukesh agrawal
0d397af6a3 Merge changes I9cdd52a2,Idf00e7a6 into nyc-dev
am: fbb6d2de1c

* commit 'fbb6d2de1cf4d4ce6e86c353b963824b1b98d43b':
  allow system server to set log.tag.WifiHAL
  limit shell's access to log.* properties

Change-Id: I135fcb73d8cec20966e01c7a19f4a7e6b1002aad
2016-04-21 19:25:15 +00:00
Mukesh Agrawal
fbb6d2de1c Merge changes I9cdd52a2,Idf00e7a6 into nyc-dev
* changes:
  allow system server to set log.tag.WifiHAL
  limit shell's access to log.* properties
2016-04-21 19:11:33 +00:00
Christopher Tate
79677fbf51 Allow system_server to hard link its own files
am: d9b0a34

* commit 'd9b0a34ad4c0797e7e648c0dfa4ce0866f6d62fe':
  Allow system_server to hard link its own files

Change-Id: I8417d52812e847b01fa40d720659567aba25f27b
2016-04-20 22:19:45 +00:00
Christopher Tate
d9b0a34ad4 Allow system_server to hard link its own files
Specifically, backup of wallpaper imagery needs to use hard links to
achieve "real file" access to the large imagery files without rewriting
the contents all the time just to stage for backup.  They can't be
symlinks because the underlying backup mechanisms refuse to act on
symbolic links for other security reasons.

Bug 25727875

Change-Id: Ic48fba3f94c92a4b16ced27a23646296acf8f3a5
2016-04-20 12:47:59 -07:00
mukesh agrawal
e651f6f468 allow system server to set log.tag.WifiHAL
On eng and userdebug builds (only), allow system server
to change the value of log.tag.WifiHAL. WifiStateMachine
will set this property to 'D' by default. If/when a user
enables "Developer options -> Enable Wi-Fi Verbose Logging",
WifiStateMachine change log.tag.WifiHAL to 'V'.

BUG=27857554
TEST=manual (see below)

Test detail
1. on user build:
   $ adb shell setprop log.tag.WifiHAL V
   $ adb shell getprop log.tag.WifiHAL
   <blank line>
   $ adb bugreport | grep log.tag.WifiHAL
   <11>[  141.918517] init: avc:  denied  { set } for property=log.tag.WifiHAL pid=4583 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:wifi_log_prop:s0 tclass=property_service permissive=0
   <11>[  141.918566] init: sys_prop: permission denied uid:2000  name:log.tag.WifiHAL
2. on userdebug build:
   $ adb shell getprop log.tag.WifiHAL
   $ <blank line>
   $ adb shell setprop log.tag.WifiHAL V
   $ adb shell getprop log.tag.WifiHAL
   V
3. on userdebug build with modified WifiStateMachine:
   $ adb shell getprop log.tag.WifiHAL
   D

Change-Id: I9cdd52a2b47a3dd1065262ea8c329130b7b044db
2016-04-19 13:43:25 -07:00
Andy Hung
b939aa605a Merge "Unify dumped native stack traces" into nyc-dev
am: 70f6c34

* commit '70f6c34e92d9273db6d4425ee77bf209985129a1':
  Unify dumped native stack traces

Change-Id: I434fbabc8f4128ca8dcfb54f0d93a739728888ec
2016-04-14 21:04:51 +00:00
Andy Hung
f3bfc96b84 Unify dumped native stack traces
Bug: 28179196

Change-Id: I580f0ae2b3d86f9f124195271f6dbb6364e4fade
2016-04-13 19:38:29 -07:00
Nick Kralevich
693913a20f Merge "system_server: neverallow new file exec types" am: cce2f47
am: b71185f

* commit 'b71185fc1c3143ab78873cc2b9afcc2759179bd7':
  system_server: neverallow new file exec types

Change-Id: Ifb9f814819da7c49b36d3d3091c4e825db548879
2016-04-07 19:46:27 +00:00
Nick Kralevich
f84b798151 system_server: neverallow new file exec types
Add a neverallow rule (CTS test + compile time assertion) blocking
system_server from executing files outside of a few select file
types.

In general, it's dangerous to fork()/exec() from within a multi-threaded
program. See
https://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them
This change helps discourage the introduction of new execs.

Bug: 28035297
Change-Id: Idac824308183fa2cef75f17159dae14447290e5b
2016-04-06 11:14:07 -07:00
Jeff Sharkey
8ce8a30e2d Allow system_server to execute timeout.
am: 75b25dd

* commit '75b25dd1d603e73bb213c1545dba981e0d9d8333':
  Allow system_server to execute timeout.

Change-Id: I7e4ea88ca85ad6211211414cf885e9ad6b3ad6ce
2016-04-06 17:48:43 +00:00
Jeff Sharkey
75b25dd1d6 Allow system_server to execute timeout.
We've seen evidence that the logcat binary can end up wedged, which
means we can eventually starve system_server for FDs.  To mitigate
this, wrap logcat using the timeout utility to kill and clean up if
it takes too long to exit.

avc: denied { execute } for name="toybox" dev="mmcblk0p43" ino=457 scontext=u:r:system_server:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1
avc: denied { read open } for path="/system/bin/toybox" dev="mmcblk0p43" ino=457 scontext=u:r:system_server:s0tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1
avc: denied { execute_no_trans } for path="/system/bin/toybox" dev="mmcblk0p43" ino=457 scontext=u:r:system_server:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1

Bug: 27994717, 28021719, 28009200
Change-Id: I76d3c7fe5b37fb9a144a3e5dbcc9150dfea495ee
2016-04-06 10:23:02 -06:00
Daniel Rosenberg
d1ae5c67b7 Allow search/getattr access to media_rw_data_file for now.
am: b80bdef

* commit 'b80bdef034b603efc7333f678b2cef2ce26273f6':
  Allow search/getattr access to media_rw_data_file for now.

Change-Id: Ic85544f55ef5e66c935ab20a150fb1537a6d3f8b
2016-04-05 18:23:43 +00:00