Commit Graph

5236 Commits

Author SHA1 Message Date
Jeffrey Vander Stoep
db60355f94 Merge "reland: untrusted_app_29: add new targetSdk domain" 2020-01-22 14:43:36 +00:00
Treehugger Robot
28304cc43a Merge "Add FS_IOC_FS(G|S)ETXATTR to ioctl_defines and allow vold to use it." 2020-01-22 14:31:47 +00:00
Martijn Coenen
e0ab03aee3 Add FS_IOC_FS(G|S)ETXATTR to ioctl_defines and allow vold to use it.
Bug: 146419093
Test: vold can call the ioctl
Change-Id: I409b702d00bc5ef5f42f9c613d8f89195fefb800
2020-01-22 10:53:33 +01:00
Jeff Vander Stoep
1f7ae8ee3f reland: untrusted_app_29: add new targetSdk domain
Enforce new requirements on app with targetSdkVersion=30 including:
- No RTM_GETLINK on netlink route sockets.

Remove some of the repetitive descriptions in each untrusted_app_N.te
file, and instead refer to the description in
public/untrusted_app.te.

Bug: 141455849
Test: CtsSelinuxTargetSdkCurrentTestCases
Test: libcore.java.net.NetworkInterfaceTest#testGetNetworkInterfaces
Change-Id: I89553e48db3bc71f229c71fafeee9005703e5c0b
2020-01-22 09:47:53 +00:00
Alistair Delva
3862b2778f Merge "recovery: Allow BLKPBSZGET on cache_block_device" 2020-01-22 01:32:51 +00:00
Steven Moreland
64c8ddb123 Merge "More neverallows for default_android_service." 2020-01-21 21:31:57 +00:00
Ryan Savitski
c9cc4001e4 Merge "Add sysprop for init's perf_event_open LSM hook check" 2020-01-21 20:40:50 +00:00
Steven Moreland
a30464c06e More neverallows for default_android_service.
We don't want to accidentally allow this, and a neverallow also means
that the issue will be found during development, instead of review.

Fixes: 148081219
Test: compile policy only
Change-Id: I57990a2a4ab9e5988b09dae2dd6a710ce8f53800
2020-01-21 11:13:22 -08:00
Ryan Savitski
52b3d315a2 Add sysprop for init's perf_event_open LSM hook check
Written exclusively by init. Made it readable by shell for CTS, and for
easier platform debugging.

Bug: 137092007
Change-Id: Ia5b056117502c272bc7169661069d0c8020695e2
2020-01-21 19:03:33 +00:00
Haoxiang Li
741b9cd5ac Sepolicy update for Automotive Display Service
Bug: 140395359
Test: make sepolicy -j
Change-Id: Ib6ddf55210d8a8ee4868359c88e3d177edce9610
Signed-off-by: Changyeon Jo <changyeon@google.com>
2020-01-21 18:43:27 +00:00
Alistair Delva
07e6aa994a recovery: Allow BLKPBSZGET on cache_block_device
The comment in this file acknowledges that this is needed for "Wipe
data/cache", however it does not actually grant the permission for
cache_block_device. Add it. Fixes a denial seen on cuttlefish:

avc:  denied  { ioctl } for  pid=223 comm="mke2fs"
  path="/dev/block/vda3" dev="tmpfs" ino=486 ioctlcmd=0x127b
  scontext=u:r:recovery:s0 tcontext=u:object_r:cache_block_device:s0
  tclass=blk_file permissive=0

Bug: 146898312
Change-Id: I82b9975085c027941c970ca44dbb1a7a370295fa
2020-01-21 16:34:42 +00:00
Santiago Seifert
1d241db7e5 Revert "untrusted_app_29: add new targetSdk domain"
This reverts commit a1aa2210a9.

Reason for revert: Potential culprit for Bug b/148049462 - verifying through Forrest before revert submission

Change-Id: Ibe4fa1dee84defde324deca87d9de24a1cc2911a
2020-01-21 11:35:24 +00:00
Jeff Vander Stoep
a1aa2210a9 untrusted_app_29: add new targetSdk domain
Enforce new requirements on app with targetSdkVersion=30 including:
- No bind() on netlink route sockets.
- No RTM_GETLINK on netlink route sockets.

Remove some of the repetitive descriptions in each untrusted_app_N.te
file, and instead refer to the description in
public/untrusted_app.te.

