Commit graph

16231 commits

Author SHA1 Message Date
Suren Baghdasaryan
c8ed855ede Selinux: Allow lmkd write access to sys.lmk. properties
Allow lmkd write access to sys.lmk. properties to be able to set
sys.lmk.minfree_levels.

Bug: 111521182
Test: getprop sys.lmk.minfree_levels returns value set by lmkd
Change-Id: I86ff11d75917966857d3a76876a56799bb92a5ad
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-10 20:05:46 +00:00
Yifan Hong
3dd465a097 Merge "Add sepolicy for health filesystem HAL" 2018-08-10 20:00:56 +00:00
Yifan Hong
0814795c79 Add sepolicy for health filesystem HAL
Test: builds
Test: vts
Bug: 111655771
Change-Id: Iabad3d124bf476cb624addf7d7898e0c2894d550
2018-08-10 11:02:21 -07:00
Chia-I Wu
c3aec707f1 Allow signals to hal_graphics_allocator_server
This is needed to dump ANR traces for the process.

Bug: 111604912
Test: adb shell am hang
Change-Id: Icadc2de95a12818fe623271d1afb955843ccddbf
2018-08-09 15:56:47 -07:00
Mathieu Chartier
291531ef46 Merge "Add missing pm.* properties in property_contexts" 2018-08-08 20:21:42 +00:00
Shibin George
d27b8612df Add missing pm.* properties in property_contexts
Certain pm.* properties, which are especially needed for
Go-targets, are not listed in property_contexts.
Init will not be able to set these properties on bootup
without the correct selinux contexts assigned to the
properties.

BUG: 111738816

Test: In selinux-enforcing mode, on bootup, these
      properties are now correctly set by init.

Change-Id: I6ea0fb229c93725e2987b1e021d5804a132d093d
2018-08-08 17:07:56 +00:00
Tri Vo
d98b728e9f Update comment on same_process_hal_file type.
Test: n/a
Change-Id: I929772fa36da6b96494d14cfa48b47dcc76cccd4
2018-08-08 17:03:03 +00:00
Treehugger Robot
ccfffe6e0d Merge "fs_mgr: add overlayfs handling for squashfs system filesystems" 2018-08-08 16:45:18 +00:00
Steven Moreland
75ba5a42f3 Merge "Fix type of ro.kernel.qemu: int -> bool" 2018-08-08 16:24:55 +00:00
Mark Salyzyn
9b398f3fb7 fs_mgr: add overlayfs handling for squashfs system filesystems
/cache/overlay directory in support of overlayfs mounts on userdebug
and eng devices.  Overlayfs in turn can be capable of supporting
adb remount for read-only or restricted-storage filesystems like
squashfs or right-sized (zero free space) system partitions
respectively.

Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I3ece03886db7cc97f864497cf93ec6c6c39bccd1
2018-08-08 07:33:10 -07:00
Nick Kralevich
f3eb985447 Remove legacy execmod access from API >= 26.
Text relocation support was removed from the linker for apps targeting
API >= 23. See
https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#text-relocations-enforced-for-api-level-23

However, the security policy was not updated to remove the execmod
permission at that time, since we didn't have support for targeting
SELinux policies to API versions.

Remove execmod permissions for apps targeting API 26 or greater. The
linker support was removed, so it's pointless to keep around the SELinux
permissions.

Retain execmod support for apps targeting API 25 or lower. While in
theory we could remove support for API 23-25, that would involve the
introduction of a new SELinux domain (and the associated rule
explosion), which I would prefer to avoid.

This change helps protect application executable code from modification,
enforcing W^X properties on executable code pages loaded from files.
https://en.wikipedia.org/wiki/W%5EX

Test: auditallow rules were added and nothing triggered for apps
      targeting API >= 26. Code compiles and device boots.
Bug: 111544476

Change-Id: Iab9a0bd297411e99699e3651c110e57eb02a3a41
2018-08-08 01:39:09 +00:00
Tri Vo
dd253e9019 Add support for RS vendor executables.
/vendor/bin/bcc being a dependency of renderscript should be labeled as
same_process_hal_file. To facilitate that we relax neverallow rules for
executing same_process_hal_file from coredomain.

