Commit graph

16874 commits

Author SHA1 Message Date
Hongyi Zhang
b965e3c5f9 Sepolicies for server configural flags reset
Test: m -j succeeded and manual tested on device

Change-Id: I3415c58335361a9da4ef2368e61bc4e0250a91bb
2018-11-09 18:55:55 +00:00
Mårten Kongstad
f40942ffd8 Add rules for /product{,_services}/overlay
These rules mirror those for /vendor/overlay and /odm/overlay, including
the possilibity of a symlink like /system/vendor -> /vendor.

Test: builds, boots
Change-Id: I323e48fcc13c4ac7779902506539c2600708cc88
2018-11-09 15:49:55 +00:00
Peiyong Lin
7924dc6054 [SEPolicy] Configure policy for gpu service.
Historically GPU service lives in SurfaceFlinger as a convenient hack.
Howerver, SurfaceFlinger doesn't need to know about anything specific about GPU
capability, and shouldn't know about anything about GPU. This patch moves GPU
service out of SurfaceFlinger.

GPU service is a service that accesses to GPU driver, queries GPU capabilities
and reports back. Currently we use this information in CTS and some benchmarks.

BUG: 118347356
Test: Build, flash and boot, use `adb shell cmd gpu vkjson` to verify
Change-Id: I007989e0f3f73b5caf80277979986820dd127c32
2018-11-08 12:31:11 -08:00
Treehugger Robot
ac6352d818 Merge "Allow bufferhub service to allocate buffer" 2018-11-08 19:41:54 +00:00
Treehugger Robot
e3c52b6934 Merge "Allow adbd to read perfetto_traces_data_file." 2018-11-08 18:29:30 +00:00
Yabin Cui
e7f1354c58 Merge changes from topic "runas_exec"
* changes:
  Add runas_app domain to allow running app data file via run-as.
  Revert "Revert "Enforce execve() restrictions for API > 28""
2018-11-08 17:55:30 +00:00
Treehugger Robot
5faae3ae87 Merge "apexd_prop is defined for PRODUCT_COMPATIBLE_PROPERTY = false case" 2018-11-08 16:16:34 +00:00
Florian Mayer
f270aea66a Allow adbd to read perfetto_traces_data_file.
This allows to use adb pull on Perfetto traces on user.

Bug: 118747482

Change-Id: Ie4deed90597b412ccb0e9e6512ffed2acead82d8
2018-11-08 16:13:55 +00:00
Martijn Coenen
6a62606115 Merge changes Ie0396d59,I75b2bade
* changes:
  Allow apexd to configure /sys/block/dm-
  Allow the kernel to access apexd file descriptors.
2018-11-08 15:28:53 +00:00
Martijn Coenen
341476d455 Allow apexd to configure /sys/block/dm-
To configure readahead for APEX dm-verity devices.

Bug: 117823094
Test: apexd can change readahead
Change-Id: Ie0396d59ef758ad55f499f65957697d26a48aae9
2018-11-08 13:58:41 +01:00
Martijn Coenen
ac2b2d44b3 Allow the kernel to access apexd file descriptors.
In earlier kernel versions (<4.0), the loopback driver issues
requests from a kernel thread. Therefore, the kernel needs access
to APEX file descriptors and data files (which are loopback
mounted).

Bug: 119220815
Test: mounting works on sailfish
Change-Id: I75b2bade41c64cf6fa6040d9c2f5489a206e04c6
2018-11-08 11:22:48 +01:00
Jiyong Park
b14c1a9674 apexd_prop is defined for PRODUCT_COMPATIBLE_PROPERTY = false case
apexd_prop is also defined in private/propery_contexts in order to make
the type to exist even when PRODUCT_COMPATIBLE_PROPERTY is false (i.e.,
Pixel 1).

Bug: 119220815
Test: m plat_property_contexts for sailfish
the built plat_property_contexts has apexd_prop defined

Change-Id: I9ef71410533c1f64fc6a3112cfcb199d23aaf3db
2018-11-08 11:29:01 +09:00
Kevin Chyn
52261e78c0 Add placeholder sepolicy for iris and face
See aosp/660242 and aosp/608396

Fixes: 116530289