Bug: 141455849
Test: CtsSelinuxTargetSdkCurrentTestCases
Change-Id: Iad4d142c0c13615b4710d378bc1feca4d125b6cc
2020-01-20 15:31:52 +01:00
Maciej Żenczykowski
4a865b3089 add dontaudit dnsmasq kernel:system module_request
This was originally added due to:
  avc: denied { module_request } for comm="dnsmasq" kmod="netdev-bt-pan" scontext=u:r:dnsmasq:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0
in wahoo specific selinux policy in commit cd761300c1cc67cb2be3e001b95317e8a865c5fe 'Allow some denials we have seen.'

This is most likely simply triggered by a race condition on attempting
to access a non existent network device 'bt-pan'.

While we've never seen this anywhere else, it could potentially happen
on any device so we might as well make this global...

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I00f61a5fc2bfce604badf3b96f6ed808157eb78c
2020-01-18 18:22:12 -08:00
Sunil Ravi
2bde15c66b Merge "sepolicy(wifi): Allow keystore-wificond communication" 2020-01-18 00:57:02 +00:00
Treehugger Robot
4f0bf97b41 Merge "Add policies for permission APEX data directory." 2020-01-17 23:45:54 +00:00
Sunil Ravi
d8843d1c2e sepolicy(wifi): Allow keystore-wificond communication
Denial log:
1. 10-30 11:02:50.279  wifi  1119  1119 W HwBinder:1119_1:
type=1400 audit(0.0:113): avc: denied { transfer } for
scontext=u:r:wificond:s0 tcontext=u:r:keystore:s0
tclass=binder permissive=0

2. 01-15 16:24:04.214 W/keystore( 1007): type=1400
audit(0.0:109): avc: denied { call } for
scontext=u:r:keystore:s0 tcontext=u:r:wificond:s0
tclass=binder permissive=0

3. 01-16 12:11:19.704 W/keystore( 1021): type=1400
audit(0.0:163): avc: denied { transfer } for
scontext=u:r:keystore:s0 tcontext=u:r:wificond:s0
tclass=binder permissive=0

Bug: 143638513
Bug: 145310496
Test: Installed CA and wifi certificates and connects
to enterprise network.
No selinux denial seen from wificond and keystore.

Change-Id: I9727add13844b1ff1875e493b777e3a294e00ffa
2020-01-17 21:14:25 +00:00
Jing Ji
d1b9526ea0 Merge "Add rules for an unix domain socket for system_server" 2020-01-17 18:53:19 +00:00
Lee Shombert
2af7e0a1fb Merge "Rename the binder cache key for hasSystemFeature()" 2020-01-17 15:24:59 +00:00
Justin Yun
291d6b379d Use vndk_prop for old vndk properties
For vndk related properties, use vndk_prop context.
vndk_prop can be defined by 'init' and 'vendor_init', but free to
read by any processes.

Bug: 144534640
Test: check boot to see if the VNDK properties are readable
Change-Id: Ifa2bb0ce6c301ea2071e25ac4f7e569ea3ce5d83
2020-01-17 00:24:20 +00:00
Jing Ji
2b12440ff7 Add rules for an unix domain socket for system_server
System_server will listen on incoming packets from zygotes.

Bug: 136036078
Test: atest CtsAppExitTestCases:ActivityManagerAppExitInfoTest
Change-Id: I42feaa317615b90c5277cd82191e677548888a71
2020-01-16 16:09:48 -08:00
Hai Zhang
f301cd299b Add policies for permission APEX data directory.
Bug: 136503238
Test: presubmit
Change-Id: I636ab95070df4c58cf2c98b395d99cb807a7f243
2020-01-16 16:08:55 -08:00
Lee Shombert
d3625cdcec Rename the binder cache key for hasSystemFeature()
The code that uses the property has not been committed, so this change
has no impact on the codebase.

Bug: 140788621

Test: build an image that combines this change with the client code
and boot a phone.  Verify that there are no policy violations.

