Commit graph

16270 commits

Author SHA1 Message Date
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
Treehugger Robot
ae079b88bb Merge "Move to ioctl whitelisting for plain files / directories" 2018-10-10 15:39:59 +00:00
Treehugger Robot
5d4a119233 Merge "kernel: allow write access to /data/misc/vold/virtual_disk" 2018-10-10 15:14:10 +00: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
Nick Kralevich
fb13ddda26 kernel: allow write access to /data/misc/vold/virtual_disk
The kernel thread which manages this file really needs read/write access
to this file, not read-only. This was suspected in b/36626310 but
apparently something must have changed in the kernel surrounding
permission checking for kernel threads (still unknown)

Bug: 36626310
Bug: 117148019
Bug: 116841589
Test: policy compiles
Change-Id: I9c42541e2567a79b2d741eebf3ddf219f59478a9
2018-10-09 19:50:48 -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
Treehugger Robot
77e40fbd06 Merge "iorapd: Add new binder service iorapd." 2018-10-09 23:09:16 +00:00
Nick Kralevich
19d8ae9d4d ioctl_defines: add encryption ioctls
Test: policy compiles
Change-Id: I855ce7c706ebf11de8376b9f97b706d97419db4b
2018-10-09 14:18:49 -07:00
Tom Cherry
d04cae2f3c Merge "Add sepolicy labeling of wifi.concurrent.interface property." 2018-10-09 20:29:57 +00:00
Nick Kralevich
a605b04f88 ioctl_defines: Add F2FS ioctls
Test: policy compiles.
Change-Id: Icda25a34ce61c28fa2399a1f1f44c9ef7ba44745
2018-10-09 10:39:12 -07:00
Nick Kralevich
61fce68d66 ioctl_defines: sort file
Sort file by ioctl name. This will make it hopefully easier to find
entries.

Alternatives considered: sorting file by ioctl value. This has the
advantage that it's easier to map an SELinux ioctlcmd= avc message into
a variable name, but would otherwise make this file harder to read.

Test: policy compiles.
Change-Id: I09b1dd4c055446f73185b90c4de5f3cdd98eb4b7
2018-10-09 10:24:18 -07:00
jinhee0207.jo
2b09698a80 Add sepolicy labeling of wifi.concurrent.interface property.
1. "Add sepolicy labeling of wifi.concurrent.interface" in property_contexts.
wlan1 interface is added first in Pie OS. And wlan1 interface has getIfaceName
by property_get in wifi_chip.cpp.
(/hardware/interface/wifi/1.2/default/wifi_chip.cpp)
But, there is no sepolicy about this interface. wlan0 and p2p0 is definitely specified.
So, if we try to use wlan1, native sepolicy violation occurs.
This is why this labeling is necessary.

2. wlan1: Property labeling same with wlan0 or p2p0.
wifi.interface u:object_r:exported_default_prop:s0 exact string

Test: Basic Sanity - Verified tethering by using wlan1
Bug: 117302656

Change-Id: I24194bca7176e1927164228e6571870531a9bc56
Signed-off-by: Jinhee Jo <jinhee0207.jo@lge.com>
2018-10-09 16:20:16 +00: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
Treehugger Robot
dcd5b544a6 Merge "Unconditionally test mapping files." 2018-10-08 19:30:28 +00: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
Tri Vo
95cfd6904a Unconditionally test mapping files.
Part of an effort to remove Treble-specifics in the way be build
sepolicy.

Fixes: 64541653
Test: m selinux_policy for aosp_arm64
Change-Id: I9e42c720018674e7d3a6c47e01995401c4e748a7
2018-10-08 10:21:12 -07:00
Tri Vo
012c895602 Merge "Make persist.sys.locale public-readable." 2018-10-08 16:53:24 +00: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
Tri Vo
44005b4f2b Make persist.sys.locale public-readable.
Addresses this denial:
avc: denied { read } for comm="rild" name="u:object_r:system_prop:s0"
dev="tmpfs" ino=15811 scontext=u:r:rild:s0 tcontext=u:object_r:system_prop:s0
tclass=file permissive=0

