Commit graph

17372 commits

Author SHA1 Message Date
Alan Stokes
219511048d Merge "Update seapp_contexts documentation comments." 2019-02-06 09:35:02 +00:00
markchien
f6b59fe644 [KA08] Allow system_server call tcp socket ioctl
In order to offload application tcp socket’s keepalive
message, system server must know if application's socket
is idle with no data in send/receive queues. Allow
system_server to use ioctl on all tcp sockets.

Bug: 114151147
Test: -build, flash, boot
Change-Id: I3f5a0e06bc22f8a64ae6180db48df2a31106c511
2019-02-06 13:17:38 +09:00
Tri Vo
73d0a67b06 sepolicy for ashmemd
all_untrusted_apps apart from untrusted_app_{25, 27} and mediaprovider
are now expected to go to ashmemd for /dev/ashmem fds.

Give coredomain access to ashmemd, because ashmemd is the default way
for coredomain to get a /dev/ashmem fd.

Bug: 113362644
Test: device boots, ashmemd running
Test: Chrome app works
Test: "lsof /system/lib64/libashmemd_client.so" shows
libashmemd_client.so being loaded into apps.
Change-Id: I279448c3104c5d08a1fefe31730488924ce1b37a
2019-02-05 21:38:14 +00:00
Santos Cordon
87988fa6a6 Merge "SEPolicy for Suspend Control interface." 2019-02-05 18:03:55 +00:00
Santos Cordon
b78a1f5e13 SEPolicy for Suspend Control interface.
Bug: 121210355
Test: manual
Change-Id: I9c46c72f0219309140ed2fb008ef57b4bca6ff2b
Merged-In: I9c46c72f0219309140ed2fb008ef57b4bca6ff2b
2019-02-05 18:03:32 +00:00
Alan Stokes
6b576bd2fa Update seapp_contexts documentation comments.
Add some missing fields, document undocumented fields, update
precedence rules, and attempt to give slightly more context.

Test: Builds
Change-Id: Id106ebe3aa6c18697db82a775cc54ed07b6c1a57
2019-02-05 17:37:29 +00:00
Treehugger Robot
125cbf19de Merge "Neverallow executable files and symlink following" 2019-02-05 17:32:28 +00:00
Sudheer Shanka
ccec725ff9 Temporary rule to allow zygote to access vfat.
Extension to change Id633337095c0a3b69d9b8652bcc3327810339cf3
to deal with secondary storage devices.

Bug: 123533205
Test: manual
Change-Id: I24e1550af9589be9b238fba83837bf684aa02e3f
2019-02-04 16:38:41 -08:00
David Anderson
18f8033e55 Merge "Allow mkfs on device-mapper devices." 2019-02-04 23:32:21 +00:00
Treehugger Robot
ba61fad478 Merge "Hide denials seen during bugreports." 2019-02-04 22:32:18 +00:00
Tri Vo
f15746f284 Merge "Restore P BOARD_PLAT_*_SEPOLICY_DIR behavior" 2019-02-04 21:45:44 +00:00
Jeff Vander Stoep
0ac2eece90 Neverallow executable files and symlink following
Test: build
Change-Id: Iec30d8a7642c34f12571c5654914ddbdc3d8355e
2019-02-04 18:38:05 +00:00
Joel Galenson
06e63d2aff Hide denials seen during bugreports.
While taking bugreports we sometimes see dumpstate try to find
hwservices.  These are mostly neverallowed by macros, so hide them.

Bug: 116711254
Bug: 123540375
Test: Build.
Change-Id: Ic73a354bdae3d124eccc9477b7862bcad66fa076
2019-02-04 09:04:05 -08:00
Roland Levillain
5c8f9398d9 Merge "Allow otapreopt to use bind-mounted Bionic artifacts from the Runtime APEX." 2019-02-04 13:40:17 +00:00
Suren Baghdasaryan
561ce801b0 sepolicy changes to configure cgroup.rc and task_profiles.json access
cgroups.json file contains cgroup information required to mount
cgroup controllers and is readable only by init process.
cgroup.rc contains cgroup map information consisting of the list of
cgroups available in the system and their mounting locations. It is
created by init process and should be readable by any processes that
uses cgroups and should be writable only by init process.
task_profiles.json file contains task profiles used to operate on
cgroups. This information should be readable by any process that uses
cgroups and should be writable only by init process.