See details on /vendor/bin/bcc:
https://source.android.com/devices/architecture/vndk/renderscript

Bug: n/a
Test: build-time change
Change-Id: Ie996fb863090bf08b3d3ef653da827d0b22937d7
2018-08-07 23:05:08 +00:00
Steven Moreland
c8ba909117 Fix type of ro.kernel.qemu: int -> bool
Bug: N/A
Test: boot
Change-Id: I67e3554383977c3fb5e89f236838a9cb39fb257e
2018-08-07 14:03:56 -07:00
Nick Kralevich
bd3e300a13 Relax some neverallow rules
Kernels above 4.14 have a new mmap permission. However, neverallow rules
exclude the use of mmap, even when file FDs are passable across the
vendor/non-vendor boundary. Since we allow reading / writing of passed
file descriptors, also allow the use of mmap for passed file
descriptors.

Bug: 112171217
Test: policy compiles
Change-Id: I8176f86960bdff0cf5de770809510e9df5d62db9
2018-08-07 13:47:36 -07:00
Nick Kralevich
d90d001a78 Revert "Remove legacy execmod access."
This reverts commit 0f11ffccf9.

Reason for revert: libmono crashes

Bug: 112292089
Bug: 111544476
Test: policy compiles, device boots
Change-Id: I064090aa9337cf17b80cd2c9af9342df851a3b27
2018-08-07 17:03:07 +00:00
Xin Li
c05fa1a5cf Merge Android Pie into master
Bug: 112104996
Change-Id: Icf411d8b04e12dd33dd82a26328b4156585cb5ff
2018-08-07 09:46:55 -07:00
Treehugger Robot
0860253239 Merge "fs_use: Enabled loading security xattrs for erofs" 2018-08-07 16:09:53 +00:00
Tom Cherry
07dfaec076 Merge "Second stage init is on system" 2018-08-07 16:08:55 +00:00
Gao Xiang
910cd95354 fs_use: Enabled loading security xattrs for erofs
Bug: 112292714
Change-Id: I0026c13fd4335e0365496bc00c26021d83f3c39d
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
2018-08-07 22:13:12 +08:00
Nick Kralevich
ca8749a0b3 auditallow app_data_file execute
am: 4738b93db2

Change-Id: I4278bd3d4e7786be716324d1817a81b6c19eec2e
2018-08-06 18:59:55 -07:00
Nick Kralevich
fed2c09cfa Delete untrusted_v2_app
am: 41b21ee96a

Change-Id: I85087c37b7c575e9b50d7090d155281d4f7c4f74
2018-08-06 15:35:16 -07:00
Nick Kralevich
4738b93db2 auditallow app_data_file execute
Executing files from an application home directory violates
W^X (https://en.wikipedia.org/wiki/W%5EX) constraints (loading executable code
from a writable file) and is an unsafe application behavior. Test to see if we
can get rid of it and establish some baseline metrics.

Test: device boots and no obvious problems.
Change-Id: I756c281fcbf750821307327642cc0d06605951b0
2018-08-06 14:49:45 -07:00
Nick Kralevich
41b21ee96a Delete untrusted_v2_app
As of https://android-review.googlesource.com/c/platform/system/sepolicy/+/536356 ,
the untrusted_v2_app domain is no longer used.

Bug: 112233317
Test: policy compiles, device boots, and no problems
Change-Id: I5a47c8305bef374b7fea06cd789e06cd48b847e6
2018-08-06 12:52:37 -07:00
Joel Galenson
1588241555 [automerger skipped] Allow ephemeral_app to execute system_file.
am: 8b2c858053  -s ours

Change-Id: If21fba6ab5506a8ba74a55d4cd816c218b4078b1
2018-08-06 12:41:26 -07:00
Joel Galenson
8b2c858053 Allow ephemeral_app to execute system_file.
(cherrypicked from commit f2afca7cf0)

