Commit graph

2714 commits

Author SHA1 Message Date
Tri Vo
7f5c49235f Merge "Constrain cgroups access."
am: 99f2477953

Change-Id: Ib2dd4f787fb6fb00234ee70d2a6e1569b3d96fd5
2018-10-11 09:44:01 -07:00
Tri Vo
f55c989d18 Constrain cgroups access.
What changed:
- Removed cgroup access from untrusted and priv apps.
- Settings app writes to /dev/stune/foreground/tasks, so system_app domain
retains access to cgroup.
- libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
abundantly in native code. So added a blanket allow rule for (coredomain - apps)
to access cgroups.
- For now, only audit cgroup access from vendor domains. Ultimately, we want to
either constrain vendor access to individual domains or, even better, remove
vendor access and have platform manage cgroups exclusively.

Changes from original aosp/692189 which was reverted:
- There seem to be spurious denials from vendor-specific apps. So added
back access from { appdomain -all_untrusted_apps -priv_app } to cgroup.
Audit this access with intent to write explicit per-domain rules for it.

Bug: 110043362
Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
/dev/memcg on a per app basis on a device that supports that.
Test: aosp_sailfish, wahoo boot without cgroup denials
This reverts commit cacea25ed0.
Change-Id: I05ab404f348a864e8409d811346c8a0bf49bc47a
2018-10-10 17:41:09 -07:00
Tri Vo
fc25373422 Merge "Label /data/asan/* libs as system_lib_file."
am: 9a06d551c6

Change-Id: Ib00c42dea5a1f89b9a45c01df80680ecf7a76381
2018-10-10 13:43:57 -07:00
Sooraj Sasindran
ffaf66d48b Add ians service contexts
Add ians service contexts

Bug: 113106744
Test: verified from service list that ianas is
      registered