Bug: 111307099
Test: builds, boots

Change-Id: Ib2c87c0fc3663c7fc69628f05c846519b65948b5
Merged-In: Ib2c87c0fc3663c7fc69628f05c846519b65948b5
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-02-02 16:56:08 +00:00
Mathieu Chartier
75b4c083fc Merge "Add device_config_runtime_native_boot_prop" 2019-02-02 02:06:11 +00:00
Mathieu Chartier
0327d10599 Add device_config_runtime_native_boot_prop
Some runtime properties require reboots and should be in the
native_boot namespace instead of native.

Bug: 120794191
Bug: 123524494
Test: set a property and ensure it can be read in AndroidRuntime.cpp
Change-Id: I1d1e984dcba26dd04d34a7d30fc63e1b75a8a311
2019-02-01 13:46:34 -08:00
Treehugger Robot
128724e6d4 Merge "apexd: permission to traverse /sys directory tree." 2019-02-01 21:23:25 +00:00
Dongwon Kang
a0bea70f10 Merge "SEPolicy updates for adding native flag namespace(media)." 2019-02-01 19:50:13 +00:00
Tri Vo
9918f28981 Restore P BOARD_PLAT_*_SEPOLICY_DIR behavior
BOARD_PLAT_*_SEPOLICY_DIR extends system sepolicy.

PRODUCT_PUBLIC_SEPOLICY_DIRS and PRODUCT_PRIVATE_SEPOLICY_DIRS now
specify locations of public and private product sepolicy respectively.

