- Nov 01, 2018
-
-
Nick Kralevich authored
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 https://android.googlesource.com/kernel/common/+/11cee2be0c2062ba88f04eb51196506f870a3b5d%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
-
Mark Salyzyn authored
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
-
- Oct 31, 2018
-
-
Nick Kralevich authored
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
-
- Oct 26, 2018
-
-
Tri Vo authored
Remove blanket coredomain access to same_process_hal_file in favor of granular access. This change takes into account audits from go/sedenials (our internal dogfood program) Bug: 37211678 Test: m selinux_policy Change-Id: I5634fb65c72d13007e40c131a600585a05b8c4b5
-
- Oct 22, 2018
-
-
Tri Vo authored
Bug: 118161817 Test: SANITIZE_TARGET=address m selinux_policy Change-Id: I4dabcb3692c59b810a06567e272bca9f0e9c3ecd
-
- Oct 19, 2018
-
-
Tri Vo authored
What changed: - Tightening neverallow forbidding vendor execution access in /system. In it's current form the neverallow is loose because not all executables have exec_type attribute, e.g. almost everything in /system/bin/. This change tightens up the neverallow by instead targeting system_file_type attribute, which must be applied to all files in /system. - Adding a general neverallow forbidding all access to files in /system (bar exceptions) TODOs: - Remove loopholes once Treble violations are fixed across all internal build targets. Bug: 111243627 Test: m selinux_policy; build-only change Change-Id: I150195756c0c3258904c3da0812bbd942ea2f229
-
Pavel Grafov authored
This reverts commit c855629e. Reason for revert: breaks builds for some devices in master Change-Id: I02c0967d6607ef0173b4188c06d2e781c3c93f4b
-
- Oct 18, 2018
-
-
Nick Kralevich authored
Start enforcing the use of ioctl restrictions on all Android block devices. Domains which perform ioctls on block devices must be explicit about what ioctls they issue. The only ioctls allowed by default are BLKGETSIZE64, BLKSSZGET, FIOCLEX, and FIONCLEX. Test: device boots and no problems. Change-Id: I1195756b20cf2b50bede1eb04a48145a97a35867
-
Nick Kralevich authored
Allow a process to determine if a fifo_file (aka pipe, created from the pipe() or pipe2() syscall) is a tty. Addresses the following denials: type=1400 audit(0.0:1307): avc: denied { ioctl } for comm="ls" path="pipe:[213117]" dev="pipefs" ino=213117 ioctlcmd=5401 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:r:hal_dumpstate_impl:s0 tclass=fifo_file permissive=0 type=1400 audit(0.0:22): avc: denied { ioctl } for comm="sh" path="pipe:[54971]" dev="pipefs" ino=54971 ioctlcmd=5401 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:r:untrusted_app_27:s0:c512,c768 tclass=fifo_file permissive=0 app=com.zhihu.android type=1400 audit(0.0:237): avc: denied { ioctl } for comm="sh" path="pipe:[56997]" dev="pipefs" ino=56997 ioctlcmd=5401 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:r:untrusted_app_25:s0:c512,c768 tclass=fifo_file permissive=0 app=fm.qingting.qtradio Test: policy compiles and device builds. Change-Id: Ic4c6441d0ec33de8cda3f13ff529e98374897364
-
- Oct 17, 2018
-
-
Tri Vo authored
What changed: - Tightening neverallow forbidding vendor execution access in /system. In it's current form the neverallow is loose because not all executables have exec_type attribute, e.g. almost everything in /system/bin/. This change tightens up the neverallow by instead targeting system_file_type attribute, which must be applied to all files in /system. - Adding a general neverallow forbidding all access to files in /system (bar exceptions) TODOs: - Remove loopholes once Treble violations are fixed across all internal build targets. Bug: 111243627 Test: m selinux_policy; build-only change Change-Id: Ic8d71c8d139cad687ad7d7c9db7111240475f175
-
Nick Kralevich authored
Add a neverallow rule requiring fine-grain ioctl filtering for most file and socket object classes. Only chr_file and blk_file are excluded. The goal is to ensure that any file descriptor which supports ioctl commands uses a whitelist. Further refine the list of file / socket objects which require ioctl filtering. The previous ioctl filtering did not cover the following: 1) ioctls on /proc/PID files 2) ioctls on directories in /dev 3) PDX unix domain sockets Add FIONCLEX to the list of globally safe ioctls. FIOCLEX and FIONCLEX are alternate, uncommon ways to set the O_CLOEXEC flag on a file descriptor, which is a harmless operation. Test: device boots and no problems. Change-Id: I6ba31fbe2f21935243a344d33d67238d72a8e618
-
Dario Freni authored
Bug: 115710947 Test: on device Change-Id: Ie712689d80fb829f16de70e865cac4f0ff4e9b35
-
- Oct 16, 2018
-
-
Tri Vo authored
Input files are public API: https://source.android.com/devices/input/input-device-configuration-files Now that they have labels from core policy (aosp/782082), we can tighten up our neverallows. Bug: 37168747 Test: m selinux_policy Change-Id: Ifaf9547993eb8c701fb63b7ee41971ea4e3f7cf9
-
- Oct 15, 2018
-
-
Chong Zhang authored
Add a service in mediaswcodec to load updated codecs, and restrict it to userdebug/eng. Reuse existing mediaextractor_update_service since the codec update service is identical, this avoids adding a new one for now as we may not need the service anymore after switching to APEX. Bug: 111407413 Bug: 117290290 Change-Id: Ia75256f47433bd13ed819c70c1fb34ecd5d507b4
-
Tri Vo authored
Bug: 111243627 Test: m selinux_policy Change-Id: I0bab79d1a3b7a8b5bf5d12ba2dc5ce46abea5332
-
David Anderson authored
This reverts commit 7a560eb4. Reason for revert: build bustage Change-Id: Iba0ba7a899dca865129a9c715c5f60f8a6edcc2f
-
Tri Vo authored
Policy w.r.t to apps: - cgroup access from untrusted apps and priv app is neverallow'ed. - other apps (e.g. vendor apps) need to explicitly declare appropriate access rules to cgroups. Policy w.r.t native domains: - libcutils exports API to /dev/{cpuset, stune}/*. This API is used abundantly in native vendor code. So we are not going to limit non-app access to cgroup. Bug: 110043362 Bug: 117666318 Test: m selinux_policy, boot device Change-Id: I83aee21ca3e8941725c70706769ea9dbdc76b9c5
-
- Oct 13, 2018
-
-
Tri Vo authored
Input files are public API: https://source.android.com/devices/input/input-device-configuration-files Now that they have labels from core policy (aosp/782082), we can tighten up our neverallows. Bug: 37168747 Test: m selinux_policy Change-Id: I7545b190f35b6b2c86c5dc42c0814f7bccbf1281
-
Tri Vo authored
same_process_hal_file is exempted from many Treble neverallows. We want to know which processes access this type to eventually constrain access to it. Bug: 37211678 Test: m selinux_policy Change-Id: I61c0df21250eb1b1ae2d9c5fa9c801a828539813
-
- Oct 12, 2018
-
-
Nick Kralevich authored
The shell script interpreter checks if file descriptors are ttys, which causes a bunch of denials. Allow the benign ioctl TCGETS. Addresses the following denials: type=1400 audit(0.0:321): avc: denied { ioctl } for comm="sh" path="/data/misc/perfprofd/perferr.txt" dev="sda13" ino=6817306 ioctlcmd=5401 scontext=u:r:perfprofd:s0 tcontext=u:object_r:perfprofd_data_file:s0 tclass=file permissive=0 type=1400 audit(0.0:3189): avc: denied { ioctl } for comm="ps" path="/data/user_de/0/com.android.shell/files/bugreports/bugreport-XXXXXXXXX-MASTER-2018-10-11-16-52-40.tmp" dev="dm-2" ino=25546 ioctlcmd=0x5401 scontext=u:r:dumpstate:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 type=1400 audit(0.0:3004): avc: denied { ioctl } for comm="top" path="/data/user_de/0/com.android.shell/files/bugreports/bugreport-XXXXXXXXX-MASTER-2018-10-11-16-52-40.tmp" dev="dm-2" ino=25546 ioctlcmd=0x5401 scontext=u:r:dumpstate:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 Include the virtual sdcard when allowing F2FS specific sqlite ioctls, since apps write sqlite files to the virtual sdcard. Addresses the following denials: type=1400 audit(0.0:324): avc: denied { ioctl } for comm="amapLocManagerT" path="/storage/emulated/0/amap/openamaplocationsdk/alsn20170807.db" dev="sdcardfs" ino=3546650 ioctlcmd=f50c scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:sdcardfs:s0 tclass=file permissive=0 app=com.xiaomi.hm.health Test: policy compiles. Change-Id: I7fc570f2bbf69485b1ee6e6b2d9a421639d29123
-
Nick Kralevich authored
By convention, auditallow statements are typically put into userdebug_or_eng blocks, to ensure we don't accidentally ship unnecessary audit rules. Let's do the same here. Test: policy compiles. Change-Id: Ib3eac94284eea3c1ae2f3dacddcb2eaeca95230e
-
- Oct 11, 2018
-
-
Chong Zhang authored
Set up a new service for sw media codec services. Bug: 111407413 Test: cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice Change-Id: Ia1c6a9ef3f0c1d84b2be8756eb1853ffa0597f8e
-
Tri Vo authored
What changed: - Removed cgroup access from untrusted and priv apps. - Settings app writes to /dev/stune/foreground/tasks, so system_app domain retains access to cgroup. - libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used abundantly in native code. So added a blanket allow rule for (coredomain - apps) to access cgroups. - For now, only audit cgroup access from vendor domains. Ultimately, we want to either constrain vendor access to individual domains or, even better, remove vendor access and have platform manage cgroups exclusively. Changes from original aosp/692189 which was reverted: - There seem to be spurious denials from vendor-specific apps. So added back access from { appdomain -all_untrusted_apps -priv_app } to cgroup. Audit this access with intent to write explicit per-domain rules for it. Bug: 110043362 Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates /dev/memcg on a per app basis on a device that supports that. Test: aosp_sailfish, wahoo boot without cgroup denials This reverts commit cacea25e. Change-Id: I05ab404f348a864e8409d811346c8a0bf49bc47a
-
- Oct 10, 2018
-
-
Nick Kralevich authored
ebc3a1a3 enabled ioctl filtering on normal files and directories. However, no per-ioctl permissions were enforced for symbolic links, named pipes ("mkfifo"), or named sockets. Start enforcing fine-grain ioctl restrictions for symbolic links, named pipes, and named sockets. Motivation: Prevent FS_IOC_ENABLE_VERIFY and FS_IOC_MEASURE_VERITY from being usable on nonsensical filesystem objects and provide a layer of defense for kernel bugs. Test: Device boots and no obvious problem. Change-Id: Id81b496ab64f37a0918f3dfd8fa9aaa3227009cc
-
Nick Kralevich authored
Remove kernel attack surface associated with ioctls on plain files. In particular, we want to ensure that the ioctls FS_IOC_ENABLE_VERITY and FS_IOC_MEASURE_VERITY are not exposed outside a whitelisted set of entities. However, it's straight forward enough to turn on ioctl whitelisting for everything, so we choose to do so. Test: policy compiles and device boots Test: device boots with data wipe Test: device boots without data wipe Change-Id: I545ae76dddaa2193890eeb1d404db79d1ffa13c2
-
Nick Kralevich authored
This reverts commit 9899568f. Reason for revert: Reports of high numbers of SELinux denials showing up on the SELinux dashboard. Bug: 110043362 Change-Id: Id8fc260c47ffd269ac2f15ff7dab668c959e3ab0
-
- Oct 09, 2018
-
-
Tri Vo authored
What changed: - Removed cgroup access from untrusted and priv apps. - Settings app writes to /dev/stune/foreground/tasks, so system_app domain retains access to cgroup. - libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used abundantly in native code. So added a blanket allow rule for (coredomain - apps) to access cgroups. - For now, only audit cgroup access from vendor domains. Ultimately, we want to either constrain vendor access to individual domains or, even better, remove vendor access and have platform manage cgroups exclusively. Bug: 110043362 Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates /dev/memcg on a per app basis on a device that supports that. Test: aosp_sailfish, wahoo boot without cgroup denials Change-Id: I9e441b26792f1edb1663c660bcff422ec7a6332b
-
- Oct 08, 2018
-
-
Tri Vo authored
Bug: 117178352 Test: no denials to /system/asan.options on asan walleye Change-Id: I6042693afb926a22a3e2be79bd2a7ba062806143
-
- Oct 04, 2018
-
-
Martijn Coenen authored
apexd is a new daemon for managing APEX packages installed on the device. It hosts a single binder service, "apexservice". Bug: 112455435 Test: builds, binder service can be registered, apexes can be accessed, verified and mounted Change-Id: I634ad100f10b2edcd9a9c0df0d33896fa5d4ed97
-
- Sep 27, 2018
-
-
Nick Kralevich authored
system_file_type is a new attribute used to identify files which exist on the /system partition. It's useful for allow rules in init, which are based off of a blacklist of writable files. Additionally, it's useful for constructing neverallow rules to prevent regressions. Additionally, add commented out tests which enforce that all files on the /system partition have the system_file_type attribute. These tests will be uncommented in a future change after all the device-specific policies are cleaned up. Test: Device boots and no obvious problems. Change-Id: Id9bae6625f042594c8eba74ca712abb09702c1e5
-
Nick Kralevich authored
/system/usr/share/zoneinfo is currently labeled zoneinfo_data_file, a label shared with /data/misc/zoneinfo. However, each of these directory locations has different security characteristics. In particular, the files in /system/usr/share/zoneinfo must never be writable, whereas /data/misc/zoneinfo may be written to by system_server. Reusing the same label hides these different security characteristics. Create a separate label for /system/usr/share/zoneinfo. Test: Device boots and no obvious problems. Change-Id: I8cf16ff038b06b38f77388e546d9b7a6865f7879
-
- Sep 23, 2018
-
-
Jeff Vander Stoep authored
Assert that only apps and installd may open private app files. Remove "open" permission for mediaserver/vold and remove their neverallow exemption. Test: verify no related audit messages in the logs. Test: build Fixes: 80300620 Fixes: 80418809 Bug: 80190017 Change-Id: If0c1862a273af1fedd8898f334c9b0aa6b9be728
-
- Sep 20, 2018
-
-
Tri Vo authored
This change limits global access to /system files down to: /system/bin/linker* /system/lib[64]/* /system/etc/ld.config* /system/etc/seccomp_policy/* /system/etc/security/cacerts/* /system/usr/share/zoneinfo/* Bug: 111243627 Test: boot device, browse internet without denials to system_* types. Test: VtsHalDrmV1_{1, 0}TargetTest without denials Change-Id: I69894b29733979c2bc944ac80229e84de5d519f4
-
- Sep 19, 2018
-
-
Benjamin Gordon authored
kernel commit 2a4c22426955d4fc04069811997b7390c0fb858e (fs: switch order of CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH checks) swapped the order of dac_override and dac_read_search checks. Domains that have dac_override will now generate spurious denials for dac_read_search unless they also have that permission. Since dac_override is a strict superset of dac_read_search, grant dac_read_search to all domains that already have dac_override to get rid of the denials. Bug: 114280985 Bug: crbug.com/877588 Test: Booted on a device running 4.14. Change-Id: I5c1c136b775cceeb7f170e139e8d4279e73267a4
-
- Sep 18, 2018
-
-
Tri Vo authored
In cases when a device upgrades to system-as-root from O to P, it needs a mount point for an already existing partition that is accessed by both system and vendor. Devices launching with P must not have /mnt/vendor accessible to system. Bug: 78598545 Test: m selinx_policy Change-Id: Ia7bcde44e2b8657a7ad9e0d9bae7a7259f40936f
-
- Sep 14, 2018
-
-
Nick Kralevich authored
Add additional compile time constraints on the ability to ptrace various sensitive domains. llkd: remove some domains which llkd should never ptrace, even on debuggable builds, such as kernel threads and init. crash_dump neverallows: Remove the ptrace neverallow checks because it duplicates other neverallow assertions spread throughout the policy. Test: policy compiles and device boots Change-Id: Ia4240d1ce7143b983bb048e046bb4729d0af5a6e
-
- Sep 13, 2018
-
-
Hridya Valsaraju authored
Metadata needs to be erased as part of fastboot flashall -w. Test: fastboot erase metadata Bug: 113648914 Change-Id: I38a0debd9face16cad9d9a13a48549f3f58652fa
-
- Sep 12, 2018
-
-
Nick Kralevich authored
Test: comments only. Policy compiles. Change-Id: Ic51533d37fff6c553950a122f33a48e3c119c67c
-
- Sep 11, 2018
-
-
Martijn Coenen authored
But in a very restricted form: 1) Nobody can initiate calls into init 2) Nobody can transfer binder objects into init, except servicemanager Bug: 112684055 Test: device boots Change-Id: Icfb218f2871e234284c74e096eccd7a2e786cf94
-
- Sep 06, 2018
-
-
Nick Kralevich authored
Not needed for modern Android versions. These rules are really, really old. Test: "adb bugreport" continues to work Test: Generating a bugreport via key combo continues to work. Change-Id: Ibc1157fb36abd7fc701db3819474f25210a3cb5f
-