Commit Graph

172 Commits

Author SHA1 Message Date
Treehugger Robot
f173b14363 Merge "traced_perf sepolicy tweaks" 2020-02-25 04:18:25 +00:00
Ryan Savitski
008465e5ec traced_perf sepolicy tweaks
* allow shell to enable/disable the daemon via a sysprop
* don't audit signals, as some denials are expected
* exclude zygote from the profileable set of targets on debug builds.
  I've not caught any crashes in practice, but believe there's a
  possibility that the zygote forks while holding a non-whitelisted fd
  due to the signal handler.

Change-Id: Ib237d4edfb40b200a3bd52e6341f13c4777de3f1
2020-02-24 12:23:13 +00:00
Collin Fijalkovich
b1b15013e9 Use prefixes for binder cache SELinux properties.
Adds a context for telephony related cache properties and changes
the bluetooth and system_server properties to match off of prefix
instead of exact string matches.

Test: Flashed phone with PowerManager caches enabled and verified
that the phone boots.

Change-Id: I9110192a12bb6222e49a8fb6b266d6067ef2ea92
2020-02-21 15:25:46 -08:00
Joshua Duong
b8c108e15f Merge "Add adbd_prop, system_adbd_prop property types." 2020-02-21 00:28:48 +00:00
Joshua Duong
18988fcce3 Add adbd_prop, system_adbd_prop property types.
service.adb.tls.port contains the adbd tcp port running the TLS server.
persist.sys.adb.wifi tells adbd when to enable the TLS server.

Bug: 149348431
Bug: 111434128

Test: Enable wireless debugging, check if TLS port information is
displayed in the Developer options > Wireless debuggging.
Change-Id: I5b5c5a3d064bc003f41386ede9051609fefec53e
2020-02-20 07:52:34 -08:00
Ken Chen
622e4f761b Merge "Define sepolicy for redirect-socket-calls feature" 2020-02-20 05:18:55 +00:00
Kiyoung Kim
dc34050e17 Remove sys.linker property
sys.linker property was defined to enable / disable generate linker
configuration, but the property has been removed. Remove sys.linker
property definition as it is no longer in use

Bug: 149335054
Test: m -j passed && cuttlefish worked without sepolicy error
Change-Id: Iacb2d561317d0920f93104717ce4f4bb424cc095
Merged-In: Iacb2d561317d0920f93104717ce4f4bb424cc095
2020-02-19 10:16:06 +09:00
David Stevens
3942fe1682 selinux policy for buffer queue config
Test: boot and check for no policy violations

Change-Id: I1ea2a79b9a45b503dcb061c196c5af1d0ddab653
2020-02-13 20:11:47 +09:00
Ken Chen
64f0be204b Define sepolicy for redirect-socket-calls feature
Define two property_context.

1. vendor_socket_hook_prop - for ro.vendor.redirect_socket_calls. The
property set once in vendor_init context. It's evaluated at process
start time and is cannot change at runtime on a given device. The set
permission is restricted to vendor_init. The read permission is
unrestricted.

2. socket_hook_prop - for net.redirect_socket_calls.hooked. The
property can be changed by System Server at runtime. It's evaluated when
shimmed socket functions is called. The set permission is restricted to
System Server. The read permission is unrestricted.

Bug: Bug: 141611769
Test: System Server can set net.redirect_socket_calls.hooked
      libnetd_client can read both properties
      libnetd_client can't set both properties

Change-Id: Ic42269539923e6930cc0ee3df8ba032797212395
2020-02-11 20:55:02 +08:00
Nikita Ioffe
4119b07d1b Merge "Add userspace_reboot_log_prop" 2020-02-10 17:22:03 +00:00
Inseob Kim
2597b513b3 Move some properties to system_vendor_config_prop
system_vendor_config_prop defines a property contexts which can only be
set from vendor_init. It is one of the mostly used patterns of system
properties. This migrates some properties to help readability and
security.

Bug: 148125056
Test: system/sepolicy/build_policies.sh
Change-Id: I6b53ef520331b32417ad59f4daa04bdfc077f682
2020-02-08 08:34:17 +09:00
Nikita Ioffe
44f5ffca15 Add userspace_reboot_log_prop
This properties are used to compute UserspaceRebootAtom and are going to
be written by system_server. Also removed now unused
userspace_reboot_prop.