Test: builds
Change-Id: I220ece0d6751839fe764ff91fd7bd20c50104f8f
2018-11-07 14:11:56 -08:00
Fan Xu
1e58323f94 Allow bufferhub service to allocate buffer
Test: build passed.
Bug: 118614333
Change-Id: I3b33d73a2cc7e78119de8b0913b4e2d0ac4a3235
2018-11-07 13:57:55 -08:00
Fan Xu
05668e4071 Merge "Remove buffer_hub_service compat mapping" 2018-11-07 18:27:05 +00:00
Yabin Cui
ffa2b61330 Add runas_app domain to allow running app data file via run-as.
Calling execve() on files in an app's home directory isn't allowed
for targetApi >=29. But this is needed by simpleperf to profile
a debuggable app via run-as.
So workaround it by adding runas_app domain, which allows running
app data file. And add a rule in seapp_contexts to use runas_app
domain for setcontext requests from run-as.

Bug: 118737210
Test: boot marlin and run CtsSimpleperfTestCases.
Change-Id: I5c3b54c95337d6d8192861757b858708174ebfd5
2018-11-07 18:11:40 +00:00
Yabin Cui
5dc2c8c740 Revert "Revert "Enforce execve() restrictions for API > 28""
This reverts commit 15d1a12f7f.

Bug: 118737210
Bug: 112357170
Test: boot marlin
Change-Id: Idcfab04b48f843eead4efa9f58a1337c6685c6ca
2018-11-07 18:07:18 +00:00
Tri Vo
2bb0085dbd Merge "Don't label /dev/{ akm8973.* accelerometer } from system sepolicy" 2018-11-06 22:43:49 +00:00
Tri Vo
fe39ed33dc Don't label /dev/{ akm8973.* accelerometer } from system sepolicy
These /dev nodes are device-specific and should be labeled from device
policy. Moreover, pixels don't have these /dev nodes.

Bug: 110962171
Test: boot pixel 3
Change-Id: I37ca9a956130eb4763c75f5e8a0decbd4f7b97a7
2018-11-06 10:20:50 -08:00
Fan Xu
2d74a45f76 Remove buffer_hub_service compat mapping
As b/116344577 is fixed, we no longer need the compatbility mapping any
more.

Test: build passed. Boot succeeded.
Change-Id: I0d7f02c59853d34bdabaad6841d87e9ca1ee25d7
2018-11-06 10:11:47 -08:00
Felipe Leme
2b76694814 Merge "New service: intelligence_service" 2018-11-06 17:26:30 +00:00
Tri Vo
2da651b0d5 Merge "Neverallow vendor access to system_file." 2018-11-06 16:27:55 +00:00
Luke Huang
c7eb1cd5f3 Clatd: allow clatd use ioctl
Test: built, flashed, booted
      Clatd works well
Bug: 119006129

Change-Id: Ie3b2a7b44040755787787ff2b8e6199cac7aec8e
2018-11-06 14:22:56 +09:00
Tri Vo
9410105cc7 Neverallow vendor access to system_file.
Bug: 111243627
Test: m selinux_policy
Change-Id: I37d03906b93c8810f1d33af736f19fd6ab241c35
2018-11-05 17:21:44 +00:00
Felipe Leme
5bf0c6369b New service: intelligence_service
Bug: 111276913
Test: manual verification

Change-Id: Icb309bb07e4e4b39cdc912b1d3dc1ece9cb55f5f
2018-11-05 09:18:03 -08:00
Kenny Root
41ab29eeb3 Allow SystemUI to talk to ADB service
Mark the ADB service as a system_api_service so that SystemUI can tell
it that the device is accepted. Refactoring split the AdbService out of
the UsbService. UsbService is marked as an app_api_service which SystemUI
is allowed to connect to; AdbService must be marked similarly as either
system_api_service or app_api_service. However, only system apps should
talk to AdbService currently.

SELinux : avc:  denied  { find } for service=adb pid=1737 uid=10041 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:adb_service:s0 tclass=service_manager permissive=0

Introduced in Change-Id Ibf23964665a115a5bc835820dcff98aaf7ba610f

Test: Flash userdebug, accept ADB key, and replug USB
Bug: 118999282
Change-Id: I47b5090908ed84d0ba7a9fca100b299011bf8796
2018-11-05 14:43:05 +00:00
Nick Kralevich
9d8f7eac8a sgdisk: allow BLKRRPART
Allow sgdisk to force the kernel to re-read the partition table.

Addresses the following denial:

avc: denied { ioctl } for path=/dev/block/vold/disk:7,0 dev=tmpfs ino=710640 ioctlcmd=125f scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

Bug: 118890056
Test: policy compiles
Test:
  1) adb shell sm set-force-adoptable on
  2) adb shell sm set-virtual-disk true
  3) On device, pick the drop-down notification and
     choose "use as phone/internal storage" to adopt the virtual SD card.