Bug: 119305624
Test: m selinux_policy
Change-Id: I48d491f0dd22020d96ff0243142153871d2d6b2b
2019-02-01 11:41:11 -08:00
Mathieu Chartier
fd0bc70df7 Merge "Add runtime_native property permission to installd" 2019-02-01 18:57:30 +00:00
Tri Vo
74a5b50e0b apexd: permission to traverse /sys directory tree.
Different devices can have /sys/* labeled differently. This allows
apexd, to traverse /sys directory tree agnostic of device-specific
labeling.

Bug: 122876102
Test: m selinux_policy
Change-Id: I08f2eb2242913e3a7d532d36a452cf111fd4e4c4
2019-02-01 10:17:52 -08:00
Mathieu Chartier
26a5699773 Add runtime_native property permission to installd
Installd will read one of these properties as a feature flag.

(cherry-picked from commit e59e731dd1)

Bug: 116059983
Bug: 123524494
Test: adb shell /data/nativetest64/installd_dexopt_test/installd_dexopt_test

Change-Id: I6c5c058ba316b98f58d8d08f7cb13828cf311833
Merged-In: I6c5c058ba316b98f58d8d08f7cb13828cf311833
2019-02-01 16:54:49 +00:00
Treehugger Robot
3581f45667 Merge "add selinux rules for mini-keyctl" 2019-02-01 04:35:47 +00:00
Jeff Sharkey
9f02b30a72 Temporarily relax Zygote storage mounting rules.
In the kernel, sdcardfs wraps the contents of /data/media, which has
the label "media_rw_data_file".  As part of this wrapping, it should
change the label to be "sdcardfs", but we've seen evidence that this
isn't always happening.

To temporarily unblock dogfooding while we continue investigating,
relax rules to allow Zygote to mount from either "sdcardfs" or
"media_rw_data_file", which as described above, are equivalant.

Bug: 123533205
Test: manual
Change-Id: Id633337095c0a3b69d9b8652bcc3327810339cf3
2019-01-31 17:21:30 -07:00
Xiaoyong Zhou
2ebc63bef4 add selinux rules for mini-keyctl
mini-keyctl is a binary used to load channel keys to .fsverity keyring.
This CL creates a new domain for mini-keyctl and a type for /proc/keys
and adds allow rules needed by this binary.

Bug: 112038861
Test: manual
Merged-In: I3b744d302859a02dfe63c81c7f33bb30912d7994
Change-Id: I3b744d302859a02dfe63c81c7f33bb30912d7994
2019-01-31 15:12:11 -08:00
Peter Kalauskas
2613456a36 Merge "Allow lazy wifi HAL to run" 2019-01-31 22:05:47 +00:00
Roland Levillain
446b2fedce Allow otapreopt to use bind-mounted Bionic artifacts from the Runtime APEX.
Allow `otapreopt_chroot` to:
- bind-mount Bionic artifacts from the Runtime APEX
  (`/postinstall/apex/com.android.runtime`) into `/postinstall/bionic/`;
- read the `/postinstall/system/bin/linker(64)` symlink to
  `/postinstall/bionic/bin/linker(64)` when executing
  `/postinstall/system/bin/otapreopt`.

Allow `otapreopt` (running as `postinstall_dexopt`) to:
- read directories under `/postinstall`.

Test: m otapreopt_chroot
Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120266448
Change-Id: I6de9df12d5fd84f1dd92798efed5f2d8b72d3ebe
2019-01-31 19:09:08 +00:00
Treehugger Robot
586c2cdfdf Merge "Remove unused *_tmpfs types" 2019-01-31 18:59:43 +00:00
Treehugger Robot
eced7cb78d Merge "Add Bluetooth Audio HAL interface V2 as hal_audio_hwservice" 2019-01-31 18:17:07 +00:00
Dongwon Kang
523c746859 SEPolicy updates for adding native flag namespace(media).
Test: add sepolicy, build, check GetServerConfigurableFlag function
Bug: 123658514
Change-Id: I798b0ef901068c53070e768305acd38118a7e886
2019-01-31 10:06:32 -08:00
Treehugger Robot
ecf787e85f Merge "Allow permissions needed for gdb debugging" 2019-01-31 05:58:55 +00:00
Jiyong Park
cd6a6a0933 Allow init to mount on /bionic in recovery mode
The mount points under /bionic are rootfs in recovery mode. Init should
be able to bind-mount the bootstrap Bionic to the mount points.

Bug: 120266448
Test: adb reboot recovery; phone enters into the recovery mode
Change-Id: I57aed268eac08a5fb3609750bf10cd8d6e97347a
2019-01-31 13:44:21 +09:00
Jiyong Park
9d9333ac86 init can call setns
init now creates two mount namespaces one for pre-apexd processes and
the other for post-apexd processes. This is to mount different files to
the same mount point at /bionic. For pre-apexd processes, the bootstrap
Bionic is mounted. For post-apexd processes, the default Bionic (from
the runtime APEX) is mounted.

Using unshare and setns, init first starts with the mount namespace for
the pre-apexd and then switches to the other mount namespace when APEXes
are ready. It then occasionally switches to pre-apexd mount namespace
when it has to re-launch a pre-apexd process (e.g. the process has
crashed, etc.)

In doing so, read access to /proc/self/ns/mnt is granted to init as
well.

Bug: 120266448
Bug: 122717176
Test: m device boots
Change-Id: Idbf15cbf5cc36b9993d718d4d887cd8f23a94666
2019-01-31 13:44:21 +09:00
Jiyong Park
4b3f2c6245 Label the bootstrap linker and bionic mount points
Bootstap linker has been moved from /system/bin/linker[64] to
/system/bin/bootstrap/linker[64]. Reflect the change in file_contexts.
Existing paths are not removed since the bootstrap linker (or the
linker from the rumtime APEX) will be bind-mounted to the old path by
init.

Also label the files under /bionic which serve as mount points for
either of the bootstrap bionic or the bionic from the runtime APEX.

In addition, read access for the symlinks in /system/lib/*.so and
/system/bin/linker is granted. This is because Bionic files in the paths
are now symlinks to the corresponding mountpoints at /bionic.

Bug: 120266448
Test: device boots to the UI

Change-Id: Iea4d76eb46754b435b6c5428481cd177da8d2ee1
2019-01-31 13:44:21 +09:00
Felka Chang
48234250f5 Merge "add create link permission for platform_app" 2019-01-31 02:38:09 +00:00
Hung-ying Tyan
e4350c1a64 Sepolicy for dynamic_android_service
Dynamic_android service is a proxy running in SystemServer to the
gsi_service daemon. It provides a set of SystemApi's to manage
installation of a new system image to the device while keeping the
original system image intact.

Bug: 122929007
Test: manual; see dynamic_android service start in logcat
Change-Id: Idb9b0475677dad13b7864ca0cf6041dcab04b4e3
2019-01-31 01:30:36 +00:00
Treehugger Robot
59e8da9196 Merge "Fix running simpleperf_app_runner on user device." 2019-01-30 22:59:43 +00:00
Jeff Vander Stoep
3b9fad192a Remove unused *_tmpfs types
Apps now all share the appdomain_tmpfs type.

Bug: 122854450
Test: boot Blueline with memfd enabled.
Change-Id: I5eac0adc7ecd10d19aa1bdf5f72efc7ed2a3a548
2019-01-30 21:54:40 +00:00
Nick Kralevich
337f56467b Allow permissions needed for gdb debugging
system/sepolicy commit ffa2b61330
introduced the runas_app SELinux domain, which changed how we perform
debugging of Android applications. This broke Android Studio's lldb.

From bugreport:

Debugging an app containing native code using ndk-gdb or Android
Studio's lldb currently fails. There is an selinux error in logcat
about a sigchld denial. Studio can still debug Java-only apps.

In Android Studio, starting the debugger on an app with native
code produces this selinux denial:

01-30 06:58:02.089 13449 13449 W lldb-server: type=1400 audit(0.0:831): avc: denied { sigchld } for scontext=u:r:untrusted_app_27:s0:c167,c256,c512,c768 tcontext=u:r:runas_app:s0:c167,c256,c512,c768 tclass=process permissive=0 app=com.android.ndktestapp

With "set enforce 0", I also see a sigstop denial:

01-30 07:31:12.209 15672 15672 I lldb-server: type=1400 audit(0.0:1290): avc: denied { sigstop } for scontext=u:r:runas_app:s0:c167,c256,c512,c768 tcontext=u:r:untrusted_app_27:s0:c167,c256,c512,c768 tclass=process permissive=1 app=com.android.ndktestapp

In gdb-server.log, Studio reports this error while trying to start lldb-server:

1548831482.091491938 GDBRemoteCommunicationServerLLGS::Handle_vAttach attempting to attach to pid 13379
1548831482.091519117 GDBRemoteCommunicationServerLLGS::AttachToProcess pid 13379
1548831482.092242956 GDBRemoteCommunicationServerLLGS::Handle_vAttach failed to attach to pid 13379: Permission denied

Using ndk-gdb (e.g. on the NdkGdbSample) produces the same sort
of selinux denial:

01-30 07:11:26.742 13926 13926 W arm64-gdbserver: type=1400 audit(0.0:833): avc: denied { sigchld } for scontext=u:r:untrusted_app_27:s0:c166,c256,c512,c768 tcontext=u:r:runas_app:s0:c166,c256,c512,c768 tclass=process permissive=0 app=com.android.developer.ndkgdbsample

If I use "setenforce 0", I see more denials logged (signal and
sigstop):

01-30 07:30:23.346 15478 15478 I arm64-gdbserver: type=1400 audit(0.0:1287): avc: denied { signal } for scontext=u:r:runas_app:s0:c166,c256,c512,c768 tcontext=u:r:untrusted_app_27:s0:c166,c256,c512,c768 tclass=process permissive=1 app=com.android.developer.ndkgdbsample

01-30 07:30:23.349 15478 15478 I arm64-gdbserver: type=1400 audit(0.0:1288): avc: denied { sigstop } for scontext=u:r:runas_app:s0:c166,c256,c512,c768 tcontext=u:r:untrusted_app_27:s0:c166,c256,c512,c768 tclass=process permissive=1 app=com.android.developer.ndkgdbsample

ndk-gdb times out and prints an error:

rprichard@cashew:/x/ndk/ndk/samples/NdkGdbSample$ /x/android-ndk-r19/ndk-gdb --launch
Redirecting gdbserver output to /tmp/gdbclient.log
...
Error: unable to connect to device.
Remote communication error.  Target disconnected.: Connection reset by peer.

gdbclient.log shows that gdbserver hasn't started listening to its Unix socket yet:

rprichard@cashew:/x/ndk/ndk/samples/NdkGdbSample$ cat /tmp/gdbclient.log
Attached; pid = 14232

Normal output looks like this:

rprichard@cashew:/x/ndk/ndk/samples/NdkGdbSample$ cat /tmp/gdbclient.log
Attached; pid = 27799
Listening on Unix domain socket '/data/data/com.android.developer.ndkgdbsample/debug_socket'
Remote debugging from host 127.0.0.0

Test: compiles and builds
Bug: 123612207
Change-Id: Ia9a711cc54cc044c0817a7c17eb4506015adb393
2019-01-30 13:19:36 -08:00
David Anderson
607fb9e445 Allow mkfs on device-mapper devices.
When running a GSI as a live image, a temporary userdata partition is
mounted through device-mapper. In order to properly format+encrypt this
like a normal userdata partition, mkfs must have rw permissions.

Bug: 122850122
Test: manual test
Change-Id: I5aa888f12a85954a9818ed04009832d76c139862
2019-01-30 13:00:35 -08:00
Jeff Vander Stoep
9f5d0d90a3 Initial selinux policy support for memfd
Move all app tmpfs types to appdomain_tmpfs. These are still protected
by mls categories and DAC. TODO clean up other app tmpfs types in a
separate change.

Treble-ize tmpfs passing between graphics composer HAL and
surfaceflinger.

Bug: 122854450
Test: boot Blueline with memfd enabled.
Change-Id: Ib98aaba062f10972af6ae80fb85b7a0f60a32eee
2019-01-30 19:11:49 +00:00
Yabin Cui
84c70929be Fix running simpleperf_app_runner on user device.
Bug: 118835348
Test: build and boot blueline user device.
Test: test simpleperf_app_runner manually.
Change-Id: I022d7f10f6164e6980f55badd4edcdc76a73c004
2019-01-30 11:09:43 -08:00
Peter Kalauskas
03f43017b2 Allow lazy wifi HAL to run
Test: Manually check that lazy wifi HAL runs
Bug: 123307146
Change-Id: I22f9bc7a097056215d249b692b6f39a71b6b9811
2019-01-30 18:52:19 +00:00
Treehugger Robot
37ab42e542 Merge "Label APEX files correctly when TARGET_FLATTEN_APEX=true" 2019-01-30 15:06:21 +00:00
felkachang
0c402012e6 add create link permission for platform_app
To create symbolic link by unstrusted app raise the security
issue. To allow platform_app to create symbolic link prevent
the functionality from not working.

Fixes: 123555031
Test: atest DocumentsUITests
Bug: 123350324

Change-Id: Idb23c3e813c66bd284d42b8040deeea762f99a0f
2019-01-30 16:03:27 +08:00
Shuzhen Wang
248633385e Allow cameraserver to access tmpfs
Bug: 79465976
Test: testHeic CTS test
Change-Id: I51eb485dc29d869c5d35fc317b0e008d04bdcbad
2019-01-30 05:31:42 +00:00
Shuzhen Wang
6b4caaa3e8 Revert "Cameraserver: Allow cameraserver to access /data/misc/cameraserver"
This reverts commit 4e1497c7c0.

Reason for revert: Write temporary file to in-memory tmpfs instead

Test: testHeic CTS test
Bug: 123526741
Change-Id: Ifa7f5a0b50c46ee3e1a5695595233b17adc99222
2019-01-29 23:29:05 +00:00
Mathieu Chartier
91b0ef13d8 Merge "Rename runtime -> runtime_native property namespace" 2019-01-29 22:44:36 +00:00
Treehugger Robot
13fdfa44cd Merge "Fix perfetto CTS test" 2019-01-29 22:31:31 +00:00