Commit graph

4190 commits

Author SHA1 Message Date
Tom Cherry
aa4af2c082 Merge "Allow domain access r_file_perms for passwd and group files" 2019-07-19 18:00:41 +00:00
Tom Cherry
da05f1d6b8 Allow domain access r_file_perms for passwd and group files
In b/73062966, we add new AID ranges for each partition that doesn't
yet have them (system, system_ext, odm, product).  We also add group
and passwd files to these partitions to be able to map these AIDs into
human readable user and group names, and vice versa.

All processes should be able to read all users and groups.  We divide
the ranges into non-overlapping regions for each partition and we
namespace the names with the partition name as a prefix.

Allow domain r_file_perms to
/(system|product|system_ext)/etc/(group|passwd).

Vendor and odm passwd and group files already have this access, since
/(vendor|odm)/etc/* is already domain readable.

Example contents:
blueline:/ $ cat /system/etc/passwd
system_tom::6050:6050::/:/bin/sh
blueline:/ $ cat /product/etc/passwd
product_tom::7013:7013::/:/bin/sh

Bug: 73062966
Test: tree-hugger selinux denial during boot test
Change-Id: Ib4dc31778e95e952174e1365497feaf93dca7156
2019-07-19 09:19:23 -07:00
David Anderson
9859aa0a24 Merge "Add selinux labels for /metadata/ota." 2019-07-18 22:42:13 +00:00
David Anderson
c1bc87394d Add selinux labels for /metadata/ota.
/metadata/ota will store critical bits necessary to reify
system and vendor partition state during an OTA. It will be accessed
primarily by first-stage init, recovery/fastbootd, and update_engine.

Bug: 136678799
Test: manual test
Change-Id: Ib78cb96ac60ca11bb27d2b2fe011482e64ba0cf8
2019-07-16 13:38:10 -07:00
Roshan Pius
3aa1c1725e sepolicy: Permission changes for new wifi mainline module
Move wifi services out of system_server into a separate APK/process.

Changes:
a) Created sepolicy for the new wifi apk.
b) The new APK will run with network_stack uid (eventually will be moved
to the same process).

Used 'audit2allow' tool to gather list of permissions required.

Note: The existing wifi related permissions in system_server is left
behind to allow the module to be loaded into system_server or
network_stack process depending on device configuration.

Bug: 113174748
Test: Device boots up and able to make wifi connection.
Test: Tested hotspot functionality.
Test: Ran WifiManagerTest & WifiSoftApTest ACTS tests locally.
Test: Will send for wifi regression tests.
Change-Id: Id19643a235bf0c28238f2729926b893ac2025b97
(cherry-picked from c7aa90091e6bec70a31a643cc4519a9a86fb0b38)
2019-07-16 13:30:15 -07:00
Tom Cherry
4c52cedf22 Merge "Allow dumpstate to read /data/misc/logd always" 2019-07-15 23:28:23 +00:00
David Anderson
17231129ce Merge "Allow fastbootd and update_engine to read from sysfs_dm." 2019-07-12 23:03:41 +00:00
Treehugger Robot
3f063ca932 Merge "Remove unused permissions in init." 2019-07-11 20:16:46 +00:00
Steven Moreland
587008a40b Remove unused permissions in init.
There was some plan to use binder from init, but it was abandoned. As
ServiceManager was recently re-written in C++, and as part of a
continued effort to reduce large dependencies in init and make sure it
is reliable, I'm removing these here.

Bug: 135768100
Test: N/A
Change-Id: I12b57709399c87ee25f689b601572b19abf7fb00
2019-07-10 10:23:52 -07:00
Tom Cherry
77f8d4f8ca Allow dumpstate to read /data/misc/logd always
There is no reason to deny dumpstate from reading /data/misc/logd on
user builds.  Logpersist is disallowed from running on those builds,
so there is no harm in copying this directory.

Bug: 136978224
Test: build
Change-Id: Ia58bde10e1f45978975597cd2ea1951a784d3b49
2019-07-08 13:20:10 -07:00
David Anderson
483e70bd2a Allow fastbootd and update_engine to read from sysfs_dm.
Bug: 135771280
Test: device flashes, boots
Change-Id: I07816b94566d9da6e7831e29c69dbd06a09bbef8
2019-07-08 12:20:58 -07:00
Florian Mayer
19c96aa7a9 Merge "Allow heapprofd to write to /proc/$PID/page_idle." 2019-07-02 12:05:29 +00:00
Florian Mayer
d59250afae Allow heapprofd to write to /proc/$PID/page_idle.
Change-Id: Ic7d13ebfe7c26df14e23976b9329b6ba1b016498
2019-07-02 13:01:11 +01:00
Treehugger Robot
18898abf3f Merge "Sepolicy for added SystemSuspend HAL to ANR list." 2019-07-01 21:43:45 +00:00
Kalesh Singh
113d10baaa Sepolicy for added SystemSuspend HAL to ANR list.
Change-Id: Ib7b647d07c5432ed4cdb674f3c9642cfcb5c9d79
Bug: 135458700
Fixes: 135458700
Test: Trigger ANR dump (adb shell am hang).
grep through logcat for sepolicy denials.
2019-06-28 10:08:22 -07:00
Anton Hansson
22b24a17e8 Remove policy for ro.url.legal*
These props aren't read/written anywhere.

Test: presubmit
Change-Id: I0b7335546a6e798c183fc0c22b6a089cbe576e4c
2019-06-25 15:44:23 +01:00
Tom Cherry
2a67e947c6 Use a property instead of file to communicate cold boot done
Ueventd can't set properties currently, but this is an artificial
limitation, since ueventd communicates to init that it has finished
cold boot via a file, and init polls this file instead of returning to
the epoll loop, where properties are handled.

A related change replaces that file with a property and thus frees
ueventd to be able to set properties.  This change creates the
cold_boot_done property type for this property and gives only ueventd
permissions to set it.

Bug: 62301678
Test: boot, check that properties are set
Change-Id: I40843b423b192ea841db6a82f648e5bab9738e0e
2019-06-20 08:37:46 -07:00
Kevin Chyn
0bdb4f269f Merge "Add rules to dump hal traces" 2019-06-20 07:14:51 +00:00
Kevin Chyn
a18c5bdd70 Add rules to dump hal traces
Test: manual
Bug: 126802513

Change-Id: If037483f305e161a158e30f6322d5e25b7770952
Merged-In: If037483f305e161a158e30f6322d5e25b7770952
2019-06-20 00:31:03 +00:00
Treehugger Robot
f4362c08c7 Merge "Revert "Allow hal_face to write to /data/vendor/camera_calibration/*."" 2019-06-19 23:44:27 +00:00
Matthias Kramm
ebcc08249b Revert "Allow hal_face to write to /data/vendor/camera_calibration/*."
This reverts commit 3a44b17897.

Reason for revert: Moved to downstream repo.

Change-Id: I7d3ad43335f71ed03e7a93bc5c96a8933785afd8
2019-06-19 20:15:50 +00:00
Tao Bao
a999e39423 Add persist.sys.theme.
This property will be set by system_server (to indicate the currently
selected theme for device), and can be accessed by vendor init.rc.

avc:  denied  { read } for property=persist.sys.theme pid=0 uid=0 gid=0 scontext=u:r:vendor_init:s0 tcontext=u:object_r:theme_prop:s0 tclass=file

Bug: 113028175
Test: Set a vendor init trigger that waits on `persist.sys.theme`. Check
      that the trigger fires without denial.
Change-Id: Ia85b1a8dfc118efdbb9337ca017c8fb7958dc386
Merged-In: Ibb4e392d5059b76059f36f7d11ba82cd65cbe970
(cherry picked from commit 75182a1ea6)
2019-06-18 17:36:21 -07:00
Treehugger Robot
c25272db17 Merge "Add permission required by libdm_test" 2019-06-18 03:49:24 +00:00
Hridya Valsaraju
faa29331cd Add permission required by libdm_test
This CL fixes the following denials during libdm_test
that is part of VTS.

avc: denied { read } for comm="loop1" path=2F6D656D66643A66696C655F32202864656C6574656429
dev="tmpfs" ino=97742 scontext=u:r:kernel:s0 tcontext=u:object_r:appdomain_tmpfs:s0
tclass=file permissive=0
W loop1   : type=1400 audit(0.0:371): avc: denied { read } for
path=2F6D656D66643A66696C655F32202864656C6574656429 dev="tmpfs" ino=97742 scontext=u:r:kernel:s0
tcontext=u:object_r:appdomain_tmpfs:s0 tclass=file permissive=0

Bug: 135004816
Test: adb shell libdm_test
Change-Id: Ifb6d58ee6f032cdf3952a05667aa8696d6e2a2fa
Merged-Id: Ifb6d58ee6f032cdf3952a05667aa8696d6e2a2fa
2019-06-18 03:47:58 +00:00
Matthias Kramm
9faeec71f2 Merge "Allow hal_face to write to /data/vendor/camera_calibration/*." 2019-06-17 19:31:50 +00:00
Treehugger Robot
1eb45b5606 Merge "In native coverage builds, allow all domains to access /data/misc/trace" 2019-06-14 18:35:25 +00:00
Treehugger Robot
f1f2b514fe Merge "Add macro for dumping hal debug info" 2019-06-14 15:38:24 +00:00
Rick Yiu
1a94b30d9a Add macro for dumping hal debug info
Hal debug info could be dumped in user build by using this macro.

Bug: 134545528
Test: build pass
Change-Id: I650d69607c75b73e95efb3647de5dd03b86cb143
2019-06-14 15:37:59 +00:00
Pirama Arumuga Nainar
ce9c0c5a5f In native coverage builds, allow all domains to access /data/misc/trace
Bug: http://b/135139675

Coverage files are written to /data/misc/trace (governed by the
method_trace_data_file selinux type).  Allow all domains to access
(create directories, access files) this directory when native coverage
is enabled (by setting NATIVE_COVERAGE to true) in an userdebug or eng
build.

Also relax neverallow constraints to allow access to
method_trace_data_file for native coverage builds.

Test: Build 32-bit cuttlefish with coverage:
          m NATIVE_COVERAGE=true COVERAGE_PATHS="*"
      and verify that there are no selinux denials in kernel log and
      logcat.

Change-Id: I3fe7c77612854b9de7de7a0ddd5cbf44a2f5c21e
2019-06-14 08:31:51 -07:00
Matthias Kramm
3a44b17897 Allow hal_face to write to /data/vendor/camera_calibration/*.
Also, allow hal_camera to read from there.

Bug: 133792720
Change-Id: Iedec8d7325b4424d166f8e4d09182e1f29808ef2
Test: Running presubmit.
2019-06-14 05:53:59 -07:00
Jiyong Park
6e823dd597 Allow apexd to stop itself
apexd stops itself when it finds that it is running on a device with
flattened APEXes (i.e. ro.apex.updatable = false).

Bug: 133907211
Test: launch sdk_phone_x86_64
adb logcat -d | grep apexd | wc -l
returns 3

Change-Id: I7fa161b069aa34adb028194b55f367fe740a0cfc
2019-06-13 09:45:05 +09:00
Treehugger Robot
7d258073df Merge "Give hal_drm_server appdomain fd access." 2019-06-10 18:20:47 +00:00
Treehugger Robot
06984017b7 Merge "Sepolicy for vendor hals to access IAshmem" 2019-06-08 06:06:17 +00:00
Kalesh Singh
55181e7f9b Sepolicy for vendor hals to access IAshmem
Although this may appear very permissive, it ok since the current allow
rule already gives every domain access to /dev/ashmem.

Change-Id: I1f121a3c6a911819b2c3e0605a0544a039cb5503
Bug: 134161662
Test: Check logcat for Sepolicy denials (logcat -d | grep shmem)
2019-06-07 15:50:44 -07:00
Joel Galenson
0608ab5f9d Give hal_drm_server appdomain fd access.
Test: Build.
Change-Id: I29f68964f4ae2ad2c3a00c96f57f48448d8b6dfb
2019-06-05 10:12:28 -07:00
Luke Huang
848075e330 Merge "Clean sepolicy of unused netd_socket" 2019-06-03 06:39:15 +00:00
Luke Huang
3a97f5ae8c Clean sepolicy of unused netd_socket
Bug: 65862741
Test: built, flashed, booted
Change-Id: I25578e54f8c222d381c8f8ea0ec143b5b503b6a6
Merged-In: I726aadd54b04df68cff992b70443c0335ca50972
2019-05-30 17:41:16 +08:00
Treehugger Robot
b374835ffb Merge "Sepolicy for IAshmem HIDL interface" 2019-05-30 07:36:41 +00:00
Kalesh Singh
46303aa1f7 Sepolicy for IAshmem HIDL interface
Change-Id: Id78f995661120f136d671ea0084db358e7662122
Bug: 133443879
Test: Manually check logcat for sepolicy denials (logcat | grep IAshmem)
2019-05-29 14:44:47 -07:00
Jiyong Park
04d2392c35 Don't use apexd when TARGET_FLATTEN_APEX == true
/system/apex/com.android.runtime is labeled as runtime_apex_dir
and init is allowed to mount on it.

When TARGET_FLATTEN_APEX is true (= ro.apex.updatable is unset or set to
false), apexd is not used to activate the built-in flattened APEXes.
Init simply bind-mounts /system/apex to /apex.

However, there is a special case here. The runtime APEX is installed as
either /system/apex/com.android.runtime.debug or
/system/apex/com.android.runtime.release, whereas it should be activated
on /apex/com.android.runtime - without the .debug or .release suffix.
To handle that case, the build system creates an empty directory
/system/apex/com.android.runtime and the .debug or .release directory
is bind-mounted to the empty directory by init at runtime.

Bug: 132413565
Test: marlin is bootable
Merged-In: I3fde5ff831429723fecd1fa5c10e44f636a63f09
Change-Id: I3fde5ff831429723fecd1fa5c10e44f636a63f09
(cherry picked from commit 99902a175b)
2019-05-29 07:06:28 +09:00
David Anderson
e93049f9f1 Merge "Allow init to mkdir inside /data/gsi." 2019-05-28 14:58:40 +00:00
Treehugger Robot
b693197a34 Merge "drop "allow healthd self:process execmem;"" 2019-05-23 22:17:31 +00:00
David Anderson
0b1094cc23 Allow init to mkdir inside /data/gsi.
Bug: 133435561
Test: adb shell gsi_tool install
Change-Id: Iaa610c72d8098e157bb89e321624369f86f4ea19
2019-05-23 13:45:00 -07:00
David Anderson
0f0fbd44f9 Merge "Fix selinux denials when applying updates in recovery." 2019-05-23 20:15:45 +00:00
Nick Kralevich
b192f0e7c7 drop "allow healthd self:process execmem;"
The execmem capability indicates that the processes creates anonymous
executable memory, which is most commonly used for JITing functionality.
All of the healthd executable code comes from the filesystem, and
healthd does not rely on JITing or loading code from non-file based
sources, so this permission is unnecessary.

Bug: 32659667
Test: compiles and boots
Change-Id: Ifb2b68625b191cb002dbb134cace6ddd215236e8
2019-05-23 11:17:21 -07:00
David Anderson
d431c2bfe5 Fix selinux denials when applying updates in recovery.
These lines are copied from update_engine.te, and are needed to update
dynamic partitions in recovery.

Bug: 132943965
Test: sideload OTA on cuttlefish
Change-Id: Id03a658aac69b8d20fa7bb758530a4469c75cf9c
2019-05-22 15:52:03 -07:00
Nikita Ioffe
1c4a5260c1 selinux: Allow dumpstate send signals to vold
Test: adb bugreport
Test: verified vold stacktrace is present in bugreport
Bug: 132344997
Change-Id: I0ebf7f171d854b9aaf894ccb8c7a5f68f18e692b
Merged-In: I0ebf7f171d854b9aaf894ccb8c7a5f68f18e692b
(cherry picked from commit f7c3d19d29)
2019-05-21 20:39:07 +01:00
Tao Bao
ccf8af80b0 Merge "Add vendor_misc_writer." 2019-05-21 13:41:07 +00:00
Treehugger Robot
5a3d30eadf Merge "Relabel /proc/kpageflags and grant access to heapprofd." 2019-05-21 00:03:59 +00:00
Tao Bao
42c05cfcc1 Add vendor_misc_writer.
The space between 2K and 16K in /misc is currently reserved for vendor's
use (as claimed in bootloader_message.h), but we don't allow vendor
module to access misc_block_device other than vendor_init.

The change in the topic adds a `misc_writer` tool as a vendor module,
which allows writing data to the vendor space to bridge the gap in the
short term. This CL adds matching labels to grant access.

Long term goal is to move /misc as vendor owned, then to provide HAL
access from core domain (b/132906936).

Bug: 132906936
Test: Build crosshatch that includes misc_writer module. Invoke
      /vendor/bin/misc_writer to write data to /misc.
Change-Id: I4c18d78171a839ae5497b3a61800193ef9e51b3b
2019-05-20 14:40:15 -07:00