Test: builds
Bug: 148767783
Change-Id: Iee44b4ca9f5d3913ac71b2ac6959c232f060f0ed
2020-02-07 01:57:55 +00:00
Yifan Hong
5a3105e619 Move virtual_ab_prop to vendor partition.
These properties are owned by system, but is configurable
in vendor partition.

Test: apply OTA
Bug: 148569015
Change-Id: I24baa981d1f850cd18a3429f6e0a4efd31a8570d
2020-02-03 10:42:35 -08:00
Inseob Kim
28dd9a1d53 Fix treble boundary neverallow to use attributes
These neverallow rules are to prevent properties from crossing treble
boundary. As attributes like internal / restricted / public has been
landed, the neverallow rules are changed to use attributes to avoid
endless manual maintaining of the list.

Bug: 148181222
Test: system/sepolicy/tools/build_policies.sh
Change-Id: I0ba930f6c78852e785858fb069faf4f984643e34
2020-01-29 19:23:28 +09:00
Kenny Root
960f73b75b rebootescrow: allow use of block file
pmem uses a block file while access_ramoops uses a char file. Allow both for
now until we can unify on pmem.

Additionally allow the reading of vendor properties so it can read the
path to the character or block device to open.

Test: atest VtsHalRebootEscrowTargetTest
Bug: 146400078
Change-Id: Ief61534e0946480a01c635ce1672579959ec8db5
2020-01-27 12:28:44 -08:00
Treehugger Robot
b9b2acff99 Merge "Whitelisting window_manager_native_boot system property" 2020-01-24 19:52:07 +00:00
Lee Shombert
edd4726300 Merge "Support for more binder caches" 2020-01-23 15:44:39 +00:00
Lee Shombert
097f9794f4 Support for more binder caches
Bug: 140788621

This adds keys for several planned binder caches in the system server
and in the bluetooth server.  The actual cache code is not in this
tree.

Test: created a test build that contains the actual cache code and ran
some system tests.  Verified that no protection issues were seen.

Change-Id: Ibaccb0c0ff8b127d14cf769ea4156f7d8b024bc1
2020-01-22 08:21:08 -08:00
Valerie Hau
7b2a2dff0c Whitelisting window_manager_native_boot system property
Bug: 147096935
Test: build, boot

Change-Id: Iadeefa3cfc9bb17eb19b60dbd18de047fa01b673
2020-01-21 22:54:49 +00: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
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
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
Nikita Ioffe
0b099c801d Merge "Add userspace_reboot_config_prop property type" 2020-01-09 10:05:18 +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
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
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
Justin Yun
ed0a8ebe50 Revert "Revert "Define sepolicy for ro.product.vndk.version""
This reverts commit f536a60407.

Reason for revert: Resubmit the CL with the fix in vendor_init.te

Bug: 144534640
Test: lunch sdk-userdebug; m sepolicy_tests
Change-Id: I47c589c071324d8f031a0f7ebdfa8188869681e9
2020-01-06 15:12:14 +09:00
Justin Yun
f536a60407 Revert "Define sepolicy for ro.product.vndk.version"
This reverts commit 59e3983d1f.

Reason for revert: postsubmit fails in aosp/master

Change-Id: Icb10402ccdb6cff942a91adef341fe8f867f308a
2020-01-06 05:28:37 +00:00
Justin Yun
59e3983d1f Define sepolicy for ro.product.vndk.version
Define a new property_context vndk_prop for ro.product.vndk.version.
It is set by init process but public to all modules.

Bug: 144534640
Test: check if ro.product.vndk.version is set correctly.
Change-Id: If739d4e25de93d9ed2ee2520408e07a8c87d46fe
2020-01-06 11:08:23 +09:00
Nikita Ioffe
2848fa4d8b Revert "Reland: "Add userspace_reboot_config_prop property type""
This reverts commit 7b53803b53.