Change-Id: Iea653416ffa45cba07a544826e0a2395d31cedca
Merged-In: Iea653416ffa45cba07a544826e0a2395d31cedca
2018-10-10 20:43:05 +00:00
Tri Vo
45d521a577 Label /data/asan/* libs as system_lib_file.
This patch gives global access to asan libraries. This is not ideal since the
labeling is not symmetric with standard locations, but this approach is easy to
maintain.

Fixes: 117555408
Test: processes on asan builds load /data/asan/* libs correctly
Change-Id: If54558c1808d8b16e06073c150c9f3eb358dda67
2018-10-10 11:23:00 -07:00
Nick Kralevich
d3d4fe8e8c Merge "Move to ioctl whitelisting for plain files / directories"
am: ae079b88bb

Change-Id: I334de5f9528e4b84fc656b95de2832b6e63502df
2018-10-10 08:55:52 -07:00
Nick Kralevich
6a4f72fecc Revert "Constrain cgroups access."
am: cacea25ed0

Change-Id: I501b64576a2f059ce5c56064777cad07251d72cb
2018-10-10 06:10:40 -07:00
Nick Kralevich
ebc3a1a34c Move to ioctl whitelisting for plain files / directories
Remove kernel attack surface associated with ioctls on plain files. In
particular, we want to ensure that the ioctls FS_IOC_ENABLE_VERITY and
FS_IOC_MEASURE_VERITY are not exposed outside a whitelisted set of
entities. However, it's straight forward enough to turn on ioctl
whitelisting for everything, so we choose to do so.

Test: policy compiles and device boots
Test: device boots with data wipe
Test: device boots without data wipe
Change-Id: I545ae76dddaa2193890eeb1d404db79d1ffa13c2
2018-10-10 13:02:57 +00:00
Nick Kralevich
cacea25ed0 Revert "Constrain cgroups access."
This reverts commit 9899568f6c.

Reason for revert: Reports of high numbers of SELinux denials
showing up on the SELinux dashboard.

Bug: 110043362
Change-Id: Id8fc260c47ffd269ac2f15ff7dab668c959e3ab0
2018-10-10 04:25:17 +00:00
Tri Vo
0b4e4f47f7 Constrain cgroups access.
am: 9899568f6c

Change-Id: I253a0b620daa55663eda04baecba2d2ffd925925
2018-10-09 16:52:32 -07:00
Tri Vo
9899568f6c Constrain cgroups access.
What changed:
- Removed cgroup access from untrusted and priv apps.
- Settings app writes to /dev/stune/foreground/tasks, so system_app domain
retains access to cgroup.
- libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
abundantly in native code. So added a blanket allow rule for (coredomain - apps)
to access cgroups.
- For now, only audit cgroup access from vendor domains. Ultimately, we want to
either constrain vendor access to individual domains or, even better, remove
vendor access and have platform manage cgroups exclusively.

Bug: 110043362
Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
/dev/memcg on a per app basis on a device that supports that.
Test: aosp_sailfish, wahoo boot without cgroup denials
Change-Id: I9e441b26792f1edb1663c660bcff422ec7a6332b
2018-10-09 23:42:06 +00:00
Igor Murashkin
9a88ef46a9 Merge "iorapd: Add new binder service iorapd."
am: 77e40fbd06

Change-Id: Ibf6517366094b6d47cc0e1551b2ed709c3b10937
2018-10-09 16:29:10 -07:00
Treehugger Robot
77e40fbd06 Merge "iorapd: Add new binder service iorapd." 2018-10-09 23:09:16 +00:00
Sudheer Shanka
f8990c95e0 Allow zygote to search sdcardfs dirs.
am: 684cdb6615

Change-Id: Ic2f5eb4f8c66143bb92135effc893aa7519b7b37
2018-10-09 10:32:49 -07:00
Howard Ro
e9e8d0163a Allow zygote to write to statsd and refactor
am: 98de322a03

Change-Id: I2c4b8f3fe83d9f21c7194d9aafd2654f48596320
2018-10-08 16:25:09 -07:00
Sudheer Shanka
684cdb6615 Allow zygote to search sdcardfs dirs.
Bug: 117440207
Bug: 111890351
Test: manual
Change-Id: Ie218dec3e4f0f5dbade6d1c4d28b259909664056
2018-10-08 16:21:03 -07:00
Igor Murashkin
72a88b194c iorapd: Add new binder service iorapd.
This daemon is very locked down. Only system_server can access it.

Bug: 72170747
Change-Id: I7b72b9191cb192be96001d84d067c28292c9688f
2018-10-08 15:00:34 -07:00
Howard Ro
98de322a03 Allow zygote to write to statsd and refactor
We plan on migrating MetricsLogger to write to statsd socket. So we need to
allow zygote, which writes to logd using MetricsLogger, to also be able
to statsd. We also re-locate some sepolicies to write to statsd socket
in their respective policy definitions.

Bug: 110537511
Test: no failure/violations observed
Change-Id: I21fd352a25ed946516f9a45ac3b5e9bf97b059bc
2018-10-08 13:48:28 -07:00
Tri Vo
393ada790e asan: global read access to /system/asan.options
am: 93318192a0

Change-Id: I08b56ad2714f121b3f88bc545148e2b893d91325
2018-10-08 11:38:15 -07:00
Tri Vo
93318192a0 asan: global read access to /system/asan.options
Bug: 117178352
Test: no denials to /system/asan.options on asan walleye
Change-Id: I6042693afb926a22a3e2be79bd2a7ba062806143
2018-10-08 17:27:06 +00:00
Mark Salyzyn
2ecacbf915 fs_mgr: add /mnt/scratch to possible overlayfs support directories
am: 1369dfcaad

Change-Id: I0ce24e8f3ba8609e851ea767ea4b4386d0963385
2018-10-08 09:28:38 -07:00
Mark Salyzyn
1369dfcaad fs_mgr: add /mnt/scratch to possible overlayfs support directories
A default set of options are available, but can override in a fstab
overlay entry with upperdir=, lowerdir= to the same mount point,
workdir=.  The default is a valid /mnt/scratch/overlay/
or /cache/overlay/ directory, with .../<mount_point>/upper and
.../<mount_point>/work, associated with each system partition
<mount_point>.

Test: manual
Bug: 109821005
Change-Id: I5662c01fad17d105665be065f6dcd7c3fdc40d95
2018-10-08 14:23:01 +00:00
Christine Franks
dd76f14229 Merge "Add system_api_service to color_display_service"
am: 12bbbc69a1

Change-Id: I4ee2c40f80b7e08ecc8ebfc0660e19181f64de6f
2018-10-05 08:47:11 -07:00
Christine Franks
ce3e87c06a Add system_api_service to color_display_service
Bug: 111215474
Test: boots
Change-Id: Ib8cabeb64a8b4ec9f592d870bd0af611a2720cc7
2018-10-04 16:21:23 -07:00
Martijn Coenen
563e5b36e6 Add policy for apexd.
am: ac097ac4c7

Change-Id: Ic6958aa709f9b8253d15cef475864f845fc25715
2018-10-04 00:16:20 -07:00
Martijn Coenen
ac097ac4c7 Add policy for apexd.
apexd is a new daemon for managing APEX packages installed
on the device. It hosts a single binder service, "apexservice".

Bug: 112455435
Test: builds, binder service can be registered,
      apexes can be accessed, verified and mounted
Change-Id: I634ad100f10b2edcd9a9c0df0d33896fa5d4ed97
2018-10-04 07:06:45 +00:00
Tri Vo
bd8529a096 Merge "Only maintain maps between current and previous selinux versions."
am: d115b8ed24

Change-Id: Ia6a8419d469e7f4d04cf712f24c44b2d4fc756cd
2018-10-03 18:18:54 -07:00
Tri Vo
d115b8ed24 Merge "Only maintain maps between current and previous selinux versions." 2018-10-04 01:04:57 +00:00
Nick Kralevich
e62d7d1649 isolated_apps: no socket create
am: 8f08456a94

Change-Id: Iadacb3daf0047178275d18890fa89231526d9c8b
2018-10-03 15:07:11 -07:00
Nick Kralevich
8f08456a94 isolated_apps: no socket create
Isolated apps provide a very strict security guarantee, including the
inability to create networking sockets like TCP / UDP sockets. Add an
SELinux neverallow assertion to test for this and prevent regressions.

Test: policy compiles.
Change-Id: I2618abb17375707eb1048e89faa46f57d33e1df4
2018-10-02 21:43:20 -07:00
Tej Singh
330ad57629 Merge "Sepolicy for migrating storaged to statsd"
am: 7b785a9f5b

Change-Id: Ibd9008050fb810063bea4a83ce38779c0a858e77
2018-10-02 19:01:42 -07:00
Treehugger Robot
7b785a9f5b Merge "Sepolicy for migrating storaged to statsd" 2018-10-03 01:13:37 +00:00
Tri Vo
438684b39f Only maintain maps between current and previous selinux versions.
New maintenance scheme for mapping files:
Say, V is the current SELinux platform version, then at any point in time we
only maintain (V->V-1) mapping. (V->V-n) map is constructed from top (V->V-n+1)
and bottom (V-n+1->V-n) without changes to previously maintained mapping files.

Caveats:
- 26.0.cil doesn't technically represent 27.0->26.0 map, but rather
current->26.0. We'll fully migrate to the scheme with future releases.

Bug: 67510052
Test: adding new public type only requires changing the latest compat map
Change-Id: Iab5564e887ef2c8004cb493505dd56c6220c61f8
2018-10-02 15:10:13 -07:00
Howard Ro
b41dd1b54f Merge "Update sepolicies for stats hal"
am: aabee5fe5f

Change-Id: Ib271b23881eeff75f62613054714a11e8d67dc44
2018-10-02 14:06:31 -07:00
Howard Ro
aabee5fe5f Merge "Update sepolicies for stats hal" 2018-10-02 20:17:18 +00:00
Tri Vo
f5976f5490 Merge "Address TODOs in 28.0.cil mapping."
am: 0dd4167e2d

Change-Id: Id7b5dcbc37f69b4349f2aff96fb936feaef83798
2018-10-01 17:06:20 -07:00
Treehugger Robot
0dd4167e2d Merge "Address TODOs in 28.0.cil mapping." 2018-10-01 23:46:45 +00:00
Tri Vo
e4ab2cd286 Fix incorrect 27.0 mappings.
am: f509e02ddb

Change-Id: I6c9dc4a97b4f3c93b458452af7d1dcbd4ae84f6e
2018-10-01 16:13:27 -07:00
Tri Vo
4438339417 Address TODOs in 28.0.cil mapping.
Test: m selinux_policy
Change-Id: I6a8ff2200c82b6ecdc1404bc7cf186f439950a30
2018-10-01 14:32:05 -07:00
Tri Vo
f509e02ddb Fix incorrect 27.0 mappings.
Map proc_qtaguid_ctrl to qtaguid_proc, not qtaguid_device.
Map proc_slabinfo to proc in the correct place.

Test: m selinux_policy
Change-Id: I37c9dfe40bd20924215856b5d4ff7d9b3cbd0417
2018-10-01 13:46:50 -07:00
Jeff Vander Stoep
356900c73f Remove access to /proc/net/{tcp,udp}
am: 424517721c

Change-Id: Ie0278a2d0777f312a622e0243625c47ed4a38cf6
2018-10-01 06:53:09 -07:00
Jeff Vander Stoep
424517721c Remove access to /proc/net/{tcp,udp}
Remove these files from proc_net_type. Domains that need access must
have permission explicitly granted. Neverallow app access except the
shell domain.

Bug: 114475727
Test: atest CtsLibcoreOjTestCases
Test: netstat, lsof
Test: adb bugreport
Change-Id: I2304e3e98c0d637af78a361569466aa2fbe79fa0
2018-09-30 21:33:47 -07:00
Jeff Vander Stoep
649bfacb0d Merge "Remove untrusted app access to /proc/net"
am: c62bdd0ec1

Change-Id: Ibe8598a9513cda0c17ca7ad2702c6575afbe4af7
2018-09-30 21:14:15 -07:00
Treehugger Robot
c62bdd0ec1 Merge "Remove untrusted app access to /proc/net" 2018-10-01 03:58:50 +00:00
Sudheer Shanka
2b9560be50 Merge "Allow zygote to mount on sdcardfs dirs."
am: ea44744f94

Change-Id: I6f0bdb02dfad560a65dc332bc9a849dcd431b091
2018-09-28 16:24:51 -07:00
Sudheer Shanka
ea44744f94 Merge "Allow zygote to mount on sdcardfs dirs." 2018-09-28 23:19:24 +00:00
Howard Ro
578a189178 Update sepolicies for stats hal
Bug: 116732452
Test: No sepolicy violations observed with this change
(cherry picked from commit I1958182dd8ecc496625da2a2a834f71f5d43e7bb)

Change-Id: Ib386767d8acfacf9fedafd9a79dd555ce233f41c
2018-09-28 13:34:37 -07:00
Sudheer Shanka
4fc64db5c1 Allow zygote to mount on sdcardfs dirs.
Bug: 111890351
Test: manual
Change-Id: I37d632c9877c6d6f929937d8e25098763807630c
2018-09-28 13:28:46 -07:00
Chenbo Feng
cc5329be25 Merge "Block access to xt_qtaguid proc files"
am: 21eed51185

Change-Id: Id6bb84ad2e53935f1bc7f8f7a89dd58916635eb6
2018-09-28 12:16:09 -07:00
Jeff Vander Stoep
d78e07cbb7 Remove untrusted app access to /proc/net
This change is for testing potential app-compat issues when removing
access to file in /proc/net. See: b/114475727#comment11.

Bug: 114475727
Test: build/boot taimen.
Test: atest CtsLibcoreOjTestCases
Test: FileSystemPermissionTest
Test: ListeningPortsTest b/114772424
Change-Id: I1db1c2b41308e47c9ec9db57ea8597a650c8906d
(cherry picked from commit 6784f80bad)
2018-09-28 10:46:19 -07:00
Chenbo Feng
16dbe82eaf Block access to xt_qtaguid proc files
In the next Android release, there will be devices that have no
xt_qtaguid module at all and framework and netd will decide which code
path it takes for trafficStats depending on the device setup. So all
apps and services should not depend on this device specific
implementation anymore and use public API for the data they need.

Bug: 114475331
Bug: 79938294
Test: QtaguidPermissionTest

Change-Id: I0d37b2df23782eefa2e8977c6cdbf9210db3e0d2
2018-09-28 01:33:02 +00:00
Wei Wang
a15a0804bc Add atrace HAL 1.0 sepolicy
am: bc71a6109e

Change-Id: Iad34b6a0a8e4a9b885244804e07c93bc79f8731b
2018-09-27 16:27:11 -07:00
Wei Wang
bc71a6109e Add atrace HAL 1.0 sepolicy
Bug: 111098596
Test: atrace/systrace

(cherry picked from commit 9ed5cf6e43)

Change-Id: I97772ff21754d03a0aea0d53b39e8da5312a17c0
2018-09-27 23:18:29 +00:00
Nick Kralevich
dcd05ff6ef Introduce system_file_type
am: 5e37271df8

Change-Id: Ifc1a373f8aacb6b519b71dd23ec05b7c86f15e36
2018-09-27 15:28:16 -07:00
Nick Kralevich
2a63803348 Label /system/usr/share/zoneinfo differently
am: ff1c765ff2

Change-Id: I8765a406f9d075c76235220b68fd7dc79a15d12a
2018-09-27 15:28:03 -07:00
Nick Kralevich
5e37271df8 Introduce system_file_type
system_file_type is a new attribute used to identify files which exist
on the /system partition. It's useful for allow rules in init, which are
based off of a blacklist of writable files. Additionally, it's useful
for constructing neverallow rules to prevent regressions.

Additionally, add commented out tests which enforce that all files on
the /system partition have the system_file_type attribute. These tests
will be uncommented in a future change after all the device-specific
policies are cleaned up.

Test: Device boots and no obvious problems.
Change-Id: Id9bae6625f042594c8eba74ca712abb09702c1e5
2018-09-27 12:52:09 -07:00
Nick Kralevich
ff1c765ff2 Label /system/usr/share/zoneinfo differently
/system/usr/share/zoneinfo is currently labeled zoneinfo_data_file,
a label shared with /data/misc/zoneinfo. However, each of these
directory locations has different security characteristics. In
particular, the files in /system/usr/share/zoneinfo must never be
writable, whereas /data/misc/zoneinfo may be written to by system_server.
Reusing the same label hides these different security characteristics.

Create a separate label for /system/usr/share/zoneinfo.

Test: Device boots and no obvious problems.
Change-Id: I8cf16ff038b06b38f77388e546d9b7a6865f7879
2018-09-27 10:18:40 -07:00
Tri Vo
e4b212add6 Label /system/bin/linker* symlinks as system_file.
am: 6cd9bd078a

Change-Id: Ifb50348dfec882414d228ef83630c7b4379426e8
2018-09-24 18:33:14 -07:00
Tri Vo
6cd9bd078a Label /system/bin/linker* symlinks as system_file.
Fixes:
avc: denied { read } for comm="init" name="linker_asan64" dev="sda22" ino=1833
scontext=u:r:init:s0 tcontext=u:object_r:system_linker_exec:s0 tclass=lnk_file
permissive=0

Bug: 116486312
Test: adb unroot && adb shell ls -l /system/bin/linker_asan
Change-Id: I754daaf3576e83d516cc9189b8be04dcc41bbc5c
2018-09-24 16:22:38 -07:00
Fan Xu
cf728896d0 Update SELinux Policy for bufferhubd
am: 26fa914cb2

Change-Id: I52b6787ca2ad04f003ec446ce8ac96e375f67c7b
2018-09-24 15:05:57 -07:00
Fan Xu
26fa914cb2 Update SELinux Policy for bufferhubd
Create a new service type buffer_hub_binder_service for
BufferHubBinderService and allow bufferhubd to publish the service.

Add the service to 26.0, 27.0 and 28.0 compat ignore files since the
service is not available in past versions.

Fixes: 116022258
Test: build passed

Change-Id: I5a21f00329ed474433d96c8d1ce32377f20cada3
2018-09-24 12:29:43 -07:00
Oleksiy Avramchenko
3faa2077f2 Merge "Add label for /system/bin/fsck.exfat"
am: 06ddf4b44e

Change-Id: Iedb3581e79540611798a4738bca937af4cbfd5c9
2018-09-24 11:47:33 -07:00
Treehugger Robot
06ddf4b44e Merge "Add label for /system/bin/fsck.exfat" 2018-09-24 18:38:45 +00:00
Tej Singh
44d47c035e Sepolicy for migrating storaged to statsd
This adds /proc/uid_io/stats to the files that system server is able to
read.

Test: Manual test on master produces no selinux violations.
Change-Id: I2c7afec149f893b000094739d91531dec559de6f
2018-09-24 10:42:03 -07:00
Jeff Vander Stoep
90e1c5bfdb Further lock down app data
am: 0b67bb88e5

Change-Id: I84c231dee85060dee61c4c9b7f2187ef35b6ba6a
2018-09-24 09:40:25 -07:00
Oleksiy Avramchenko
65a0b50763 Add label for /system/bin/fsck.exfat
Allow vold to run exFAT filesystem check.

Test: build, mount exFAT volume
Bug: 80202067
Change-Id: I68f3438de89246e806cebe483f37e31c68aaa3d7
2018-09-24 14:04:05 +02:00
Jeff Vander Stoep
0b67bb88e5 Further lock down app data
Assert that only apps and installd may open private app files.

Remove "open" permission for mediaserver/vold and remove their
neverallow exemption.

Test: verify no related audit messages in the logs.
Test: build
Fixes: 80300620
Fixes: 80418809
Bug: 80190017
Change-Id: If0c1862a273af1fedd8898f334c9b0aa6b9be728
2018-09-22 22:38:42 -07:00
Kevin Chyn
e230d6ddc2 Merge "Rename biometric_prompt_service to biometric_service"
am: 7087bf1256

Change-Id: Ideab840443e5086464cb7d93325eaee4af111236
2018-09-21 20:54:16 -07:00
Kevin Chyn
7087bf1256 Merge "Rename biometric_prompt_service to biometric_service" 2018-09-22 03:47:00 +00:00
Tri Vo
70f1c88fa6 Merge "More granular vendor access to /system files."
am: 6816044271

Change-Id: I74d379a088d49e2bb24cd04732dfba8921d3230f
2018-09-21 18:36:55 -07:00
Tri Vo
6816044271 Merge "More granular vendor access to /system files." 2018-09-22 01:30:25 +00:00
Jeffrey Vander Stoep
535b319533 Merge "system_server: add policy for getConnectionOwnerUid API"
am: 7776cc3bc5

Change-Id: Id7d22621ff78a66836343763158582c0da87166f
2018-09-21 14:27:14 -07:00
Jeffrey Vander Stoep
7776cc3bc5 Merge "system_server: add policy for getConnectionOwnerUid API" 2018-09-21 21:04:20 +00:00
Kevin Chyn
75ded482df Rename biometric_prompt_service to biometric_service
Bug: 111461540
Bug: 112570477

Test: builds
Change-Id: Icc68720ebe931c2d917703b2d34aa0f4eec3f549
Merged-In: Icc68720ebe931c2d917703b2d34aa0f4eec3f549
2018-09-20 23:09:54 -07:00
Yifan Hong
fc433b5553 health.filesystem HAL renamed to health.storage
am: 1cef6a94eb

Change-Id: Ia7c2b0c347eb945777eac435c45df2683c556b80
2018-09-20 22:36:15 -07:00
Yifan Hong
1cef6a94eb health.filesystem HAL renamed to health.storage
...to reflect that the HAL operates on storage devices,
not filesystem.

Bug: 111655771
Test: compiles
Change-Id: Ibb0572cb1878359e5944aa6711331f0c7993ba6e
Merged-In: Ibb0572cb1878359e5944aa6711331f0c7993ba6e
2018-09-20 04:12:45 +00:00
Tri Vo
5c1fe61eaa More granular vendor access to /system files.
This change limits global access to /system files down to:
/system/bin/linker*
/system/lib[64]/*
/system/etc/ld.config*
/system/etc/seccomp_policy/*
/system/etc/security/cacerts/*
/system/usr/share/zoneinfo/*

Bug: 111243627
Test: boot device, browse internet without denials to system_* types.
Test: VtsHalDrmV1_{1, 0}TargetTest without denials
Change-Id: I69894b29733979c2bc944ac80229e84de5d519f4
2018-09-20 03:07:50 +00:00
Benjamin Gordon
881a7af904 sepolicy: grant dac_read_search to domains with dac_override
am: 342362ae3e

Change-Id: I1f0117a8062b3d0e10e7c367f30cc32c74f8041e
2018-09-19 18:46:54 -07:00
Benjamin Gordon
342362ae3e sepolicy: grant dac_read_search to domains with dac_override
kernel commit 2a4c22426955d4fc04069811997b7390c0fb858e (fs: switch order
of CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH checks) swapped the order of
dac_override and dac_read_search checks.  Domains that have dac_override
will now generate spurious denials for dac_read_search unless they also
have that permission.  Since dac_override is a strict superset of
dac_read_search, grant dac_read_search to all domains that already have
dac_override to get rid of the denials.

Bug: 114280985
Bug: crbug.com/877588
Test: Booted on a device running 4.14.
Change-Id: I5c1c136b775cceeb7f170e139e8d4279e73267a4
2018-09-19 15:54:37 -06:00
Primiano Tucci
b68ff9f6ae Allow perfetto traced_probes to poll /proc/{meminfo,stat,vmstat,...}
am: 51dc7cb1d4

Change-Id: Id8d4363a8dd635582183d92dc5de7196e373414f
2018-09-19 13:11:58 -07:00
Primiano Tucci
51dc7cb1d4 Allow perfetto traced_probes to poll /proc/{meminfo,stat,vmstat,...}
This allows the trace producer daemon to snapshot counters at
high frequency in the trace. As usual for Perfetto, this data is
NOT made available to arbitrary apps but only to an extremely
limited subset of processes governed by selinux rules (currently
shell and statsd).

Bug: 115956288
Change-Id: I7e1bfda4b568b9bac9012b198ecbb998da4f773d
2018-09-19 11:29:17 +00:00
Joel Galenson
f00c878632 Remove fixed bugs from bug_map.
am: 732e92b6fe

Change-Id: Idcffe7bd7df3960b4dae8fa4d34aacc4a2989337
2018-09-17 09:29:52 -07:00
Joel Galenson
732e92b6fe Remove fixed bugs from bug_map.
Test: Build.
Change-Id: I5c02916dfa3b2e8d5ba2bc586d05a69bd1f1254f
Merged-In: I150bc74b13a77f00a7e8b31a6c2edf9654bdbe59
2018-09-17 08:42:55 -07:00
Nick Kralevich
beebc53699 Strengthen ptrace neverallow rules
am: 095fbea563

Change-Id: I2da490badfceaf9bd1d9825c930a55aa86b2560b
2018-09-14 11:47:47 -07:00
Nick Kralevich
095fbea563 Strengthen ptrace neverallow rules
Add additional compile time constraints on the ability to ptrace various
sensitive domains.

llkd: remove some domains which llkd should never ptrace, even on
debuggable builds, such as kernel threads and init.

crash_dump neverallows: Remove the ptrace neverallow checks because
it duplicates other neverallow assertions spread throughout the policy.

Test: policy compiles and device boots
Change-Id: Ia4240d1ce7143b983bb048e046bb4729d0af5a6e
2018-09-14 18:32:20 +00:00
Jeff Vander Stoep
d1b14ab732 system_server: add policy for getConnectionOwnerUid API
Bug: 9496886
Bug: 109758967
Test: atest HostsideVpnTests
Change-Id: I1716d9c740b374b861e691b31ab271c681cf6bff
2018-09-13 21:29:12 -07:00
Yangster
62974e363a Merge "Allow stats_companion to register thermal throttling event listener."
am: 58de4843b6

Change-Id: I7b01217cd49944f1decf8a1b02af6653830b6507
2018-09-13 14:21:55 -07:00
Yangster
f8c2c14a07 Allow stats_companion to register thermal throttling event listener.
Test: manual test

BUG: b/112432890
Change-Id: If703cd25a2c0864ffd49bfdc83821fae291974b5
2018-09-13 09:18:33 -07:00
Nick Kralevich
9dcac0c594 Merge "add links to docs explaining motivations behind neverallow assertions."
am: 7826a7879c

Change-Id: I5f36f6f66d0b94486fea5baed9bf1a427e004909
2018-09-12 19:35:04 -07:00
Treehugger Robot
7826a7879c Merge "add links to docs explaining motivations behind neverallow assertions." 2018-09-13 02:13:24 +00:00
Nick Kralevich
40085222ca Merge "Change priv-apps /data/data labels to privapp_data_file"
am: 6a14368c16

Change-Id: I0e6c226f25cca58ca2715417a856df80e80442f8
2018-09-12 17:15:57 -07:00
Nick Kralevich
6cf9160e82 add links to docs explaining motivations behind neverallow assertions.
Test: comments only. Policy compiles.
Change-Id: Ic51533d37fff6c553950a122f33a48e3c119c67c
2018-09-12 15:53:48 -07:00
Nick Kralevich
5d1755194a Change priv-apps /data/data labels to privapp_data_file
Currently, both untrusted apps and priv-apps use the SELinux file label
"app_data_file" for files in their /data/data directory. This is
problematic, as we really want different rules for such files. For
example, we may want to allow untrusted apps to load executable code
from priv-app directories, but disallow untrusted apps from loading
executable code from their own home directories.

Commit 23c9d91b46 introduced a new type
called privapp_data_file and added rules necessary to preserve
compatibility. However, that change did not relabel any existing files,
so effectively the change was a no-op.

This change performs the switch, relabeling priv-app's /data/data files
from app_data_file to privapp_data_file. Due to the compatibility rules
added in 23c9d91b46, there should be no
noticeable effect from this change.

This change was originally submitted as
4df57822fc. However, it was reverted in
cdc6649acc due to a different labeling
bug. That bug has been fixed, and we can reapply this change.

Test: Factory reset and boot - no problems on fresh install.
Test: Upgrade to new version and test. No compatibility problems on
      filesystem upgrade.
Bug: 112357170
2018-09-12 12:30:32 -07:00
Hector Dearman
94574f3715 Merge "Make system_server atrace category work with traced_probes"
am: 9e6c78f73f

Change-Id: I744ab8cbdbef8c39d3f6d7ef7c5bfc2a31475bf7
2018-09-12 07:27:49 -07:00
Hector Dearman
9e6c78f73f Merge "Make system_server atrace category work with traced_probes" 2018-09-12 14:07:07 +00:00
Benjamin Gordon
e24f2d6a2c Merge "sepolicy: Allow apps to read ashmem fds from system_server"
am: f434377515

Change-Id: I2aa6a90d0217a8471b6538b747e9ab98b3c3dcd6
2018-09-10 10:43:35 -07:00
Treehugger Robot
f434377515 Merge "sepolicy: Allow apps to read ashmem fds from system_server" 2018-09-10 17:33:20 +00:00
Benjamin Gordon
360559e7bb sepolicy: Allow apps to read ashmem fds from system_server
Kernel commit 8a2af06415ef0fc922162503dd18da0d9be7771f (ashmem: switch
to ->read_iter) switched ashmem from using __vfs_read to vfs_iter_read
to read the backing shmem file.  Prior to this, reading from an ashmem
fd that was passed between processes didn't hit any permission checks;
now SELinux checks that the receiver can read from the creator's file
context.

Some apps receive buffers through ashmem from system_server, e.g., the
settings app reads battery stats from system_server through ashmem when
an app details page is opened.  Restore this ability by giving apps read
access to system_server_tmpfs.  system_server is still responsible for
creating and passing across the ashmem buffers, so this doesn't give
apps the ability to read anything system_server isn't willing to give
them.

Bug: 112987536
Bug: 111381531
Test: atest android.appsecurity.cts.PermissionsHostTest on kernel 4.14
Change-Id: Ice5e25f55bc409e91ad7e8c7ea8b28ae213191a3
2018-09-10 17:04:09 +00:00
Hector Dearman
244bc7cf97 Make system_server atrace category work with traced_probes
Historically most uses of atrace happen via the shell domain.

There are two exceptions:
- boot tracing
- traced_probes

We need to get feature parity, so atrace has the same behavior
when is invoked either via shell or from its own domain (e.g.
via traced_probes that has an auto_trans rule into atrace on exec).
Atrace works by setting system properties to enable tracing from userspace
then poking all the binder services to read the system properties (see [1]) so
enabling the system_server category requires the ability to call binder
methods on the system_server.

For more use cases see b/113127224

[1]: 9ead54bed6/cmds/atrace/atrace.cpp (545)

Bug: 113127224
Test: Add an atrace category to the Perfetto config and confirm the data
shows up.

Change-Id: Id077eff960ffb1cdd7b0ce84b21ac9ef70444a4a
2018-09-10 14:03:27 +01:00
Nick Kralevich
7496d3827d Add nnp_nosuid_transition policycap and related class/perm definitions.
am: 1b1d133be5

Change-Id: I3fa539a472a0ac382205ad206fe56a36949d222c
2018-09-07 19:43:47 -07:00