Fixes: 77960261
Test: m selinux_policy
Change-Id: I341675a4cfc0acbb7ea98e2ed4bdb7f69afe09f7
2018-10-07 13:26:42 -07:00
Treehugger Robot
0ab9b61370 Merge "Add code to check for unescaped periods in file_contexts." 2018-10-07 01:33:31 +00:00
Joel Galenson
b5806c47c5 Add code to check for unescaped periods in file_contexts.
Test: Run script and find unescaped periods.
Change-Id: I35a4366aa576d5c6036d0dcfb068ca4e0f27fff9
2018-10-06 13:39:38 -07:00
Tri Vo
d58fa3a140 Merge "Remove ro.com.google.clientidbase from exported prop list." 2018-10-06 01:13:03 +00:00
Tri Vo
716d8bd849 Remove ro.com.google.clientidbase from exported prop list.
This property is GMS-specific. It should be set from either /system or /product.
After this change ro.com.google.clientidbase will have default_prop type and
will only be settable from an .rc file.

This property now must be set from system or product images. In case of a
system-only OTA, the old vendor.img might attempt set this property. This will
trigger a denial which is innocuous since the new system.img will correctly set
the property.

Bug: 117348096
Test: walleye can still set ro.com.google.clientidbase
Change-Id: Id0873baecacb4168415b1598c35af1ecbb411e17
2018-10-05 17:58:41 -07:00
Joel Galenson
2d123fce3c Ensure vold is a client of hal_bootctl only in Treble mode.
This fixes a build breakage.

Test: Build policy.
Change-Id: Id5209a2bd6446ac6dd744b7426f540bc1a8641ed
2018-10-05 12:37:05 -07:00
Christine Franks
12bbbc69a1 Merge "Add system_api_service to color_display_service" 2018-10-05 15:33:14 +00:00
Daniel Rosenberg
3d7521c226 Merge "Add bootctl for vold" 2018-10-05 01:31:17 +00: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
Treehugger Robot
3e5054e8fa Merge "Start enforcing /system file labeling" 2018-10-04 22:03:11 +00:00
Nick Kralevich
dab131b1f8 Start enforcing /system file labeling
system_file_type is an attribute assigned to all files on the /system
partition. Add a compile time test to ensure that the attribute is
assigned to all the relevant types.

Test: code compiles.
Change-Id: I7d69a04a4f04f6269cc408f25527b948756cc079
2018-10-04 11:24:00 -07:00
Tri Vo
2777d18c20 combine_maps: only use python2
python3 is not required on host machines.

Bug: 117260689
Test: m selinux_policy
Change-Id: Iea31eadcb3f09ffadca82dd1862cf5538259c710
2018-10-04 10:22:49 -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
d115b8ed24 Merge "Only maintain maps between current and previous selinux versions." 2018-10-04 01:04:57 +00:00
Daniel Rosenberg
ac5293b4fb Add bootctl for vold
Allows checkpoint commands to check A/B update status

Test: vdc checkpoint startCheckpoint -1
Bug: 111020314
Change-Id: I086db548d55176bf88211001c7c1eecb8c50689e
2018-10-03 15:51:45 -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
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
aabee5fe5f Merge "Update sepolicies for stats hal" 2018-10-02 20:17:18 +00:00
Treehugger Robot
0dd4167e2d Merge "Address TODOs in 28.0.cil mapping." 2018-10-01 23:46:45 +00: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
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
Treehugger Robot
c62bdd0ec1 Merge "Remove untrusted app access to /proc/net" 2018-10-01 03:58:50 +00:00
Treehugger Robot
f505d74410 Merge "Don't require private types in mapping file." 2018-09-29 02:57:20 +00:00
Tri Vo
e3f4f77d39 Don't require private types in mapping file.
Private types are not visible to vendor/odm policy, so we don't need mapping
entries for them.

We build platform-only public policy .cil file and give it as input to
treble_sepolicy_tests. Using this public policy the test can now figure out if
the newly added type in public or private.

Bug: 116344577
Test: adding public type triggers mapping test failure, adding private type does
not.
Change-Id: I421f335e37274b24aa73109e260653d7b73788b5
2018-09-28 17:22:25 -07:00
Sudheer Shanka
ea44744f94 Merge "Allow zygote to mount on sdcardfs dirs." 2018-09-28 23:19:24 +00:00
Yifan Hong
289132e355 Merge "update_engine: allow to r/w super partition metadata" 2018-09-28 23:03:47 +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