Reason for revert: breaks build
Exempt-From-Owner-Approval: revert to fix broken build
Change-Id: Ic26ee0a8b0a54b86034970e2b18edf0b5f4ec46f
2019-12-26 16:14:45 +00:00
Nikita Ioffe
7b53803b53 Reland: "Add userspace_reboot_config_prop property type"
Only difference with
https://android-review.googlesource.com/c/platform/system/sepolicy/+/1198254
is userspace_reboot_config_prop is now system_restricted_prop.

Marking it as system_internal_prop breaks build:
neverallow check failed at out/target/product/generic/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy:11968 from system/sepolicy/public/property.te:230
(neverallow base_typeattr_210 base_typeattr_467 (file (ioctl read write create setattr lock relabelfrom append unlink link rename open watch watch_mount watch_sb watch_with_perm watch_reads)))
<root>
allow at out/target/product/generic/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy:13021
(allow vendor_init base_typeattr_502 (file (read getattr map open)))

Test: flash && adb shell getprop ro.init.userspace_reboot.is_supported
Test: m checkbuild
Bug: 135984674
Change-Id: I6f54dcff8d9b62224f315452e9c320648422b5db
2019-12-24 12:44:36 +00:00
Jayachandran Chinnakkannu
3bd8767540 Revert "Add userspace_reboot_config_prop property type"
This reverts commit 8b570f0c60.

Reason for revert: b/146792618 multiple build breaks

Change-Id: Ieab05ce56826d2fc84d46940935705abd2e1a55f
2019-12-23 19:01:13 +00:00
Nikita Ioffe
8b570f0c60 Add userspace_reboot_config_prop property type
This type will be used for read-only properties used to configure
userspace reboot behaviour (e.g. whenever device supports it, watchdog
timeout, etc.).

Test: adb shell getprop ro.init.userspace_reboot.is_supported
Bug: 135984674
Change-Id: I387b2f2f6e3ca96c66c8fa3e6719d013d71f76c7
2019-12-23 15:10:40 +00:00
Treehugger Robot
a75fa8058c Merge "Create new system property type for Factory OTA could write system property" 2019-12-15 19:26:39 +00:00
Henry Tung
6d57b494c0 Create new system property type for Factory OTA could write system property
Due to Factory OTA client install in product partition but it also declare coredomian in
its sepolicy setting. That will let Factory OTA unable to find a property type could write system property.
But now Factory OTA have a restore NFC wake function need to write system property for communicate with bootloader.
So we need to create a new property type in system framework which could allow Factory OTA client to write system property.

Bug: 145178094
Test: Manual
Change-Id: Ic549cc939893ec67a46bf28a23ebeb9f9b81bd0b
2019-12-13 09:39:19 +00:00
Tomasz Wasilczyk
e7f2a17b2e Merge "Allow vendor-init selecting Vehicle HAL instance to use." 2019-12-06 16:55:48 +00:00
Anton Hansson
902f4fe2e6 Merge "Add sepolicy for sdkext module prop" 2019-12-06 11:13:03 +00:00
Tomasz Wasilczyk
d9999bebc9 Allow vendor-init selecting Vehicle HAL instance to use.
Bug: 143779011
Test: added PRODUCT_PROPERTY_OVERRIDES for ro.vehicle.hal
Change-Id: I01ec302f3aedae0b021aa34952805e764d45f431
2019-12-05 08:49:49 -08:00
Treehugger Robot
4c8a849f25 Merge "sepolicy: allow rules for apk verify system property" 2019-12-05 16:08:37 +00:00
Anton Hansson
e822545909 Add sepolicy for sdkext module prop
Add a domain for derive_sdk which is allowed to set
persist.com.android.sdkext.sdk_info, readable by all
apps (but should only be read by the BCP).

Bug: 137191822
Test: run derive_sdk, getprop persist.com.android.sdkext.sdk_info
Change-Id: I389116f45faad11fa5baa8d617dda30fb9acec7a
2019-12-05 14:11:50 +00:00
Victor Hsieh
8b65b0b12d sepolicy: allow rules for apk verify system property
ro.apk_verity.mode was introduced in P on crosshatch. This change
changes the label from default_prop to a new property, apk_verity_prop.

ro.apk_verity.mode is set by vendor_init per build.prop, in order to
honor Treble split.  It is also read by system_server and installd
currently.

