Commit Graph

18179 Commits

Author SHA1 Message Date
Maciej Żenczykowski
3e41b297d2 selinux - remove clatd tun creation privs
No longer needed, since this is now done by netd.

In a separate commit so it can potentially not be backported to Q
if we so desire.

Test: build/installed on crosshatch with netd/clatd changes,
  and observed functioning ipv4 on ipv6 only network with no
  avc denials

Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id927ee73469d3e90f5111bd5e31ed760a58c8ebe
2019-05-08 10:22:48 +00:00
Treehugger Robot
3e034a2270 Merge "dontaudit su unlabeled:vsock_socket *" 2019-05-07 00:36:51 +00:00
Treehugger Robot
83dfb08842 Merge "ppp: support using pppox_socket family" 2019-05-06 22:51:50 +00:00
Jeffrey Vander Stoep
38bbf3016d Merge "Add mechanism for granting permissions to old vendor images" 2019-05-06 22:26:19 +00:00
Maciej Żenczykowski
ae68bf23b6 dontaudit su unlabeled:vsock_socket *
Fix for:
  type=1400 audit(): avc: denied { getopt } for comm=73657276657220736F636B6574 scontext=u:r:su:s0 tcontext=u:object_r:unlabeled:s0 tclass=vsock_socket
  type=1400 audit(): avc: denied { setopt } for comm=73657276657220736F636B6574 scontext=u:r:su:s0 tcontext=u:object_r:unlabeled:s0 tclass=vsock_socket
  type=1400 audit(): avc: denied { read } for comm="adbd" scontext=u:r:su:s0 tcontext=u:object_r:unlabeled:s0 tclass=vsock_socket
  type=1400 audit(): avc: denied { write } for comm="adbd" scontext=u:r:su:s0 tcontext=u:object_r:unlabeled:s0 tclass=vsock_socket

Test: now less audit warnings!
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3bd1b2262dc6dcb099403d24611db66aac9aecb0
2019-05-06 14:36:39 -07:00
Nick Kralevich
e9cafb91d2 ppp: support using pppox_socket family
Kernel commit da69a5306ab92e07224da54aafee8b1dccf024f6
("selinux: support distinctions among all network address families")
modified the kernel to support fine grain differentiation of socket
families, if userspace enables it (which Android does).

Modify the ppp SELinux policy to allow the use of pppox_socket
(needed for kernels 4.14 or greater) and the generic "socket" family
(for kernels below 4.14).

Addresses the following denials:

04-19 20:25:34.059 16848 16848 I pppd    : type=1400 audit(0.0:8703): avc: denied { read write } for dsm=HS_Q path="socket:[171178]" dev="sockfs" ino=171178 scontext=u:r:ppp:s0 tcontext=u:r:mtp:s0 tclass=pppox_socket permissive=1
04-19 20:25:34.075 16848 16848 I pppd    : type=1400 audit(0.0:8704): avc: denied { ioctl } for dsm=HS_Q path="socket:[171179]" dev="sockfs" ino=171179 ioctlcmd=0x7437 scontext=u:r:ppp:s0 tcontext=u:r:mtp:s0 tclass=pppox_socket permissive=1

Bug: 130852066
Test: compiles
Change-Id: I00cc07108acaac5f2519ad0093d9db9572e325dc
2019-05-06 12:57:51 -07:00
Jeff Vander Stoep
564e292ae6 Add mechanism for granting permissions to old vendor images
This addresses Treble backwards compat issues introduced in
aosp/793958 and aosp/783669.

Bug: 122874820
Test: build/flash blueline with pi-dev vendor and generic_ab system
    images.
Test: adb pull /sys/fs/selinux/policy;
    sesearch policy --allowx -s vendordomain -t dev_type

Change-Id: Ic2b304472bb88051e03740dc387834056aba641a
2019-05-06 12:32:51 -07:00
Maciej Żenczykowski
6450e0038b selinux - allow netd to create tun device and pass it in via open fd across execve to clatd cli
This is needed to resolve some race conditions between clatd startup and interface naming/numbering.

This resolves:
  type=1400 audit(): avc: denied { read write } for comm="Binder:820_4" name="tun" dev="tmpfs" ino=20564 scontext=u:r:netd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
  type=1400 audit(): avc: denied { open } for comm="Binder:820_4" path="/dev/tun" dev="tmpfs" ino=20564 scontext=u:r:netd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
  type=1400 audit(): avc: denied { ioctl } for comm="Binder:820_4" path="/dev/tun" dev="tmpfs" ino=20564 ioctlcmd=0x54ca scontext=u:r:netd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
  type=1400 audit(): avc: denied { create } for comm="Binder:820_4" scontext=u:r:netd:s0 tcontext=u:r:netd:s0 tclass=tun_socket