Change-Id: Ie6c1a791578c61adae5b71a38e61a2f5b20bb817
2020-01-16 14:56:27 -08:00
Treehugger Robot
13722174b7 Merge "Add selinux contexts for system_config_service" 2020-01-16 22:41:42 +00:00
Wei Wang
fbe4afa7aa Merge "stable aidl Power HAL policy" 2020-01-16 22:35:42 +00:00
Collin Fijalkovich
fc52615d13 Merge "Configure SELinux for PowerManager Caches" 2020-01-16 19:34:10 +00:00
Wei Wang
32b24c0f0b stable aidl Power HAL policy
Test: boot and dumpsys -l
Change-Id: I58022c9e0c24ba4e2d695acf63375c9f74c51b22
2020-01-15 16:53:40 -08:00
Treehugger Robot
a5527b4e46 Merge "Add SELinux policy for Identity Credential HAL" 2020-01-15 23:19:03 +00:00
Hall Liu
719bf1b8ca Add selinux contexts for system_config_service
Add selinux contexts for the new system config service.

Test: atest -it -w SystemConfigTest
Bug: 143112379
Change-Id: Ibe67acb404b6951e1fda9ce28bd50a0efdd44c5f
2020-01-15 11:15:29 -08:00
Ryan Savitski
ffa0dd93f3 perf_event: rules for system and simpleperf domain
This patch adds the necessary rules to support the existing usage of
perf_event_open by the system partition, which almost exclusively
concerns the simpleperf profiler. A new domain is introduced for some
(but not all) executions of the system image simpleperf. The following
configurations are supported:
* shell -> shell process (no domain transition)
* shell -> debuggable app (through shell -> runas -> runas_app)
* shell -> profileable app (through shell -> simpleperf_app_runner ->
                            untrusted_app -> simpleperf)
* debuggable/profile app -> self (through untrusted_app -> simpleperf)

simpleperf_app_runner still enters the untrusted_app domain immediately
before exec to properly inherit the categories related to MLS. My
understanding is that a direct transition would require modifying
external/selinux and seapp_contexts as with "fromRunAs", which seems
unnecessarily complex for this case.

runas_app can still run side-loaded binaries and use perf_event_open,
but it checks that the target app is exactly "debuggable"
(profileability is insufficient).

system-wide profiling is effectively constrained to "su" on debug
builds.

See go/perf-event-open-security for a more detailed explanation of the
scenarios covered here.

Tested: "atest CtsSimpleperfTestCases" on crosshatch-user/userdebug
Tested: manual simpleperf invocations on crosshatch-userdebug
Bug: 137092007
Change-Id: I2100929bae6d81f336f72eff4235fd5a78b94066
2020-01-15 16:56:41 +00:00
Treehugger Robot
4d33dc28e7 Merge "Allow init to configure dm_verity kernel driver." 2020-01-15 13:13:01 +00:00
Yifan Hong
3914147f3a Merge "Give fastbootd permission to mount and write to /metadata/gsi." 2020-01-15 01:31:59 +00:00
David Zeuthen
b8b5da4305 Add SELinux policy for Identity Credential HAL
Bug: 111446262
Test: VtsHalIdentityCredentialTargetTest
Change-Id: Icb5a0d8b24d463a2f1533f8dd3bfa84bf90acc6f
2020-01-14 20:13:39 -05:00
Collin Fijalkovich
8496548b38 Configure SELinux for PowerManager Caches
Setup SELinux to allow the world to read, and system_server to write, a
property used as an indicator that we need to refresh local caches
for PowerManager.isPowerSaveMode and PowerManager.isInteractive.

Bug: 140788621
Test: Flashed build and tested that phone boots and does not crash
as PowerManager operations take place.

Change-Id: I3e7e513756c8d881295721c2729cd37ad3bec8b8
2020-01-13 14:01:11 -08:00
Lee Shombert
bafd0c762a SELinux changes for the hasSystemFeature() binder cache property.
The binder_cache_system_server_prop context allows any user to read the
property but only the system_server to write it.  The only property with
this context is currently binder.cache_key.has_system_feature but users
will be added.

Bug: 140788621

Test: this was tested on an image with a binder cache implementation.  No
permission issues were found.  The implementation is not part of the current
commit.