Change-Id: I6825cf526cc48aa2a17afab14eadb6134bfc56f9
2018-11-02 14:26:23 -07:00
Treehugger Robot
5c48444346 Merge "Update access_vectors" 2018-11-02 19:46:37 +00:00
Nick Kralevich
ced51ddd7c Merge "tun_device: enforce ioctl restrictions" 2018-11-02 12:21:04 +00:00
Jiyong Park
b3b94614f7 apexd exports its status via sysprop
A sysprop apexd.status is set by apexd, to that other components (i.e.
init) can determine whether APEXs are all successfully mounted or no
(i.e., being mounted).

The sysprop is only writable by apexd.

Bug: 117403679
Test: adb shell getprop apexd.status returns 'ready'.
Change-Id: I81bcb96e6c5cb9d899f29ffa84f91eab3820be25
2018-11-02 12:23:42 +09:00
Nick Kralevich
ea1775dcb5 Update access_vectors
Update access_vectors to support newer kernel functionality.
This change does not grant any new access.

Inspired by the following refpolicy commits:
* 25a5b24274
* 109ab3296b
* 437e48ac53

Bug: 118843234
Test: policy compiles
Change-Id: I7c5a8dcf288dc2321adcf368bd0c0573c5257202
2018-11-01 19:53:50 -07:00
Treehugger Robot
5152fc884f Merge "Don't check PRODUCT_SHIPPING_API_LEVEL to determine fake treble." 2018-11-01 22:24:43 +00:00
Treehugger Robot
f0dc5eae56 Merge "sgdisk: add blk_file ioctls" 2018-11-01 20:12:58 +00:00
Nick Kralevich
619c1ef2ac tun_device: enforce ioctl restrictions
Require all SELinux domains which have permission to perform ioctls on
/dev/tun explicitly specify what ioctls they perform. Only allow the
safe defaults FIOCLEX and FIONCLEX, which are alternate, uncommon ways
to set and unset the O_CLOEXEC flag.

Remove app's ability to issue *any* ioctls on /dev/tun, period. Add
neverallow assertions (compile time assertion + CTS test) to prevent
regressions.

Limit system_server's ability to perform ioctls on /dev/tun to FIOCLEX,
FIONCLEX, TUNGETIFF, and TUNSETIFF. Testing and source code examination
shows that only TUNGETIFF and TUNSETIFF are used by system_server.

The goal of this change is to put SELinux ioctl controls in place for
/dev/tun, so we don't have to maintain the custom kernel patch at
11cee2be0c%5E%21

Delete the neverallow assertion in isolated_app.te. This is already
covered by the assertion present in app_neverallows.te.

Test: cts-tradefed run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideVpnTests
Test: cts-tradefed run cts -m CtsHostsideNetworkTests
Test: cts-tradefed run cts -m CtsNetTestCases
Bug: 111560739
Bug: 111560570
Change-Id: Ibe1c3a9e880db0bee438535554abdbc6d84eec45
2018-11-01 12:13:27 -07:00
Treehugger Robot
691ee93921 Merge "sepolicy for server configurable flags" 2018-11-01 18:46:52 +00:00
Tri Vo
0d23383759 Don't check PRODUCT_SHIPPING_API_LEVEL to determine fake treble.
Emulator device can not be considered a full treble device even though
it has PRODUCT_SHIPPING_API_LEVEL = 28. This is prevents us from merging
neverallow rules that implement Treble requirements (aosp/798433). As a
temporary workaround, disable the checks on that variable.

Bug: 112933807
Bug: 113124961
Bug: 111243627
Test: m selinux_policy
Change-Id: I9a29c01dfcbc70e4ba1e4eef233355bc18ec2108
2018-11-01 10:04:32 -07:00
Nick Kralevich
79d36513cc sgdisk: add blk_file ioctls
Add support for the HDIO_GETGEO and BLKGETSIZE ioctls when operating on
/dev/block/vold/ block devices.

HDIO_GETGEO is needed by the sgdisk code to get the number of heads on
the disk drive, likely a side effect of the age of this code.
646af625ce/diskio-unix.cc (193)

Addresses the following denial:
  audit(0.0:1775): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x301 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

BLKGETSIZE is used to determine the size of the block device. Ideally
code should not be using this ioctl, as it fails for devices >= 2T in
size. Technically we don't need to grant this, as the sgdisk code will
fall back to using BLKGETSIZE64 if BLKGETSIZE fails.
646af625ce/diskio-unix.cc (430)