Test: built/installed on crosshatch with netd->clatd tunfd passing and observed no selinux denials
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib501c755e11ec8a3a22c8aa333b5af7ec0bff306
2019-05-05 02:55:20 +00:00
Maciej Żenczykowski
b3b12729f4 Merge "selinux - netd - tighten down bpf policy" 2019-05-03 22:28:00 +00:00
Maciej Żenczykowski
487fcb87c0 selinux - netd - tighten down bpf policy
bpf programs/maps are now loaded by the bpfloader, not netd

Test: built/installed on crosshatch which uses eBPF - no avc denials

Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1ebd82e6730d62d1966da3c4634ecd78ce703543
2019-05-03 19:39:46 +00:00
Maciej Żenczykowski
210cdc6fa4 dnsmasq - allow getattr on unix stream sockets
Fix for:
  type=1400 audit(): avc: denied { getattr } for comm="dnsmasq" path="socket:[25224]" dev="sockfs" ino=25224 scontext=u:r:dnsmasq:s0 tcontext=u:r:netd:s0 tclass=unix_stream_socket permissive=0 b/77868789

Test: built and observed no more avc denials on aosp blueline

Bug: 77868789
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5af4d01e17f2d37335f523a49c7b1f81886edfa2
2019-05-03 06:16:57 +00:00
Treehugger Robot
3db3b1148b Merge "Add TODOs" 2019-05-02 18:41:55 +00:00
Treehugger Robot
21417a7965 Merge "selinux - allow dnsmasq to getattr on fifos" 2019-05-02 17:37:20 +00:00
Nick Kralevich
44b0efb332 Add TODOs
Bug: 131761776
Test: compiles
Change-Id: Iba3ad475ce25a1ece96717ceecb7c4df8e358d48
2019-05-02 08:29:21 -07:00
Treehugger Robot
1415c2da7d Merge "Allow psi monitor users to setched kernel threads" 2019-05-02 14:48:41 +00:00
Maciej Żenczykowski
afa10f7223 selinux - allow dnsmasq to getattr on fifos
This is presumably libc isatty detection on stdin/out/err.
Either way - allowing it is harmless.

This fixes:
  type=1400 audit(): avc: denied { getattr } for comm="dnsmasq" path="pipe:[38315]" dev="pipefs" ino=38315 scontext=u:r:dnsmasq:s0 tcontext=u:r:netd:s0 tclass=fifo_file permissive=0

Test: built and observed no more avc denials on crosshatch

Bug: 77868789
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ieab51aeb67ebb85b6c778410ba96963612277ae4
2019-05-01 18:04:22 -07:00
Wei Wang
e95d8e9550 Allow psi monitor users to setched kernel threads
psi monitor sched_setscheduler(kworker->task, SCHED_FIFO, &param) was added into pa/1282597

Bug: 131252752
Bug: 129476847
Test: build
Change-Id: I69fdd90e4a39da8d33b417efc7ea7a0da9d9290b
2019-05-01 10:23:02 -07:00
Anton Hansson
c165185e05 Make new vendor properties settable by vendor_init
These properties were moved to /vendor as part of b/130025216.
Allow them to be set by vendor_init, too.

Bug: 130025216
Bug: 131066061
Test: no SELinux warnings for said props at boot
Change-Id: I5293831bedb89e9c8d3ddf13cf7babde26872f28
2019-05-01 13:21:17 +01:00
Treehugger Robot
4eb1a20c77 Merge "Sepolicy: add dynamic_system_prop" 2019-05-01 10:33:29 +00:00
Steven Moreland
6acaea456f Merge "Use explicit whitelist for HIDL app neverallows." 2019-04-30 22:16:12 +00:00
Hung-ying Tyan
565384db61 Sepolicy: add dynamic_system_prop
and allow shell and system_app (Settings) to set it to enable Dynamic System Update.
Also allow priv_app (user of the API) to read it.

Bug: 119647479
Bug: 129060539
Test: run the following command on crosshatch-user:
      adb shell setprop persist.sys.fflag.override.settings_dynamic_system 1

Change-Id: I24a5382649c64d36fd05a59bc87faca87e6f0eb8
Merged-In: I24a5382649c64d36fd05a59bc87faca87e6f0eb8
2019-04-30 18:29:56 +08:00
Steven Moreland
68b6f805c9 Use explicit whitelist for HIDL app neverallows.
There were three separate neverallows here. Simplifying it to one
with only a small number of exceptions.

Bug: 131177459
Bug: 37226359
Test: m sepolicy (checks neverallows)

Change-Id: I93045c9f698f28675c634643a827a1cd513f215e
2019-04-29 13:11:38 -07:00
Jim Blackler
3cfad10c04 lmkd: grant access to /proc/lowmemorykiller
lmkd needs to read /proc/lowmemorykiller to send statslog events in response to
applications being killed.