Change-Id: I4c7c3ddf809ed947944408ffbbfc469d761a6043
2020-01-13 10:21:54 -08:00
Treehugger Robot
1fbac29eba Merge "Using macro "rx_file_perms" instead of "execute_no_trans"." 2020-01-10 09:23:21 +00:00
Treehugger Robot
88f2ed8186 Merge "Add Selinux rule to allow iorapd to execute compiler." 2020-01-10 08:27:26 +00:00
Yan Wang
67e8fcc902 Using macro "rx_file_perms" instead of "execute_no_trans".
Bug: 147320338
Test: Run the maintenance and check if the compiled is executed.
2020-01-09 13:23:01 -08:00
Yan Wang
7d844ee436 Add Selinux rule to allow iorapd to execute compiler.
Bug: 147320338
Test: Run the maintenance and check if the compiled is executed.
Change-Id: Idbd193483a106969a8a421150101efa00aee460d
2020-01-09 12:43:18 -08:00
Nikita Ioffe
0b099c801d Merge "Add userspace_reboot_config_prop property type" 2020-01-09 10:05:18 +00:00
Anton Hansson
7130e677ed Merge "Rename sdkext sepolicy to sdkextensions" 2020-01-09 08:46:08 +00:00
Nikita Ioffe
f596cc859b Add userspace_reboot_config_prop property type
This property type will be used for read-only userspace reboot related
properties that are used to configure userspace reboot behaviour, e.g.:
* timeout for userspace reboot watchdog;
* timeout for services to terminate;
* timeout for services to shutdown;
* etc.

Since all this configuration is device specific, vendor_init should be
able to set these properties.

Test: build/soong/soong_ui.bash \
  --make-mode \
  TARGET_PRODUCT=full \
  TARGET_BUILD_VARIANT=eng \
  droid \
  dist DIST_DIR=/tmp/buildbot/dist_dirs/aosp-master-linux-full-eng/funwithprops \
  checkbuild
Bug: 135984674
Bug: 147374477

Change-Id: I1f69980aea6020e788d5d2acaf24c0231939907c
2020-01-08 22:43:57 +00:00
Jon Spivack
c8c6c0060e Merge "Add aidl_lazy_test_server" 2020-01-08 22:26:31 +00:00
Anton Hansson
b84133555a Rename sdkext sepolicy to sdkextensions
The module is getting renamed, so rename all the policy
relating to it at the same time.

Bug: 137191822
Test: presubmit
Change-Id: Ia9d966ca9884ce068bd96cf5734e4a459158c85b
Merged-In: Ia9d966ca9884ce068bd96cf5734e4a459158c85b
(cherry picked from commit 6505573c36)
2020-01-08 11:41:18 +00:00
Treehugger Robot
3e93ffb62f Merge "vendor_init can set config.disable_cameraservice" 2020-01-08 06:59:48 +00:00
Jon Spivack
ae2df6b5de Add aidl_lazy_test_server
This is a test service for testing dynamic start/stop of AIDL services. In order to test realistic use cases with SELinux enabled, it requires the same permissions as a regular service.

Bug: 147153962
Test: aidl_lazy_test aidl_lazy_test_1 aidl_lazy_test_2
Change-Id: Ifc3b2eaefba9c06c94f9cf24b4474107d4e26563
2020-01-07 15:11:03 -08:00
Robin Lee
cbfe879fe6 vendor_init can set config.disable_cameraservice
This had been settable by vendors up to and including Q release by
making config_prop avendor_init writeable. We don't allow this any
more. This should be a real vendor settable property now.

Bug: 143755062
Test: adb logcat -b all | grep cameraservice
Test: atest CtsCameraTestCases
Change-Id: Id583e899a906da8a8e8d71391ff2159a9510a630
2020-01-07 06:57:42 +00:00
Adam Shih
d5a0edd75e Grant appdomain access to app_api_service
The original idea was to compartmentalize services for apps to access.
ex. an app that manage display brightness should not have access to
audio service.

However, identifying all services is hard and we often end up granting
app_api_service in practice to avoid unexpected crashes.

Bug: 147198856
Test: Remove device app_api_service related sepolicy and related process
remain functional

Change-Id: I3aafcf1a91847a97c86f1d7992653b806a713bd4
2020-01-07 09:59:34 +08:00
Treehugger Robot
50c5d731e0 Merge "Add sepolicy for binderfs" 2020-01-06 16:09:45 +00:00
Martijn Coenen
d38fa3fdf1 Allow init to configure dm_verity kernel driver.
To disable hash-tree prefetching.

Bug: 136247322
Test: atest google/perf/boottime/boottime-test
Change-Id: Ibdcb88d1014f58918119867c6d701dc58af0c049
2020-01-06 09:40:50 +01:00