Test: verify functioning without denials in dmesg
Bug: 142494008
Bug: 144164497
Change-Id: I1f24513d79237091cf30025bb7ca63282e23c739
2019-12-03 10:09:35 -08:00
Inseob Kim
b4baf73477 Fix vendor defining macros and neverallows
init and dumpstate should be able to access all properties, but they are
in coredomain, so neverallow rules for vendor properties should be
changed in order to avoid conflicts.

Bug: 145339613
Test: add vendor_internal_prop manually and build.
Change-Id: If582870f855e4444f8ac0d091696c0c7fd833791
2019-12-03 18:42:12 +09:00
David Sehr
fa67ec4126 Revert^2 "SELinux policy for system server JVMTI"
This reverts commit baa06ee2cd.

Reason for revert: Added missing property name in vendor_init.te.

Bug: none
Test: none (other than neverallow checking)
Change-Id: I9e93bf4ea6ca3a4634f8f4cbce2f13c5f410883b
2019-11-25 15:53:52 -08:00
Raman Tenneti
baa06ee2cd Revert submission
Reason for revert: BUG: 145006573

Change-Id: I87f640383ab0fc4005ce31f938e81dcfa6572058
2019-11-22 21:07:49 +00:00
David Sehr
38f6e59bd6 SELinux policy for system server JVMTI property
Add the SELinux policy to implement a no-write persistent property
controlling whether to launch a JVMTI agent in the system server.

Bug: none
Test: none (other than the neverallow)
Change-Id: Ic70ee5b05c5507b4159ef4c825a360be47bc02b0
2019-11-21 15:50:37 -08:00
Nikita Ioffe
a0bba66aac Merge "Add selinux rules for userspace reboot related properties" 2019-11-20 13:04:16 +00:00
Nikita Ioffe
7065e46b5d Add selinux rules for userspace reboot related properties
By default sys.init.userspace_reboot.* properties are internal to
/system partition. Only exception is
sys.init.userspace_reboot.in_progress which signals to all native
services (including vendor ones) that userspace reboot is happening,
hence it should be a system_public_prop.

Only init should be allowed to set userspace reboot related properties.

Bug: 135984674
Test: builds
Test: adb reboot userspace
Change-Id: Ibb04965be2d5bf6e81b34569aaaa1014ff61e0d3
2019-11-19 17:41:28 +00:00
Tianjie Xu
f5ddc0444b Add a new context for property ota.warm_reset
The property is set to inform kernel to do a warm_reset on the next
reboot. This is useful to persist the logs to debug device boot
failures. More details in http://go/rvc-ota-persist-logs.

The property is set to 1 by update_engine after an OTA. And it's set to
0 by update_verifier or vold after we mark the current slot boot
successful.
The property is read by vendor_init. And according to its value,
vendor_init writes a particular sysfs file to schedule a warm reset
on the following reboot.

Without the new context, the denial message says:
[   13.423163] audit: type=1107 audit(1746393.166:8): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc:  denied  { read } for property=ota.warm_reset pid=0 uid=0 gid=0 scontext=u:r:vendor_init:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0'
[   23.096497] init: Unable to set property 'OTA.warm_reset' from uid:0 gid:2001 pid:841: SELinux permission check failed
[   23.096574] type=1107 audit(1573768000.668:42): uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc: denied { set } for property=OTA.warm_reset pid=841 uid=0 gid=2001 scontext=u:r:update_verifier:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0'
[   23.108430] update_verifier: Failed to reset the warm reset flag

Bug: 143489994
Test: check the property can be set by update_engine, and read by vendor_init
Change-Id: I87c12a53a138b72ecfed3ab6a4d846c20f5a8484
2019-11-14 15:24:25 -08:00
Shafik Nassar
6ff3c39b1f Merge "Add native flags namespace storage_native_boot" 2019-10-17 16:00:20 +00:00
Inseob Kim
1f2b784403 Make public for exported properties on old devices
Properties which are already allowed to be written by vendor_init can't
be internal or restricted prop. This sets the properties as public
except for forbidden ones on vendor_init.te.

Bug: 131162102
Test: system/sepolicy/tools/build_policies.sh
Change-Id: Icc1e813e78a48856adee26fb20f01300713e1d30
2019-10-17 14:56:56 +09:00