Commit graph

16948 commits

Author SHA1 Message Date
David Brazdil
535c5d2be0 Remove 'dex2oat_exec' from untrusted_app
Remove the permission to execute dex2oat from apps targetSdkVersion>28.
This has been historically used by ART to compile secondary dex files
but that functionality has been removed in Q and the permission is
therefore not needed.

Some legacy apps do invoke dex2oat directly. Hence allow (with audit) for
targetSdkVersion<= 28.

Test: atest CtsSelinuxTargetSdk25TestCases
Test: atest CtsSelinuxTargetSdk27TestCases
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Bug: 117606664
Change-Id: I2ea9cd56861fcf280cab388a251aa53e618160e5
2018-11-19 23:47:39 +00:00
Lalit Maganti
41ddb80cd8 Merge "sepolicy: add rules for traced_probes to capture stderr and kill atrace on timeout" 2018-11-19 21:54:28 +00:00
Florian Mayer
0f3decf2f5 Property to enable heap profile from process startup.
This is world-readable so it can be checked in libc's process init.

Test: m
Test: flash sailfish

Bug: 117821125

Change-Id: Iac7317ceb75b5ad9cfb9adabdf16929263fa8a9d
2018-11-19 21:52:43 +00:00
Treehugger Robot
e80631ff53 Merge "Add new cpu variant related rules to SELinux" 2018-11-19 21:37:32 +00:00
Hongyi Zhang
d600c0c380 allow system_server to read device_config_reset_performed_prop
system server reads this property to keep track of whether server
configurable flags have been reset during current boot.
system server needs this information to decide whether to perform
following disaster recovery actions on framework level.