Bug: 130017100
Change-Id: I929d5a372e1b2f63b7b5ed421f1898ebddaec01c
2019-04-29 10:49:58 +00:00
Carmen Jackson
2798b5fc93 Add selinux rule to allow Traceur to enable the traced daemon.
Bug: 130784724
Test: manual
Change-Id: Ic1903e273f5a136b3e0b14a901a60d8d0a81b211
Merged-In: Ic1903e273f5a136b3e0b14a901a60d8d0a81b211
2019-04-26 16:18:56 -07:00
Treehugger Robot
b60155aeac Merge "Build contexts files with Soong" 2019-04-25 07:46:19 +00:00
Miao Wang
8c2f4babee Allow NNAPI HAL services access model files provided by privapp.
Bug: 131169221
Test: mm
Change-Id: I1004821bd30e2a0586b14178e352e885cabfc002
(cherry picked from commit aa568e1c79)
2019-04-24 21:15:45 -07:00
Luke Huang
75b25384bb Merge "Sepolicy for netutils_wrapper to use binder call" 2019-04-25 03:09:30 +00:00
Inseob Kim
b554e594ca Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.

The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.

Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.

Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-25 09:59:28 +09:00
Treehugger Robot
91c35aeab6 Merge "Adding vendor_apex_file for /vendor/apex" 2019-04-24 23:32:56 +00:00
Treehugger Robot
e4af840db6 Merge "Allow idmap1 to read vmdl*.tmp APK install files" 2019-04-24 19:56:48 +00:00
Jooyung Han
ea61d198f2 Adding vendor_apex_file for /vendor/apex
apexd needs to read /vendor/apex dir and files in it.

Bug: 131190070
Bug: 123378252
Test: 1. Add apex to /vendor/apex
      -> see if boot succeeds with new policy
      2. Add flattened apex to /vendor/apex
      -> see if only root files are labelled as vendor_apex_file

Change-Id: I37795ab6d659ac82639ba5e34d628fe1b5cdb350
2019-04-25 02:54:14 +09:00
Winson Chiu
7e7291a763 Allow idmap1 to read vmdl*.tmp APK install files
When upgrading a package, PackageParser acts on the temporary
APK file copied from the install location. This is passed to
idmap, which doesn't have read access because it's missing an
SELinux rule.

This is needed to fix a bug with manifest overlaying on updating
an app, a feature kept alive for Q.

Relevant logs when updating a target:
[  550.068083] type=1400 audit(1556124408.583:3812): avc: denied { read } for comm="idmap" name="base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.090115] type=1400 audit(1556124408.583:3812): avc: denied { read } for comm="idmap" name="base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.092064] type=1400 audit(1556124408.603:3813): avc: denied { open } for comm="idmap" path="/data/app/vmdl1238645679.tmp/base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.096202] type=1400 audit(1556124408.603:3813): avc: denied { open } for comm="idmap" path="/data/app/vmdl1238645679.tmp/base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.098459] type=1400 audit(1556124408.613:3814): avc: denied { map } for comm="idmap" path="/data/app/vmdl1238645679.tmp/base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.101640] type=1400 audit(1556124408.613:3814): avc: denied { map } for comm="idmap" path="/data/app/vmdl1238645679.tmp/base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1
[  550.104239] type=1400 audit(1556124408.613:3815): avc: denied { getattr } for comm="idmap" path="/data/app/vmdl1238645679.tmp/base.apk" dev="vdc" ino=8770 scontext=u:r:idmap:s0 tcontext=u:object_r:apk_tmp_file:s0 tclass=file permissive=1

Bug: 130559507

Test: manual adb push /system/product/app/TestApp.apk with
/system/product/overlay/TestOverlay.apk enabling disabled launcher
Activity in TestApp; adb install -r TestApp.apk keeps enabled state
with changes

Change-Id: Ieeb7fb4f79ae091d0febf42ca358e7ffdfa6c3ff
2019-04-24 16:48:06 +00:00
Treehugger Robot
e556d33294 Merge "Allow signals to power/thermal HAL from dumpstate" 2019-04-24 06:39:24 +00:00
Treehugger Robot
a3c532295b Merge "Remove obsolete denials tracking." 2019-04-24 06:30:23 +00:00
Tao Bao
2952a20565 Merge "Move ro.build.ab_update to vendor property." 2019-04-23 22:16:48 +00:00
Wei Wang
addfe4679d Allow signals to power/thermal HAL from dumpstate
Bug: 129711808
Test: Take BR
Change-Id: Ibcb03698a6e2966f4913ddb6e674502bce4df235
2019-04-23 14:22:41 -07:00
Mikhail Naganov
1c3b84b00d Merge "Allow mediaserver to find "audio" service" 2019-04-23 16:46:16 +00:00
Treehugger Robot
98fcefb276 Merge "Fix denial of /debug_ramdisk/adb_debug.prop" 2019-04-23 13:09:32 +00:00
Bowgo Tsai
5a234338c1 Fix denial of /debug_ramdisk/adb_debug.prop
This CL fix the following SELinux denial, by allowing init to getatter
for tmpfs:file.