Bug: 109653662
Test: Build policy.
Change-Id: I6c71a8bc24d7a144b801d16f1bcad31fb8f2aba5
Merged-In: I6c71a8bc24d7a144b801d16f1bcad31fb8f2aba5
2018-08-06 10:42:17 -07:00
Nick Kralevich
bd39081ea3 resolve merge conflicts of 601b4422ae to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ic6dd370d6549c9dd1eb1e690c1c2f2fa441624b9
2018-08-03 17:37:32 -07:00
Treehugger Robot
601b4422ae Merge "Change priv-apps /home/home labels to privapp_data_file" 2018-08-04 00:07:44 +00:00
Sudheer Shanka
19e85dfb68 Merge "Allow vold to mount at /mnt/user/.*"
am: c5601de4cd

Change-Id: Ie61645bd9b276f67e96ac7f823c1a1048a35ef8e
2018-08-03 16:10:04 -07:00
Tom Cherry
5f49b6a2d6 Allow init to execute services marked with seclabel u:r:su:s0 in userdebug/eng
am: 938ab05d72

Change-Id: If632608a9e7acc6e59b468674207bc80a4833a26
2018-08-03 16:07:11 -07:00
Tom Cherry
2faf4854d6 Second stage init is on system
Test: boot hikey
Change-Id: I8f26f858af8ccde1d7f4b346966bbb6bbeab5a92
2018-08-03 22:45:01 +00:00
Sudheer Shanka
c5601de4cd Merge "Allow vold to mount at /mnt/user/.*" 2018-08-03 22:25:58 +00:00
Nick Kralevich
4df57822fc Change priv-apps /home/home 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.

Test: Factory reset and boot - no problems on fresh install.
Test: Upgrade to new version and test. No compatibility problems on
      filesystem upgrade.

Merged-In: I9a476726bf01f4bcc7952d11fd57dba803a9fd8d
Change-Id: I23a26cd3906fc43cbd225c05c3a2abd3cab8bd06
2018-08-03 13:50:21 -07:00
Sudheer Shanka
a2bacea876 Allow vold to mount at /mnt/user/.*
Bug: 111890351
Test: Device boots and no selinux denials when vold mounts
      at /mnt/user/.*

Change-Id: Id962a85af9f99c54421f0820a22880be36c2e478
2018-08-03 12:55:09 -07:00
Tom Cherry
938ab05d72 Allow init to execute services marked with seclabel u:r:su:s0 in userdebug/eng
This is do aid developers pushing debug services to not need to modify
the underlying SEPolicy

avc: denied { transition } for comm="init" path="/system/bin/awk"
dev="dm-0" ino=1934 scontext=u:r:init:s0 tcontext=u:r:su:s0
tclass=process
avc: denied { rlimitinh } for comm="awk" scontext=u:r:init:s0
tcontext=u:r:su:s0 tclass=process
avc: denied { siginh } for comm="awk" scontext=u:r:init:s0
tcontext=u:r:su:s0 tclass=process
avc: denied { noatsecure } for comm="awk" scontext=u:r:init:s0
tcontext=u:r:su:s0 tclass=process

Test: init can execute a system_file marked with seclabel u:r:su:s0
Change-Id: I85d9528341fe08dbb2fb9a91e34a41f41aa093be
2018-08-03 19:41:03 +00:00
Tom Cherry
09386d41a8 Move watchdogd out of init and into its own domain
am: d840374e65

Change-Id: I93264ded0479ab0e101d0449c2ff52b9a92e3d6e
2018-08-03 12:39:53 -07:00
Tom Cherry
d840374e65 Move watchdogd out of init and into its own domain
Bug: 73660730
Test: watchdogd still runs
Change-Id: I31697c7c6fa2f7009731ff48c659af051838e42f
2018-08-03 19:28:05 +00:00
Nick Kralevich
930614c7e6 Start partitioning off privapp_data_file from app_data_file
am: 23c9d91b46

Change-Id: Id99688b1e9b4d8d43eb1833904ac47c2796166ab
2018-08-02 21:27:57 -07:00
Nick Kralevich
23c9d91b46 Start partitioning off privapp_data_file from app_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.

This change adds a new file type "privapp_data_file". For compatibility,
we adjust the policy to support access privapp_data_files almost
everywhere we were previously granting access to app_data_files
(adbd and run-as being exceptions). Additional future tightening is
possible here by removing some of these newly added rules.

This label will start getting used in a followup change to
system/sepolicy/private/seapp_contexts, similar to:

  -user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user
  +user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user