the get_prop added in this cl in system_server.te is not grouped
in the same place as the set_prop in system_server.te in another
cl (https://android-review.googlesource.com/c/platform/system/sepolicy/+/828284).
This is because these 2 properties are serving for different purposes:
device_config_flags_health_check_prop is used to control features(so will be
all the future set_prop added by other feature teams under "# server configurable flags properties"),
while device_config_reset_performed_prop is used by our API's internal implementation.
So I feel like it might be clearer if I put this get_prop in a different place rather than
appending to "# server configurable flags properties".

Test: build suceeded.

Change-Id: I64379aa8f0bbe093969b98d62093696a32aabe59
2018-11-19 18:52:14 +00:00
Haibo Huang
544a0d5480 Add new cpu variant related rules to SELinux
I added ro.bionic.(2nd_)?_(arch|cpu_variant) to vendor system
properties. And have init to write them to files under dev/.

This change set SELinux rules for these properties and files.

For the system properties: vendor/default.prop will set them. init will
read them.
For the files /dev/cpu_variant:.*: init will write them. bionic libc
will read them. (Basically world readable).

This is to allow libc select the right optimized routine at runtime.
Like memcpy / strcmp etc.

Test: getprop to make sure the properties are set.
Test: ls -laZ to make sure /dev/cpu_variant:.* are correctly labeled.

Change-Id: I41662493dce30eae6d41bf0985709045c44247d3
2018-11-19 18:29:36 +00:00
Hongyi Zhang
745d3839e4 Merge "sepolicies for sys prop enabling flag health check" 2018-11-19 17:48:55 +00:00
Treehugger Robot
b1f6942c79 Merge "vold: remove access to /proc/net files" 2018-11-19 16:01:28 +00:00
Nicolas Geoffray
99ce20e52e Merge "Allow zygote to JIT." 2018-11-18 19:14:15 +00:00
Treehugger Robot
39a39054fb Merge "Audit /dev access that might no longer be needed after Treble" 2018-11-18 15:17:51 +00:00
Nicolas Geoffray
6949a392b3 Allow zygote to JIT.
bug: 110870380
Test: device boots, artificially creating a rwx mapping in zygote works.

Change-Id: I81a32b616a68f186867af25528a0348d1ad73a50
2018-11-17 19:46:11 +00:00
Bruno Martins
7bff13f9e8 sepolicy: Grant mediaextractor access to files over all types of sdcard fs
* Account for all possible sdcard-related filesystem types and not only
   sdcardfs:

   public/file.te:108:type fuse, sdcard_type, fs_type, mlstrustedobject;
   public/file.te:109:type sdcardfs, sdcard_type, fs_type, mlstrustedobject;
   public/file.te:111:type vfat, sdcard_type, fs_type, mlstrustedobject;
   public/file.te:112:type exfat, sdcard_type, fs_type, mlstrustedobject;

Change-Id: Ic508397bf4ca66a002ada33ac3f600c17b8a1a10
2018-11-17 19:05:53 +00:00
Jiyong Park
b1feedc2b1 Allow domain to getattr on apex_mnt_dir
The dynamic linker calls realpath(3) on paths found in the linker config
script. Since realpath() calls lstat() on the parent paths, not allowing
getattr on /apex and its subdirectories will cause selinux denial spam
whenever something is executed from APEXes.

Silence the spam by allowing getattr on apex_mnt_dir.

Bug: 117403679
Bug: 115787633
Test: m apex.test; m; device is bootable

Change-Id: Ic659582760a3ae146e73770266bc64332b36a97c
2018-11-17 04:05:49 +00:00
Treehugger Robot
b16dcf5f87 Merge "Set filecontext for the test apex" 2018-11-17 03:52:26 +00:00
Nick Kralevich
1c5d223b16 vold: remove access to /proc/net files
The auditallow added in commit
7a4af30b38 ("Start the process of locking
down proc/net", May 04 2018), has not been triggered. This is safe to
delete.

Test: Policy compiles
Test: no collected SELinux denials
Bug: 68016944
Change-Id: Ib45519b91742d09e7b93bbaf972e558848691a80
2018-11-16 17:46:56 -08:00
Tri Vo
d918c8df78 Remove redundant cgroup type/labelings.
cgroup is labeled from genfs_contexts. Also, cgroup filesystems can't be
context mounted, i.e. it's not possible to mount them with a label other
than "cgroup".

Bug: 110962171
Test: m selinux_policy
Test: boot aosp_walleye
Change-Id: I8319b10136c42a42d1edaee47b77ad1698e87f2c
2018-11-17 01:24:49 +00:00
Tri Vo
fe14d483da Merge "Don't label /dev/cam from system sepolicy" 2018-11-17 01:12:02 +00:00
Tri Vo
3e09808915 Audit /dev access that might no longer be needed after Treble
Bug: 110962171
Test: boot aosp_walleye, aosp_blueline, no log spam from new audit
Change-Id: Ibeeb317e2cf15584395e3dbb73eb01b827e19a09
2018-11-16 17:05:16 -08:00
Treehugger Robot
c2f8f67bbf Merge "SEPolicy for InputFlinger Service." 2018-11-17 00:40:21 +00:00
Hongyi Zhang
da492f4fca sepolicies for sys prop enabling flag health check
device_config_flags_health_check_prop is used for enabling/disabling
program flags_health_check which is executed during device booting.
"1" means enabling health check actions in flags_health_check, other
values mean flags_health_check will not perform any action.

Test: build succeeded & manual test
Change-Id: I93739dc5d155e057d72d08fd13097eb63c1193b5
2018-11-17 00:09:36 +00:00
Treehugger Robot
6e92480d6c Merge "[SEPolicy] Name GPU service back to "gpu"" 2018-11-16 23:44:30 +00:00
Treehugger Robot
02ce98eab4 Merge "remove system_server debugfs:file r_file_perms" 2018-11-16 22:52:38 +00:00
Robert Carr
a49b27af44 SEPolicy for InputFlinger Service.
Add an InputFlinger service in system_server and allow SurfaceFlinger to
exchange sockets with it.

Test: None
Bug: 80101428
Bug: 113136004
Bug: 111440400
Change-Id: I1533ab7a1da0ca61d8a28037fffbc189d796f737
2018-11-16 21:52:01 +00:00
Tri Vo
ddda7e8020 Don't label /dev/cam from system sepolicy
With Treble, cameraserver no longer depends on camera devices directly.
Moreover, pixel 3 doesn't have /dev/cam node.

We still keep "camera_device" type around since vendor policy uses it to
label its /dev nodes.

Bug: 110962171
Test: boot aosp_walleye
Test: camera app still works
Change-Id: If12d640c2a0006b9fc3c9f6704285eb8eb66c626
2018-11-16 21:08:21 +00:00
Yiwei Zhang
174a025d06 [SEPolicy] Name GPU service back to "gpu"
Changed the GPU service name back to be compatible with external
engines/tools' usage of vkjson cmd.

Bug: 118347356
Test: adb shell cmd gpu vkjson
Change-Id: Ie432fd8be63d33070ad037c509467c8367b42d39
2018-11-16 12:58:35 -08:00
Nick Kralevich
fe4061da83 remove system_server debugfs:file r_file_perms
Auditallow added in commit 72edbb3e83 ("Audit generic debugfs access for
removal", May 01 2018) has not triggered. Remove allow rule and tighten
up neverallow rule.

Test: policy compiles
Test: no collected SELinux denials.
Change-Id: I9a90463575f9eab4711b72d6f444fa9d526b80e1
2018-11-16 11:29:44 -08:00
Joel Galenson
3d533078ab Allow vendor_init to relabelfrom unlabeled.
This will be needed if vendors remove a label, as vendor_init would
need to relabel from it (which would be unlabeled) to the new label.

Test: Build policy.
Change-Id: Ieea0fcd7379da26b2864b971f7773ed61f413bb9
2018-11-16 10:30:21 -08:00
Treehugger Robot
6567cc2653 Merge "Further protect app private data files" 2018-11-16 15:50:59 +00:00
Lalit Maganti
d6ae1a5e42 sepolicy: add rules for traced_probes to capture stderr and kill atrace on timeout
This CL adds rules to allow traced_probes to dup a pipe as the stderr
for atrace and also send a sigkill to atrace after a timeout.

This fixes b/119656920

Change-Id: Ie66aaba47c11ef7c733b442f35fee042b7c546fb
2018-11-16 14:47:19 +00:00
Jiyong Park
b23f71d97d Set filecontext for the test apex
Label the surfaceflinger binary as surfaceflinger_exec

Test: m apex.test; m; device is bootable

Change-Id: I22297ba514f7ba298a1d0d4b476a447f26e48078
2018-11-16 21:10:38 +09:00
Nick Kralevich
a194d3757a Tighten up handling of new classes
1b1d133be5 added the process2 class but
forgot to suppress SELinux denials associated with these permissions
for the su domain. Suppress them.

Ensure xdp_socket is in socket_class_set, so the existing dontaudit rule
in su.te is relevant. Inspired by
66a337eec6

Add xdp_socket to various other neverallow rules.

Test: policy compiles.
Change-Id: If5422ecfa0cc864a51dd69559a51d759e078c8e7
2018-11-16 03:10:14 -08:00
Nick Kralevich
598a75c11d Further protect app private data files
Remove the special case that allowed init to relabel app_data_file and
privapp_data_file. The auditallow added in
ab82125fc8 has never triggered.

Bug: 80190017
Test: policy compiles
Test: no SELinux denials collected for the auditallow rule
Change-Id: Ide7c31e1a0628464ec2fcf041e8975087c39166d
2018-11-16 01:03:11 -08:00
Treehugger Robot
e00ca14cbb Merge "Delete get_prop(su, ...) rules" 2018-11-16 06:16:30 +00:00
Treehugger Robot
118a106c63 Merge "Add placeholder iris and face policy for vold data directory" 2018-11-16 04:15:35 +00:00
Treehugger Robot
2924f6e7e9 Merge "Move coredomains rules from private/domain.te to private/coredomain.te" 2018-11-16 03:28:17 +00:00
Nick Kralevich
40d4b0b6cc Delete get_prop(su, ...) rules
It is unnecessary to use get_prop() rules for the su domain. The
su domain is always in permissive mode [1] and not subject to SELinux
enforcement. It's also possible these rules were added to avoid SELinux
denial log spam from showing up, however, there are already dontaudit
rules in place [2] to prevent this.

Delete the unnecessary rules.

[1] 96b62a60c2/private/su.te (19)
[2] 96b62a60c2/public/su.te (42)

Test: policy compiles
Change-Id: I5913f360738725bf915f0606d381029b9ba4318f
2018-11-15 19:01:19 -08:00
Treehugger Robot
96b62a60c2 Merge "Rename APEX file_contexts as <name>-file_context" 2018-11-16 02:24:59 +00:00
Kevin Chyn
92bde4b941 Add placeholder iris and face policy for vold data directory
Test: vold is able to create directories, ag/5534962

Bug: 116528212

Change-Id: I61dd8802c13b1c42d334a80b678ca6a877848fc2
2018-11-15 17:32:03 -08:00
Tri Vo
a289d523ea Move coredomains rules from private/domain.te to private/coredomain.te
We lose git history with this, but imo the rules being moved don't have
much reference material. Also, as we write more neverallow rules for
CKI, I'd like to consolidate them in private/coredomain.te

Test: m selinux_policy
Change-Id: I6d0c3d2af0c4dfe7dd3cb1d8836b4b5e00db37a4
2018-11-15 15:15:53 -08:00
Treehugger Robot
cf7f20cfb4 Merge "racoon: allow ioctl TUNSETIFF" 2018-11-15 21:48:22 +00:00
Treehugger Robot
3868557d0c Merge "Incidentd gets statsd incident section" 2018-11-15 21:44:27 +00:00
Tri Vo
c7f56cdc83 Remove kmem_device selinux type.
kmem_device was used to label /dev/mem and /dev/kmem. We already have
multiple layers of protection against those /dev nodes being present on
devices.

CTS checks that /dev/mem and /dev/kmem don't exist:
https://android.googlesource.com/platform/cts/+/master/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java#233

VTS enforces our base kernel configs, which have CONFIG_DEVKMEM and
CONFIG_DEVMEM disabled:
https://android.googlesource.com/kernel/configs/+/master/android-4.9/android-base.config#2

Bug: 110962171
Test: m selinux_policy
Change-Id: I246740684218dee0cddf81dabf84d4763a753cde
2018-11-15 21:31:56 +00:00
Treehugger Robot
fb79404e3a Merge "allow apps tun_device ioctl TUNGETIFF;" 2018-11-15 21:06:26 +00:00
Yifan Hong
77fd9dbda4 Merge "Allow BLKIOMIN and BLKALIGNOFF to super device in update_engine." 2018-11-15 18:56:10 +00:00
Nick Kralevich
3ddaa63bde racoon: allow ioctl TUNSETIFF
Used by
bf16586a33/main.c (116)

Addresses the following denial:

audit(0.0:8126): avc: denied { ioctl } for comm="racoon" path="/dev/tun" dev="tmpfs" ino=25329 ioctlcmd=0x54ca scontext=u:r:racoon:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=0

Test: policy compiles.
Change-Id: Ia26077d4a9e810c7006d4b979d6b7e9ca154b485
2018-11-15 10:32:45 -08:00
Treehugger Robot
46522131db Merge "Allow dumpstate to call gpuservice over binder" 2018-11-15 15:54:41 +00:00
Mårten Kongstad
f62362da52 Add idmap2 and idmap2d
Bug: 78815803
Test: builds, boots
Test: manual: adb shell idmap2 create ...
Test: manual: adb shell ps | grep -e idmap2d
Change-Id: I60852e15d99329896ff9de6559d1e7cd1c67e33d
2018-11-15 14:42:10 +00:00
Nick Kralevich
3b2df198d1 allow apps tun_device ioctl TUNGETIFF;
Commit 619c1ef2ac ("tun_device: enforce
ioctl restrictions") completely removed the ability of untrusted apps to
issue ioctl calls to tun_device. It turns out that this was too
aggressive. Wireshark apparently uses the TUNGETIFF ioctl.

Fixes the following denial:

audit(0.0:384744): avc: denied { ioctl } for comm=4173796E635461736B202332 path="/dev/tun" dev="tmpfs" ino=19560 ioctlcmd=54d2 scontext=u:r:untrusted_app:s0:c51,c257,c512,c768 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=1 app=com.wireguard.android

Test: policy compiles.
Change-Id: I71bb494036ea692781c00af37580748ab39d1332
2018-11-15 06:14:07 -08:00
Yifan Hong
8d32223bdc Allow BLKIOMIN and BLKALIGNOFF to super device in update_engine.
These ioctls are similar to BLKGETSIZE64; they return benign information
about the partition's alignment, and are used by liblp to optimally
align dynamic partition extents.

The system_block_device is included here because on retrofit devices,
the "super" partition is mapped to the system partition.

Test: manual OTA on retrofit device
Bug: 118506262
Change-Id: I3dd3c99d86d63f97bcd393cff374e27f5ed2da2e
2018-11-14 16:16:11 -08:00
Treehugger Robot
7ef01c34ed Merge "Allow iw to be run at init phase." 2018-11-14 23:09:33 +00:00