audit: type=1400 audit(15464939.926:4): avc:  denied  { getattr } for
pid=1 comm="init" path="/debug_ramdisk/adb_debug.prop" dev="tmpfs"
ino=25480 scontext=u:r:init:s0 tcontext=u:object_r:tmpfs:s0 tclass=file
permissive=0

Note: the current sepolicy (before this change) has the following rules
for tmpfs:file:

$ sesearch --allow -t tmpfs -c file $OUT/vendor/etc/selinux/precompiled_sepolicy
  allow dex2oat tmpfs:file { read map getattr };
  allow init tmpfs:file { read unlink open setattr };
  allow postinstall_dexopt tmpfs:file read;
  allow profman tmpfs:file { read map };
  allow vendor_init tmpfs:file { read map open setattr };

Bug: 126493225
Test: boot a device with debug ramdisk, checks related files are loaded
Change-Id: I6dd356de989d597828a6e04846b793d611c477fa
2019-04-23 06:40:10 +00:00
Treehugger Robot
fd2d7b3f5c Merge "Add sepolicy for nfc hal v1.2" 2019-04-23 06:34:31 +00:00
Tao Bao
2770de3bbc Move ro.build.ab_update to vendor property.
`ro.build.ab_update` is being moved from /system/build.prop to
/vendor/build.prop. This CL allows init to keep exposing the value as a
system property.

init: Do not have permissions to set 'ro.build.ab_update' to 'true' in property file '/vendor/build.prop': SELinux permission check failed

Bug: 130516531
Test: Build and flash crosshatch-userdebug. Check /system/build.prop,
      /vendor/build.prop and the runtime property.
Change-Id: I56803030a6bc0603f977ebc5fedbfc224a69d19e
2019-04-22 21:15:03 -07:00
Treehugger Robot
258ed21fde Merge "Adding userdebug_plat_sepolicy.cil" 2019-04-23 02:01:36 +00:00
Tri Vo
6cf01b3ef2 Merge "Treble-ize sepolicy for fwk HIDL services." 2019-04-23 00:05:06 +00:00
Mikhail Naganov
dc38720cfb Allow mediaserver to find "audio" service
mediaserver uses libaudioclient (via libmediaplayerservice).
The code in libaudioclient may access IAudioManager.
For that, mediaserver has to be allowed to find "audio" service.

Found while working on I3d32241752d9a747736606dc4cb1e068e6b7aa3b

Bug: 123312504
Test: MediaRecorderTest#testAudioRecordInfoCallback
Change-Id: Iaa3651c692fd550f72e7ce6eafbf3386ee07a0c0
2019-04-22 14:52:17 -07:00
Tri Vo
1d34b8cc31 Treble-ize sepolicy for fwk HIDL services.
Bug: 130734497
Test: m selinux_policy; system_server and statds still have permission
to export HIDL services.
Change-Id: I6e87b236bdbdd939fca51fb7255e97635118ed2d
2019-04-22 12:47:53 -07:00
Jack Yu
a5dde796b5 Add sepolicy for nfc hal v1.2
Bug: 130509605
Test: No avc denial log and NFC works with hal v1.2
Change-Id: If54884f76a32705d11f2085f66fe83b9e0354f79
2019-04-22 12:08:20 +00:00
Bowgo Tsai
e763667ee1 Adding userdebug_plat_sepolicy.cil
The userdebug sepolicy will be installed into debug ramdisk.
When the ramdisk is used, the device must be unlocked and init will load
this userdebug version of platform sepolicy to allow adb root.

Bug: 126493225
Test: 'make' and checks that the userdebug sepolicy is in debug ramdisk
Change-Id: I9df514054a86d63449b3ebfd1afdee2aee649418
2019-04-20 06:06:27 +00:00
Treehugger Robot
40a71c6f7b Merge "add mediaswcodec to watchdog and dumpstate" 2019-04-20 00:14:07 +00:00
Treehugger Robot
63f8d4feb7 Merge "Adding /debug_ramdisk mount point" 2019-04-19 23:54:53 +00:00
Treehugger Robot
2fbb6f0637 Merge "Allow adb start/stop mdnsd via ctl.start/stop" 2019-04-19 19:17:14 +00:00