Addresses the following denial:
  audit(0.0:1778): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x1260 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

Test: policy compiles.
Change-Id: Iaa5274721e8a7d1741591570e9e5305723aad640
2018-11-01 08:23:00 -07:00
Mark Salyzyn
33442f57e7 fastboot: /mnt/scratch refined access on userdebug
Already has permissions to remove the scratch partition, but to allow
more refined cleansing (eg: just remove vendor override), need the
ability to mount and scrub overlay directories.

Test: manual
Bug: 117605276
Change-Id: Ibc272c0aa7ce207280023912f5f119ccf5079a7f
2018-11-01 14:57:01 +00:00
Minchan Kim
96c6d14c85 Merge "export init.svc.bugreport" 2018-11-01 04:35:27 +00:00
Hongyi Zhang
a6f989241b sepolicy for server configurable flags
Test: manual on device
Change-Id: Ibafe1b345489c88a49a7ed3e2e61e5cc5e1880a1
2018-11-01 03:28:56 +00:00
Treehugger Robot
f1a856e63d Merge "Reland "Default undefined PRODUCT_SHIPPING_API_LEVEL to fake treble"" 2018-11-01 00:55:55 +00:00
Minchan Kim
fac9bc0a62 export init.svc.bugreport
Vendor need to hook bugreport propery as well as dumpstatez.
This CL exports it.

Test: Confirmed verndor can get property trigger hook manually
Bug: 118718191
Change-Id: I64a0e38716fb863ccd8923c6c41a776ea341f2d1
Signed-off-by: Minchan Kim <minchan@google.com>
2018-11-01 09:32:33 +09:00
Treehugger Robot
b4afdea892 Merge "isolated_app: add mmaps" 2018-10-31 22:55:33 +00:00
David Anderson
16572cca61 Merge "Allow BLKIOMIN and BLKALIGNOFF ioctls to the super device in fastbootd." 2018-10-31 21:33:26 +00:00
Nick Kralevich
00252207f8 isolated_app: add mmaps
Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for mmap")
added a map permission check on mmap so that we can
distinguish memory mapped access (since it has different implications
for revocation). system/sepolicy commit
4397f08288 introduced the permission to
Android and updated common macros. Since then, we've been adding more
mmap support where it was accidentally omitted.

Add the ability for isolated_apps to mmap() app data files. There's no
reason why this should be blocked. Also fixup sdcard access which has
similar problems.

Bug: 118760652
Bug: https://crbug.com/892014
Test: policy compiles.
Change-Id: I3823f313103c9dcedf3b21d081a22f8fbb271c02
2018-10-31 12:55:01 -07:00
Nick Kralevich
caf42d615d Transient SELinux domain for system_server JIT
Create a transient SELinux domain where system_server can perform
certain JIT setup. The idea is that system_server will start in the
system_server_startup domain, setup certain JIT pages, then perform a
one-way transition into the system_server domain. From that point,
further JITing operations are disallowed.

Bug: 62356545
Test: device boots, no permission errors
Change-Id: Ic55b2cc5aba420ebcf62736622e08881a4779004
2018-10-31 12:32:01 +00:00
Treehugger Robot
29db0ebf3d Merge "Revert "Enforce execve() restrictions for API > 28"" 2018-10-31 09:31:02 +00:00
Nick Kralevich
15d1a12f7f Revert "Enforce execve() restrictions for API > 28"
This reverts commit 0dd738d810.

Reason for revert: CtsSimpleperfTestCases CTS test case failures.
See b/118704604 for details.

Bug: 112357170
Bug: 118704604
Change-Id: Ibe921f3bbc3404694542ef695883c1a30777d68b
2018-10-31 03:40:13 +00:00
David Anderson
bf0bf05a0c Allow BLKIOMIN and BLKALIGNOFF ioctls to the super device in fastbootd.
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.

Bug: 116802789
Test: fastboot flashall
Change-Id: I38282904828105cf5f16ce9d4b5884d2b0e89d38
2018-10-30 15:44:03 -07:00
Tri Vo
9087b77517 Reland "Default undefined PRODUCT_SHIPPING_API_LEVEL to fake treble"
This is a temporary measure to disable treble sepolicy tests for
non-compliant targets.

Bug: 113124961
Bug: 111243627
Change-Id: I83d6efad0ff5c7d87a4b990560c390b66aeb3653
Test: m selinux_policy
2018-10-30 21:09:41 +00:00