For now, this newly introduced label has no usage, so this change
is essentially a no-op.

Test: Factory reset and boot - no problems on fresh install.
Test: Upgrade to new version and test. No compatibility problems on
      filesystem upgrade.

Change-Id: I9618b7d91d1c2bcb5837cdabc949f0cf741a2837
2018-08-02 16:29:02 -07:00
Tom Cherry
dada008159 Merge "Allow ueventd to insert modules"
am: b520169832

Change-Id: I03af3fbdecde072ab326ee47fd614f7340aeb908
2018-08-02 12:40:54 -07:00
Tom Cherry
b520169832 Merge "Allow ueventd to insert modules" 2018-08-02 19:22:35 +00:00
Alan Stokes
a8898820d6 Remove legacy execmod access.
am: 0f11ffccf9

Change-Id: I0f85ecb4a1dc6464becce64fb8539cd2f8e1a779
2018-08-02 06:59:12 -07:00
Alan Stokes
0f11ffccf9 Remove legacy execmod access.
Remove the exemptions for untrusted apps and broaden the neverallow so
they can't be reinstated. Modifying executable pages is unsafe. Text
relocations are not supported.

Bug: 111544476
Test: Builds.
Change-Id: Ibff4f34d916e000203e38574bb063513e4428bb7
2018-08-02 11:57:16 +01:00
Tom Cherry
13f118314c Merge "allow init to run fsck for early mount partitions"
am: 9c8d054639

Change-Id: I8976234923363b2d05f1369753a453b6077c06fb
2018-08-01 14:11:43 -07:00
Tom Cherry
9c8d054639 Merge "allow init to run fsck for early mount partitions" 2018-08-01 21:02:35 +00:00
Tom Cherry
52a80ac1f1 Allow ueventd to insert modules
avc:  denied  { sys_module } for comm="ueventd" capability=16 scontext=u:r:ueventd:s0 tcontext=u:r:ueventd:s0 tclass=capability
avc:  denied  { module_load } for  pid=581 comm="ueventd" path="/vendor/lib/modules/module.ko" dev="dm-2" ino=1381 scontext=u:r:ueventd:s0 tcontext=u:object_r:vendor_file:s0 tclass=system
avc:  denied  { search } for  pid=556 comm="ueventd" scontext=u:r:ueventd:s0 tcontext=u:r:kernel:s0 tclass=key

Bug: 111916071
Test: ueventd can insert modules
Change-Id: I2906495796c3655b5add19af8cf64458f753b891
2018-08-01 13:21:20 -07:00
Bowgo Tsai
7f16c35ed7 Merge "Allowing vold to search /mnt/vendor/*"
am: 209c9066f4

Change-Id: Ic09209f75efba3d76963411666df8bfbe9d7965f
2018-07-31 23:40:03 -07:00
Treehugger Robot
209c9066f4 Merge "Allowing vold to search /mnt/vendor/*" 2018-08-01 06:31:39 +00:00
Tom Cherry
47157353af allow init to run fsck for early mount partitions
Bug: 111883560
Test: fsck runs successfully during early mount
Change-Id: I697d0ab8ba51824d5c5062b48370a73438311566
2018-07-31 13:58:54 -07:00
Nick Kralevich
a343844dee Allow mmap for vendor_init
am: 99ceb07ec1

Change-Id: Idf1d381cee6ba9946b9185a7d5f4475303ad8062
2018-07-30 21:05:44 -07:00
Nick Kralevich
99ceb07ec1 Allow mmap for vendor_init
vendor_init needs to touch a bunch of files. Forgotten within this set
of permissions is the ability to mmap files.

Addresses the following denial:

  avc:  denied  { map } for  pid=1167 comm="init" path="/system/etc/selinux/plat_file_contexts" dev="vda1" ino=1845 scontext=u:r:vendor_init:s0 tcontext=u:object_r:file_contexts_file:s0 tclass=file permissive=0

While I'm here, add mmap() support to other areas where it's likely
needed.

Bug: 111742629
Test: make -j80, ran emulator
Change-Id: Icab00e45ae88f0d86be66d85a22e018af6ffcd75
2018-07-30 18:57:53 -07:00