Commit graph

1027 commits

Author SHA1 Message Date
Lakshman Annadorai
4d277b7baa Revert "Add sepolicies for CPU HAL."
This reverts commit f4ab6c9f3c.

Reason for revert: CPU HAL is no longer required because the CPU frequency sysfs files are stable Linux Kernel interfaces and could be read directly from the framework.

Change-Id: I8e992a72e59832801fc0d8087e51efb379d0398f
2022-11-09 16:47:07 +00:00
Lakshman Annadorai
f4ab6c9f3c Add sepolicies for CPU HAL.
Change-Id: Ia091bf8f597a25351b5ee33b2c2afc982f175d51
Test: Ran `m; emulator; adb logcat -b all -d > logcat.txt;`
      and verified CPU HAL is running without any sepolicy violation.
Bug: 252883241
2022-11-04 18:13:00 +00:00
Seigo Nonaka
2b4bcf73e0 Allow system_server to measure fs-verity
Bug: 242892591
Test: atest GtsFontHostTestCases
Test: Manually verified the font files can be updated
Change-Id: Ic72fcca734dc7bd20352d760ec43002707e4c47d
2022-11-01 16:21:20 +09:00
Venkatarama Avadhani
38ff3b4115 Add policies for new services HDMI and HDMICEC
Test: atest vts_treble_vintf_framework_test
      atest vts_treble_vintf_vendor_test
Change-Id: Ic2c0525368218e207be236d073a3fe736151c43f
2022-10-10 15:40:42 +05:30
Vikram Gaur
e1c49f5524 Add SELinux policies for remote_key_provisioning_native namespace.
We need to separate out the feature flags in use by remote key
provisioning daemon (RKPD). For this, I have set up a new namespace
remote_key_provisioning_native. This change adds the SELinux policies to
make sure appropriate permissions are present when accessing the feature
flag for read/write.

Change-Id: I9e73a623f847a058b6236dd0aa370a7f9a9e6da7
Test: TreeHugger
2022-09-29 21:32:58 +00:00
Neil Fuller
bbb00fa4cf Add new type for system settings metadata
Add a new selinux type for a system property used to hold metadata about
the time zone setting system property. Although system settings are
world readable, the associated metadata only needs to be readable by the
system server (currently).

Bug: 236612872
Test: treehugger
Change-Id: Iac1bc3301a049534ea5f69edf27cd85443e6a92e
2022-09-27 16:06:57 +00:00
Neil Fuller
0c4d8fff64 Reduce use of exported_system_prop
Reduce use of "exported_system_prop" by defining 2 new (currently
identical) "locale_prop" and "timezone_prop" types for the system
properties that are for "global system settings". See the comments in
private/property_contexts for details.

Initially the rights of the new types should be identical to
exported_system_prop but they will be reduced with a follow-up commit to
enable easier rollback / progress to be made on related work.

Bug: 236612872
Test: treehugger
Change-Id: I8d818342023bc462376c091b8a522532ccaf15d3
2022-09-27 16:05:54 +00:00
Alex Buynytskyy
aad4ae8a74 Allow system_server to obtain verity root hash for install files.
Bug: 160605420
Test: atest ChecksumsTest, check for selinux denials
Change-Id: I33b60d86317c37ef58a1be691d6a90dfef637db1
2022-09-02 09:30:21 -07:00
Thiébaud Weksteen
c0fef5c1ae Merge "Remove wpantund and lowpan_service" 2022-08-25 23:57:20 +00:00
Hongguang
9515559657 Add properties to configure whether the lazy tuner is enabled.
ro.tuner.lazyhal: system_vendor_config_prop to decide whether the lazy
tuner HAL is enabled.
tuner.server.enable: system_internal_prop to decide whether tuner server
should be enabled.

Bug: 236002754
Test: Check tuner HAL and framework behavior
Change-Id: I6a2ebced0e0261f669e7bda466f46556dedca016
2022-08-23 07:01:05 +00:00
Thiébaud Weksteen
8439a1ff29 Remove wpantund and lowpan_service
Bug: 235018188
Test: TH
Change-Id: I0e2f03ad6d17f5d9223b2c500b6c3183835ec807
2022-08-22 14:09:01 +10:00
Richard Chang
6d5bb236da Merge "sepolicy: allow vendor system native boot experiments property" 2022-08-17 06:29:30 +00:00
Siim Sammul
9c0d804b45 Merge "Allow creating /data/tombstones files by system_server. Needed for ag/18773746" 2022-08-11 09:58:56 +00:00
Richard Chang
74334efa4b sepolicy: allow vendor system native boot experiments property
Grant system_server and flags_health_check permission to set the
properties that correspond to vendor system native boot experiments.

Bug: 241730607
Test: Build
Merged-In: Idc2334534c2d42a625b451cfce488d7d7a651036
Change-Id: I3e98f1b05058245cad345061d801ecd8de623109
2022-08-11 08:03:42 +00:00
John Wu
e5010a22a6 Remove key migration related changes
Migrating keys across UIDs is no longer required

Test: m
Bug: 228999189
Change-Id: I33e85635a4fe82bf1f98a9bfcf505a1067b4ed91
2022-07-20 15:19:37 +10:00
Siarhei Vishniakou
4cb2d3c13d Allow system_server to signal InputProcessor HAL
This is needed for Watchdog to be able to dump InputProcessor HAL.
Watchdog can be triggered locally for testing by patching
InputDispatcher.cpp:

 void InputDispatcher::monitor() {
     // Acquire and release the lock to ensure that the dispatcher has not deadlocked.
     std::unique_lock _l(mLock);
+    std::this_thread::sleep_for(std::chrono::minutes(40));
     mLooper->wake();
     mDispatcherIsAlive.wait(_l);

Bug: 237322365
Test: adb bugreport (after triggering watchdog)
Change-Id: I746df8be4faaef2a67293d6b1c0cde5fa7810de6
Merged-In: I746df8be4faaef2a67293d6b1c0cde5fa7810de6
2022-07-14 22:05:07 +00:00
Thiébaud Weksteen
febedf5a42 Merge "Revert "Remove key migration related changes"" 2022-07-07 08:43:54 +00:00
Thiébaud Weksteen
f412c13a02 Revert "Remove key migration related changes"
This reverts commit 65dcdf2921.

Reason for revert: broken internal target 

Change-Id: Idf57285d95f5466dfa3af08230af4c8f9d76326c
2022-07-07 08:40:23 +00:00
Thiébaud Weksteen
c3cb5a25e3 Merge "Remove key migration related changes" 2022-07-07 04:13:22 +00:00
Ryan Savitski
babba5e83b Revert system app/process profileability on user builds
Please see bug for context.

This reverts commits:
* 6111f0cfc8
* bb197bba02
* 20d0aca7e6

And updates prebuilts/api/33.0 accordingly.

Bug: 217368496
Tested: builds successfully (barbet-userdebug)
Change-Id: If7fcf3d5a2fdb1a48dcaf8ef8f97e8375d461e61
2022-07-01 12:41:01 +00:00
Siim Sammul
252a0502c8 Allow creating /data/tombstones files by system_server.
Needed for ag/18773746

Bug: 225173288
Test: atest ErrorsTest +  manual
Change-Id: I31bab12a59babd9a197cfb03d2417b926e60af84
2022-06-29 15:07:01 +00:00
John Wu
65dcdf2921 Remove key migration related changes
Migrating keys across UIDs is no longer required

Test: m
Bug: 228999189
Change-Id: Icdecbdb3997f9c5b3d470578b1d61e580a1c3537
2022-06-26 01:04:02 +10:00
Maciej Żenczykowski
afa8ca689f Merge "much more finegrained bpf selinux privs for networking mainline" 2022-06-23 11:05:03 +00:00
Almaz Mingaleev
0e70ea793f Merge "Remove TZUvA feature." 2022-06-23 07:47:26 +00:00
Maciej Żenczykowski
b13921c3f0 much more finegrained bpf selinux privs for networking mainline
Goal is to gain a better handle on who has access to which maps
and to allow (with bpfloader changes to create in one directory
and move into the target directory) per-map selection of
selinux context, while still having reasonable defaults for stuff
pinned directly into the target location.

BPFFS (ie. /sys/fs/bpf) labelling is as follows:
  subdirectory   selinux context      mainline  usecase / usable by
  /              fs_bpf               no (*)    core operating system (ie. platform)
  /net_private   fs_bpf_net_private   yes, T+   network_stack
  /net_shared    fs_bpf_net_shared    yes, T+   network_stack & system_server
  /netd_readonly fs_bpf_netd_readonly yes, T+   network_stack & system_server & r/o to netd
  /netd_shared   fs_bpf_netd_shared   yes, T+   network_stack & system_server & netd [**]
  /tethering     fs_bpf_tethering     yes, S+   network_stack
  /vendor        fs_bpf_vendor        no, T+    vendor

* initial support for bpf was added back in P,
  but things worked differently back then with no bpfloader,
  and instead netd doing stuff by hand,
  bpfloader with pinning into /sys/fs/bpf was (I believe) added in Q
  (and was definitely there in R)

** additionally bpf programs are accesible to netutils_wrapper
   for use by iptables xt_bpf extensions

'mainline yes' currently means shipped by the com.android.tethering apex,
but this is really another case of bad naming, as it's really
the 'networking/connectivity/tethering' apex / mainline module.
Long term the plan is to merge a few other networking mainline modules
into it (and maybe give it a saner name...).

The reason for splitting net_private vs tethering is that:
  S+ must support 4.9+ kernels and S era bpfloader v0.2+
  T+ must support 4.14+ kernels and T beta3 era bpfloader v0.13+

The kernel affects the intelligence of the in-kernel bpf verifier
and the available bpf helper functions.  Older kernels have
a tendency to reject programs that newer kernels allow.

/ && /vendor are not shipped via mainline, so only need to work
with the bpfloader that's part of the core os.

Bug: 218408035
Test: TreeHugger, manually on cuttlefish
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I674866ebe32aca4fc851818c1ffcbec12ac4f7d4
(cherry picked from commit 15715aea32)
2022-06-22 16:07:42 -07:00
Florian Mayer
5b3a8333af SELinux configuration for memory safety device configs.
These will get read by system libraries in arbitrary processes, so it's
a public property with read access by `domain`.

Bug: 235129567
Change-Id: I1ab880626e4efa2affe90165ce94a404b918849d
2022-06-15 10:34:54 -07:00
Neil Fuller
37888b33ba Remove TZUvA feature.
The feature was superseded by tzdata mainline module(s).

Bug: 148144561
Test: see system/timezone
Test: m selinux_policy
Change-Id: I48d445ac723ae310b8a134371342fc4c0d202300
Merged-In: I48d445ac723ae310b8a134371342fc4c0d202300
2022-06-13 11:45:50 +00:00
John Wu
b553a30629 Merge "Revert "Revert "Revert "Remove key migration related changes"""" 2022-06-07 01:03:51 +00:00
John Wu
3da8416b5d Revert "Revert "Revert "Remove key migration related changes"""
This reverts commit 82c4d9b474.

Reason for revert: b/235140708

Change-Id: Ifd14bcf4480c74b81602c16723efebef7aad10bd
2022-06-06 22:24:24 +00:00
John Wu
fd6f5dfe6b Merge "Revert "Revert "Remove key migration related changes""" 2022-06-06 17:16:47 +00:00
John Wu
82c4d9b474 Revert "Revert "Remove key migration related changes""
This reverts commit e27f954836.

Reason for revert: this needs to land in AOSP

Change-Id: Ief92bf04eaff4235b0e33d427263bbff312837aa
2022-06-03 18:23:15 +00:00
Patrick Rohr
02b55354bd sepolicy: allow TUNSETLINK and TUNSETCARRIER
This is required for testing new ethernet APIs in T.

Test: TH
Bug: 171872016
Change-Id: I1e6024d7d649be50aa2321543b289f81fcdfc483
2022-05-31 20:36:33 -07:00
Patrick Rohr
817d82bcf5 Merge "Fix system server and network stack netlink permissions" 2022-05-27 01:39:00 +00:00
Treehugger Robot
a4c30a384a Merge "Allow system_server to connect to artd." 2022-05-26 14:33:42 +00:00
Jiakai Zhang
9ed8d3c9be Allow system_server to connect to artd.
Bug: 233915142
Test: m
Change-Id: I07dc0b7ab2e54aea21799698b13651605f4c4b4a
2022-05-26 13:57:53 +01:00
Thiébaud Weksteen
cdf912f65e Merge "Revert "Remove key migration related changes"" 2022-05-26 03:08:29 +00:00
John Wu
e27f954836 Revert "Remove key migration related changes"
This reverts commit cabed18a47.

Reason for revert: b/233922399

Change-Id: Ib371184de3c1bc4e3e0ca951e98d6b5e66952dcc
2022-05-25 23:36:42 +00:00
John Wu
c8d2d1d258 Merge "Remove key migration related changes" 2022-05-25 17:53:17 +00:00
Mohamad Mahmoud
e7d1f32250 Merge "Allow system_server to read io and cpu pressure data Test: tested on device Bug: b/233036368" 2022-05-25 15:49:20 +00:00
Treehugger Robot
f2b91a0199 Merge "Add xfrm netlink permissions for system server" 2022-05-25 01:14:25 +00:00
Benedict Wong
b25b4bf53f Add xfrm netlink permissions for system server
This change enables xfrm netlink socket use for the system server,
and the network_stack process. This will be used by IpSecService
to configure SAs, and network stack to monitor counters & replay
bitmaps for monitoring of IPsec tunnels.

Bug: 233392908
Test: Compiled
Change-Id: I25539dc579f21d6288fa962d1fad9b51573f017d
2022-05-25 00:02:33 +00:00
Mohamad Mahmoud
c49d582df6 Allow system_server to read io and cpu pressure data
Test: tested on device
Bug: b/233036368

Change-Id: Ied90327f97abb771f10ec2efb659bb9090ffa88a
2022-05-24 17:24:54 +00:00
Samiul Islam
61bd67072c Merge "Create a separate label for sandbox root directory" 2022-05-20 07:21:19 +00:00
Patrick Rohr
ab02397814 Fix system server and network stack netlink permissions
Give system_server and network_stack the same permissions as netd.
This is needed as we are continuously moving code out of netd into
network_stack and system_server.

Test: TH
Bug: 233300834
Change-Id: I9559185081213fdeb33019733654ce95af816d99
2022-05-19 22:07:49 -07:00
Mohammad Samiul Islam
d2ffd35cc0 Create a separate label for sandbox root directory
Currently, app process can freely execute path at
`/data/misc_ce/0/sdksandbox/<package-name>` since it's labeled as system
file. They can't read or write, but use 403/404
error to figure out if an app is installed or not.

By changing the selinux label of the parent directory:
`/data/misc_ce/0/sdksandbox`, we can restrict app process from executing
inside the directory and avoid the privacy leak.

Sandbox process should only have "search" permission on the new label so
that it can pass through it to its data directory located in
`/data/misc_ce/0/sdksandbox/<package-name>/<per-sdk-dir>`.

Bug: 214241165
Test: atest SdkSandboxStorageHostTest
Test: `adb shell cd /data/misc_ce/0/sdksandbox` gives error
Test: manual test to verify webview still works
Change-Id: Id8771b322d4eb5532eaf719f203ca94035e2a8ed
Merged-In: Id8771b322d4eb5532eaf719f203ca94035e2a8ed
2022-05-19 16:01:15 +01:00
John Wu
cabed18a47 Remove key migration related changes
Migrating keys across UIDs is no longer required

Test: m
Bug: 228999189
Change-Id: Ic58a77285e105328a1f56ad9a8ca5d80bb559d83
2022-05-18 21:49:28 +00:00
Jeff Vander Stoep
b07c12c39d Iorapd and friends have been removed
Remove references in sepolicy. Leave a few of the types defined since
they're public and may be used in device-specific policy.

Bug: 211461392
Test: build/boot cuttlefish
Change-Id: I615137b92b82b744628ab9b7959ae5ff28001169
2022-05-18 12:07:39 +02:00
Eric Biggers
17369bef4a Remove init's write access to /data/user and /data/media
As a follow-up to https://r.android.com/2078213, remove init's write
access to directories with type system_userdir_file or
media_userdir_file.  This has been made possible by moving the creation
of /data/user/0 and /data/media/obb to vold.

Bug: 156305599
Change-Id: Ib9f43f2b111518833efe08e8cacd727c75b80266
2022-05-12 00:19:29 +00:00
Eric Biggers
b10cffe768 Merge "Restrict creating per-user encrypted directories" 2022-05-09 14:45:11 +00:00
Eric Biggers
9a5992336e Restrict creating per-user encrypted directories
Creating a per-user encrypted directory such as /data/system_ce/0 and
the subdirectories in it too early has been a recurring bug.  Typically,
individual services in system_server are to blame; system_server has
permission to create these directories, and it's easy to write
"mkdirs()" instead of "mkdir()".  Such bugs are very bad, as they
prevent these directories from being encrypted, as encryption policies
can only be set on empty directories.  Due to recent changes, a factory
reset is now forced in such cases, which helps detect these bugs;
however, it would be much better to prevent them in the first place.

This CL locks down the ability to create these directories to just vold
and init, or to just vold when possible.  This is done by assigning new
types to the directories that contain these directories, and then only
allowing the needed domains to write to these parent directories.  This
is similar to what https://r.android.com/1117297 did for /data itself.

Three new types are used instead of just one, since these directories
had three different types already (system_data_file, media_rw_data_file,
vendor_data_file), and this allows the policy to be a bit more precise.

A significant limitation is that /data/user/0 is currently being created
by init during early boot.  Therefore, this CL doesn't help much for
/data/user/0, though it helps a lot for the other directories.  As the
next step, I'll try to eliminate the /data/user/0 quirk.  Anyway, this
CL is needed regardless of whether we're able to do that.

Test: Booted cuttlefish.  Ran 'sm partition disk:253,32 private', then
      created and deleted a user.  Used 'ls -lZ' to check the relevant
      SELinux labels on both internal and adoptable storage.  Also did
      similar tests on raven, with the addition of going through the
      setup wizard and using an app that creates media files.  No
      relevant SELinux denials seen during any of this.
Bug: 156305599
Change-Id: I1fbdd180f56dd2fe4703763936f5850cef8ab0ba
2022-05-05 04:12:46 +00:00
Alex Buynytskyy
0105944bbc Allow system_server to read apk root hash.
Bug: 231354111
Test: presubmit
Change-Id: I01ec32d46014aafff58aaf94146d7a5953ec023e
2022-05-04 16:30:21 -07:00
Jaegeuk Kim
cec541e9ab Merge "allow rename fscklogs" 2022-05-04 07:35:09 +00:00
Treehugger Robot
1d79fd5071 Merge "[MS82.3] Add sepolicy to access connectivity apex directory" 2022-05-03 08:00:18 +00:00
Jaegeuk Kim
90b7070b37 allow rename fscklogs
Bug: 230637147
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Idd45e0f4135f95d9f650c5492481b5e19321c633
2022-05-02 17:19:43 -07:00
Junyu Lai
c43dbf8dec [MS82.3] Add sepolicy to access connectivity apex directory
Test: m
Bug: 230289468
Change-Id: I7e43c09f929a418c6c7b6bcfc3696a242c19f2d8
2022-04-26 02:20:30 +00:00
Michael Wright
d5d2f60795 Add vibrator and power HALs to Watchdog dumps
Test: adb shell am hang --allow-restart, check Last ANR for stacks
Fixes: 211998169
Change-Id: I7cad1e57caed5eb8a5c0092548362fd0a6b1d98d
2022-04-22 14:32:14 +00:00
Maciej Żenczykowski
1ebfb867a8 Merge "Grants clatd privs since forked by system server" 2022-04-21 14:00:23 +00:00
Alistair Delva
ce19c41b8f Merge "Adds GPU sepolicy to support devices with DRM gralloc/rendering" 2022-04-21 04:21:45 +00:00
Felipe Leme
9a385b2112 Adds system_user_mode_emulation_prop property.
It will be used by system_server only (i.e., not even Shell) to let
developers change the system user mode (to be headless or full).

Test: sesearch --allow -t system_user_mode_emulation_prop $ANDROID_PRODUCT_OUT/vendor/etc/selinux/precompiled_sepolicy

Bug: 226643927

Change-Id: Iaba42fd56dce0d8d794ef129634df78f9599260f
2022-04-20 13:28:01 -07:00
Jason Macnak
a93398051c Adds GPU sepolicy to support devices with DRM gralloc/rendering
... such as Cuttlefish (Cloud Android virtual device) which has a
DRM virtio-gpu based gralloc and (sometimes) DRM virtio-gpu based
rendering (when forwarding rendering commands to the host machine
with Mesa3D in the guest and virglrenderer on the host).

After this change is submitted, changes such as aosp/1997572 can
be submitted to removed sepolicy that is currently duplicated
across device/google/cuttlefish and device/linaro/dragonboard as
well.

Adds a sysfs_gpu type (existing replicated sysfs_gpu definitions
across several devices are removed in the attached topic). The
uses of `sysfs_gpu:file` comes from Mesa using libdrm's
`drmGetDevices2()` which calls into `drmParsePciDeviceInfo()` to
get vendor id, device id, version etc.

Bug: b/161819018
Test: launch_cvd
Test: launch_cvd --gpu_mode=gfxstream
Change-Id: I4f7d4b0fb90bfeef72f94396ff0c5fe44d53510c
Merged-In: I4f7d4b0fb90bfeef72f94396ff0c5fe44d53510c
2022-04-18 17:30:56 -07:00
Richard Chang
1c8df204ff Merge "sepolicy: allow vendor system native experiments property" 2022-04-15 03:47:28 +00:00
Kalesh Singh
6ba41462d5 Merge changes from topic "mglru-exp"
* changes:
  Add sepolicy for Multi-Gen LRU sysfs control
  Add sepolicy for mglru_native flag namespace
2022-04-12 13:48:48 +00:00
Richard Chang
7057e4abca sepolicy: allow vendor system native experiments property
Grant system_server and flags_health_check permission to set the
properties that correspond to vendor system native experiments.

Bug: 226456604
Test: Build
Change-Id: Ib2420cf6eaf1645e7f938db32c93d085dd8950a3
2022-04-12 08:11:53 +00:00
Kalesh Singh
9e25714cd7 Add sepolicy for mglru_native flag namespace
Bug: 227651406
Bug: 228525049
Change-Id: I9311b23bd10573fcdb62aba65eb2c6e3d177b467
2022-04-08 13:37:34 -07:00
Shikha Panwar
36daf98e45 Selinux setup for /data/misc/odsign/metrics/
odsign will be writing(metrics) to file
/data/misc/odsign/metrics/odsign-metrics.txt & system_server needs from it.

Test: adb pull /data/misc/odsign/metrics/odsign-metrics.txt after reboot
Bug: 202926606
Change-Id: I020efcee8ca7f5b81f1aa3374bbf2b3a7403186d
2022-04-07 14:18:37 +00:00
Andy Yu
6a10d563ea Merge "Add label and permission for game_mode_intervention.list" 2022-03-30 19:35:59 +00:00
Andy Yu
8337d04202 Add label and permission for game_mode_intervention.list
Bug: 219543620
Doc: go/game-dashboard-information-to-perfetto
Test: TBD
Change-Id: Ic6622aadef05e22c95d4ba739beed0e6fa1f3a38
2022-03-29 14:12:14 -07:00
Treehugger Robot
d796c9eb6c Merge "Add search in bpf directory for bpfdomains" 2022-03-25 20:32:15 +00:00
Ocean Chen
63e6e1dc02 Add persist.device_config.storage_native_boot.smart_idle_maint_enabled property policies
Add policies to set persist.device_config.storage_native_boot.smart_idle_maint_enabled property.

Bug: 202283480
Bug: 181079477
Bug: 215443809
Change-Id: I998e6dca950a8ceebb5fbc39568e3e8d6b86e8ce
2022-03-22 08:33:40 +00:00
Stephane Lee
b30e888b5c Add search in bpf directory for bpfdomains
Bug: 203462310
Test: Ensure that associated BPFs can be loaded
Change-Id: I317a890abb518cf4ac47cd089e882315434342ce
2022-03-21 17:31:17 -07:00
Evan Rosky
5cfdf2bd6e Add a persist.wm.debug property type and associated permissions
This is intended for wm properties related to wmshell/sysui.
Using this context allows sysui to manipulate these properties
in debug builds.

Bug: 219067621
Test: manual
Change-Id: I5808bf92dbba37e9e6da5559f8e0a5fdac016bf3
2022-03-07 19:44:59 +00:00
Jiakai Zhang
bf58100685 dontaudit denial on the odex file of location provider.
Bug: 194054685
Test: Presubmits
Change-Id: Ia636f7b32251c3b8cb018fee9216e5968d4e95ff
2022-02-16 14:12:49 +00:00
Alexander Potapenko
0a64d100b8 dmesgd: sepolicies
dmesgd is a daemon that collects kernel memory error reports.

When system_server notices that a kernel error occured, it sets the
dmesgd.start system property to 1, which results in init starting
dmesgd.

Once that happens, dmesgd runs `dmesg` and parses its output to collect
the last error report. That report, together with the headers containing
device- and build-specific information is stored in Dropbox.

Empirically, dmesgd needs the following permissions:
- execute shell (for popen()) and toolbox (for dmesg),
  read system_log (for dmesg)
- read /proc/version (to generate headers)
- perform Binder calls to servicemanager and system_server,
  find dropbox_service (for dropbox)
- create files in /data/misc/dmesgd (to store persistent state)

Bug: 215095687
Test: run dmesgd on a user device with injected KFENCE bugs
Change-Id: Iff21a2ffd99fc31b89a58ac774299b5e922721ea
2022-02-10 17:42:52 +00:00
Treehugger Robot
605715d665 Merge "Support legacy apexdata labels" 2022-02-10 11:44:11 +00:00
Steven Moreland
6598175e06 bpfdomain: attribute for domain which can use BPF
Require all domains which can be used for BPF to be marked as
bpfdomain, and add a restriction for these domains to not
be able to use net_raw or net_admin. We want to make sure the
network stack has exclusive access to certain BPF attach
points.

Bug: 140330870
Bug: 162057235
Test: build (compile-time neverallows)
Change-Id: I29100e48a757fdcf600931d5eb42988101275325
2022-02-10 00:34:50 +00:00
Christine Franks
c98bde94c4 Merge "Add uhid_device to system_server" 2022-02-08 17:13:32 +00:00
Alan Stokes
53c76a25bb Support legacy apexdata labels
This partly reverts fa10a14fac. There we
removed individual labels for various apexdata labels, replacing them
with apex_system_server_data_file.

Unfortunately that doesn't handle upgrade scenarios well, e.g. when
updating system but keeping the old vendor sepolicy. The directories
keep their old labels, and vold_prepare_subdirs is unable to relabel
them as there is no policy to allow it to.

So we bring back the legacy labels, in private not public, and add the
rules needed to ensure system_server and vold_prepare_subdirs have the
access they need. All the other access needed is obtained via the
apex_data_file_type attribute.

Bug: 217581286
Test: Reset labels using chcon, reboot, directories are relabeled, no denials
Change-Id: If696882450f2634e382f217dab8f9f3882bff03f
2022-02-08 16:07:08 +00:00
Alan Stokes
55803ca572 Allow reading hypervisor capabilities
System server needs to do this to know whether a suitable VM for
CompOS can be created. System server does not need the ability to
actually start a VM, so we don't grant that.

Bug: 218276733
Test: Presubmits
Change-Id: Ibb198ad55819aa924f1bfde68ce5b22c89dca088
2022-02-07 11:33:18 +00:00
Christine Franks
639c48d146 Add uhid_device to system_server
Bug: 217275682
Change-Id: I1ae74868344da290727df2474712b8b6ad2efdd7
Test: n/a
2022-02-04 15:13:43 +00:00
Lalit Maganti
bb197bba02 sepolicy: Allow system domains to be profiled
Bug: 217368496
Doc: go/field-tracing-t
Change-Id: Ie95c0cc2b1f9e8fa03f6112818936af692edf584
2022-02-01 16:27:26 +00:00
Thiébaud Weksteen
79ff061802 Merge "Grant getpgid to system_server on zygote" 2022-01-30 21:59:04 +00:00
Treehugger Robot
d3d214482f Merge "Move pf_key socket creation permission to system_server" 2022-01-28 19:01:36 +00:00
Ken Chen
1aed006a77 Move pf_key socket creation permission to system_server
Allow system_server to trigger the kernel synchronize rcu with open and
close pf_key socket. This action was previously done by netd but now
it need to be done by system_server instead because the handling code in
netd are moved to mainline module which will be loaded by system_server
in JNI mode.

Note: the permission will be removed from netd once all bpf interactions
have moved out of netd.

Bug: 202086915
Test: android.app.usage.cts.NetworkUsageStatsTest
      android.net.cts.TrafficStatsTest
Change-Id: I440e0c87193775115a9b9ffb19270c47b01b082e
2022-01-28 17:12:51 +01:00
Lalit Maganti
34fb0d8933 Merge "sepolicy: add permissions for trace reporting" 2022-01-28 12:15:57 +00:00
Thiébaud Weksteen
6390b3f090 Grant getpgid to system_server on zygote
Should system_server kill zygote on crashes, it will attempt to kill any
process in the same process group. This ensures that no untracked
children are left.

Bug: 216097542
Test: m selinux_policy
Change-Id: Ie16074f76e351d80d9f17be930a731f923f99835
2022-01-28 13:47:20 +11:00
paulhu
70b0a77ee0 Add sepolicy for mdns service
mdns service is a subset of netd-provided services, so it gets
the same treatment as netd_service or dnsresolver_service

Bug: 209894875
Test: built, flashed, booted
Change-Id: I33de769c4fff41e816792a34015a70f89e4b8a8c
2022-01-25 00:50:21 +08:00
Treehugger Robot
c23930818d Merge "Add sepolicy for IInputProcessor HAL" 2022-01-21 22:45:52 +00:00
Hungming Chen
fc6556a5b5 Grants clatd privs since forked by system server
System server forks clatd now. Need to add rules to
fork clatd. netd doesn't fork clatd anymore.

Bug: 212345928
Test: ping 8.8.8.8 under ipv6-only network
check bpf maps are added.
$ adb shell dumpsys netd --short | grep Clat -A10
  ClatdController
    Trackers: iif[iface] nat64Prefix v6Addr -> v4Addr v4iif[v4iface] [fwmark]
    BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
      47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:b7aa:ff3c:9220:595c -> 192.0.0.4 52(v4-wlan0)
    BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
      52(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:b7aa:ff3c:9220:595c 64:ff9b::/96 47(wlan0) ether

Change-Id: I70be6132ab7bfdd96b5f537a96722312cd93bbb8
2022-01-21 18:17:45 +00:00
Treehugger Robot
439f17558c Merge "Allow system_server read and open access to sys/class/net." 2022-01-21 14:47:52 +00:00
Wayne Ma
27abad0dc8 Allow system_server read and open access to sys/class/net.
system_server needs search/read/open access to the directory.
This change gives system_server permissions to fetching the
information from sys/class/net.

Bug: 202086915
Test: build, flash, boot
Change-Id: I7b245510efbc99427f3491c9234c45c8cc18fea1
2022-01-21 03:20:10 +00:00
Siarhei Vishniakou
c655bece6a Add sepolicy for IInputProcessor HAL
This sepolicy is needed so that the vendor can launch a new HAL process,
and then this HAL process could join the servicemanager as an impl for
IInputProcessor. This HAL will be used to contain the previous impl of
InputClassifier and also new features that we are going to add.

Bug: 210158587
Test: use together with a HAL implementation, make sure HAL runs
Change-Id: I476c215ad622ea18b4ce5cba9c07ae3257a65817
2022-01-20 23:40:05 +00:00
John Wu
ce225f8bfb Merge "Add keystore2 LIST permission to system_server" 2022-01-19 00:05:29 +00:00
John Wu
cd5cf383f1 Add keystore2 LIST permission to system_server
This is required for listing all key aliases of other APP domains' keys
in order to migrate keys on behalf of the updated app by PMS.

Test: builds
Bug: 211665859
Change-Id: I541fb81e6186288a1e852ce60882651f838e36dc
2022-01-13 14:26:28 -08:00
Wenhao Wang
6a656c0b67 Add sepolicy for logd and logcat services
The logd binder service is on logd side.
The logcat binder service is on system_server side.
These two binder services facilitate the binder RPC
between logd and system_server.

Bug: 197901557
Test: manual
Change-Id: I5f08bbb44a88dc72302331ab11c7d54f94db16ac
2022-01-13 11:38:43 -08:00
Lalit Maganti
b549e2d837 sepolicy: add permissions for trace reporting
Bug: 205892741
Change-Id: I1b6b2ebeae99ca6a9725f24564386cea78403c6d
2022-01-04 14:02:20 +00:00
Richard Fung
d34435c257 Support reading block apexes from system_server
This relaxes the neverallow so that it is possible to write a new
SELinux allow for system_server to read /dev/block/vd*. It still isn't
possible unless a vendor enables it.

Bug: 196965847
Test: m -j
local_test_runner arc.Boot.vm

Change-Id: Idad79284778cf02066ff0b982480082828f24e19
2021-11-22 21:18:54 +00:00
Treehugger Robot
c1ebd11f2c Merge "Allow system server to access composd." 2021-11-18 13:03:01 +00:00
Ashwini Oruganti
ed7ebb867e Merge "Define and add the migrate_any_key permission to system_server" 2021-11-17 17:55:13 +00:00
Ashwini Oruganti
41843731cc Define and add the migrate_any_key permission to system_server
This change adds a permission migrate_any_key that will help the system
server in migrating keys for an app that wants to leave a sharedUserId.

Bug: 179284822
Test: compiles
Change-Id: I2f35a1335092e69f5b3e346e2e27284e1ec595ec
2021-11-16 10:18:19 -08:00
Alan Stokes
9112c9aa6d Allow system server to access composd.
Also allow composd to kill odrefresh (it execs it); this is necessary
for cancel() to work.

Bug: 199147668
Test: manual
Change-Id: I233cac50240130da2f4e99f452697c1162c10c40
2021-11-16 09:29:58 +00:00
David Brazdil
f7d7c22115 Merge "Allow control of AVF experiments" 2021-11-10 20:42:25 +00:00
Andrew Scull
d7bed7733e Allow control of AVF experiments
Grant system_server and flags_health_check permission to set the
properties that correspond to the AVF experiments.

Bug: 192819132
Test: m
Change-Id: I0e6fa73187abb4412d07ecfd42c1074b8afa5346
2021-11-10 10:42:47 +00:00
Ken
851c11b2cb sepolicy: allow to play f2fs-compression for odex/vdex files
This patch adds some ioctls for odex/vdex files.

Bug: 205257122
Test: Manual. Code runs.
Signed-off-by: Ken Bian <kenjc.bian@rock-chips.com>
Change-Id: Ibf7890f0910ed04e0355bef9c0bfb21b406fb7eb
2021-11-09 03:13:46 +00:00
Ian Hua
91d153e9b5 Update sepolicy for adding nnapi_native namespace.
Test: mm
Bug: 201399117
Change-Id: I40a2431b6f5a54deae27fe68f503aff9b99e2793
2021-10-12 11:50:26 +01:00
Nicolas Geoffray
cd470d1e51 Allow system server to map zygote_tmpfs files.
Needed for an ART optimization.

Test: build
Change-Id: I120cdbe410248ac08f4e56cdeb6588681630a964
2021-10-05 15:03:54 +01:00
Treehugger Robot
a122abab14 Merge "Revert "Add userspace_panic_device and userpanic_use"" 2021-09-20 06:46:29 +00:00
Woody Lin
6ad56599a2 Revert "Add userspace_panic_device and userpanic_use"
This reverts commit 7ed2456b45.

Reason for revert: /dev/userspace-panic is discarded (b/188777408#comment13)
Bug: 188777408
Change-Id: I98b0159890ee755ffaefc5533f9c40d54f8f26d2
2021-09-18 03:03:36 +00:00
Hongguang
8e5d3d469f allow system server to read extcon state and type from sysfs
The target device needs to lable the SoC's extcons to sysfs_extcon in
the device's vendor sepolicy to allow the system_server access.

Bug: 152245127
Bug: 193492798
Bug: 193114615
Test: pressubmit and manual
Change-Id: Ib0a90ac5ce2c9437b19d6dc1e0b2cc50fed41dc3
2021-09-09 14:15:19 -07:00
Woody Lin
7ed2456b45 Add userspace_panic_device and userpanic_use
Define type userspace_panic_device and macro userpanic_use for init,
llkd, and system_server to access /dev/userspace_panic - a kernel file
node for userspace processes to request kernel panic.

Bug: 188777408
Change-Id: I1e9d115d85f664aa84bdd6bb4b95bdb48e3aab9a
2021-09-07 01:18:25 +08:00
Roshan Pius
8a5370c5e4 sepolicy: Add UWB HAL interface in AOSP
Adding sepolicy rules for the AOSP HAL interface.

Ignore-AOSP-First: Dependent changes in internal-only projects.

Bug: 195308730
Test: Compiles
Change-Id: I56302b570a749f7d72b6fe8f4f4a8767ea4785c1
Merged-In: I56302b570a749f7d72b6fe8f4f4a8767ea4785c1
2021-08-24 20:10:21 -07:00
Suren Baghdasaryan
592e06c910 sepolicy updates for adding native flag namespace for lmkd
sepolicy updates for running lmkd experiments.

Bug: 194316048
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I21df3b76cce925639385111bd23adf419f026a65
2021-08-09 17:35:09 -07:00
Alan Stokes
fa10a14fac Refactor apex data file types.
We ended up with 4 labels for specific APEX files that were all
identical; I've replaced them with a single one
(apex_system_server_data_file).

Additionally I created an attribute to be applied to a "standard" APEX
module data file type that establishes the basics (it can be managed
by vold_prepare_subdirs and apexd), to make it easier to add new such
types - which I'm about to do.

Fix: 189415223
Test: Presubmits
Change-Id: I4406f6680aa8aa0e38afddb2f3ba75f8bfbb8c3c
2021-07-12 14:41:04 +01:00
Hasini Gunasinghe
3e20b2895f Merge "Add keystore permission for metrics re-routing." 2021-07-01 12:30:08 +00:00
Hasini Gunasinghe
4334d35f01 Add keystore permission for metrics re-routing.
Keystore2 atoms need to be rounted to statsd via a proxy.
The proxy needs to have this permission in order to pull metrics from
keystore.

Ignore-AOSP-First: No mergepath to AOSP.
Bug: 188590587
Test: Statsd Testdrive script
Change-Id: Ic94f4bb19a08b6300cfd2d3ed09b31d5b7081bfd
Merged-In: Ic94f4bb19a08b6300cfd2d3ed09b31d5b7081bfd
(cherry picked from commit 61d07e7ce0)
2021-06-30 17:02:14 -07:00
rnlee
b6142ecc22 Add sepolicy SF native boot namespace.
Following go/android-native-flag-api-manual.

Bug: 190769260
Test: make.
Change-Id: I84fe7e9d046fbbe737f09043589b19e71981f521
2021-06-30 14:07:44 -07:00
Thiébaud Weksteen
9ec532752d Add fusefs_type for FUSE filesystems
Any FUSE filesystem will receive the 'fuse' type when mounted. It is
possible to change this behaviour by specifying the "context=" or
"fscontext=" option in mount().

Because 'fuse' has historically been used only for the emulated storage,
it also received the 'sdcard_type' attribute. Replace the 'sdcard_type'
attribute from 'fuse' with the new 'fusefs_type'. This attribute can be
attached on derived types (such as app_fusefs).

This change:
- Remove the neverallow restriction on this new type. This means any
  custom FUSE implementation can be mounted/unmounted (if the correct
  allow rule is added). See domain.te.
- Change the attribute of 'fuse' from 'sdcard_type' to 'fusefs_type'.
  See file.te.
- Modify all references to 'sdcard_type' to explicitly include 'fuse'
  for compatibility reason.

Bug: 177481425
Bug: 190804537
Test: Build and boot aosp_cf_x86_64_phone-userdebug
Change-Id: Id4e410a049f72647accd4c3cf43eaa55e94c318f
2021-06-28 13:18:46 +02:00
Treehugger Robot
03b80a12e4 Merge "Allow system_server to read /proc/vmstat" 2021-06-10 11:10:30 +00:00
Yi Kong
953aa5643f Allow system server to read profcollectd data files
This allows the system server to read the reports for uploading.

also cleaned up the out of order qemu_hw_prop entry.

Test: manual
Bug: 178561556
Bug: 183487233
Change-Id: I9e5aef9cbcf50fd085dd72900e3ab00a1b6c20a7
2021-06-09 13:01:50 +00:00
Ioannis Ilkos
351326b578 Allow system_server to read /proc/vmstat
/proc/vmstat oom_kill counts the number of times __oom_kill_process
was actioned
(https://lore.kernel.org/lkml/149570810989.203600.9492483715840752937.stgit@buzz/)

We want to record this in the context of system_server for tracking
purposes.

Bug: 154233512
Change-Id: I27bcbcd5d839e59a1dca0e87e2f4ae107201654c
Test: build, verify vmstat can be read
2021-06-08 14:24:26 +00:00
Calin Juravle
0b2ca6c22c Enable ART properties modularization
ART is becoming a module and we need to be able to add new properties
without modifying the non updatable part of the platform:

- convert ART properties to use prefix in the namespace of
[ro].dalvik.vm.
- enable appdomain and coredomain to read device_config properties
that configure ART

Test: boot
Bug: 181748174
Change-Id: Id23ff78474dba947301e1b6243a112b0f5b4a832
2021-06-01 16:14:55 -07:00
Jaegeuk Kim
1a15808dc0 sepolicy: allow to play f2fs-compression for apk files
This patch adds some ioctls for apk files and allows
shell to query for f2fs features.

Bug: 189169940
Test: Manual. Code runs.
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ia8bccf1bf663404b902703326a1853947b64e5ab
2021-05-27 20:31:17 -07:00
Alexander Dorokhine
0b2553a32b Allow the appsearch apex access to the apexdata misc_ce dir.
Bug: 177685938
Test: AppSearchSessionCtsTest
Change-Id: I727860a02cb9e612ce6c322662d418cddc2ff358
2021-05-26 09:47:19 -07:00
Shawn Willden
4361ef2724 Merge "TEMP" 2021-05-11 22:53:43 +00:00
Max Bires
2189a1a447 TEMP
Have system server add keystore2 stacktraces for ANR reporting

Test: ANR something
Bug: 184006658
Change-Id: I75892479cb59a8ae79cb9555b731dce479175aff
2021-05-11 22:52:05 +00:00
Hridya Valsaraju
f35c70b0dd Merge changes If26ba23d,Ibea38822
* changes:
  Revert "Revert "Exclude vendor_modprobe from debugfs neverallow restrictions""
  Revert "Revert "Add neverallows for debugfs access""
2021-05-05 17:31:35 +00:00
Songchun Fan
633f7ca868 [sepolicy] allow system server to read incfs metrics from sysfs
Address denial messages like:

05-05 05:02:21.480  1597  1597 W Binder:1597_12: type=1400 audit(0.0:140): avc: denied { read } for name="reads_delayed_min" dev="sysfs" ino=107358 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0

BUG: 184844615
Test: atest android.cts.statsdatom.incremental.AppErrorAtomTests#testAppCrashOnIncremental
Change-Id: I201e27e48a08f99f41a030e06c6f22518294e056
2021-05-04 22:56:41 -07:00
Hridya Valsaraju
23f9f51fcd Revert "Revert "Add neverallows for debugfs access""
This reverts commit e95e0ec0a5.

Now that b/186727553 is fixed, it should be safe to revert this revert.

Test: build
Bug: 184381659
Change-Id: Ibea3882296db880f5cafe4f9efa36d79a183c8a1
2021-05-04 22:06:46 -07:00
Songchun Fan
979a1f8f34 [sepolicy] allow system_server to ioctl INCFS_IOC_GET_LAST_READ_ERROR
Solves the denial message like:

04-30 03:54:46.972 21944 21944 I Binder:21944_17: type=1400 audit(0.0:502): avc: denied { ioctl } for path=2F646174612F696E6372656D656E74616C2F4D545F646174615F6170705F766D646C3133352F6D6F756E742F2E70656E64696E675F7265616473202864656C6574656429 dev="incremental-fs" ino=2 ioctlcmd=0x6727 scontext=u:r:system_server:s0 tcontext=u:object_r:incremental_control_file:s0 tclass=file permissive=1

BUG: 184844615
Test: manual
Change-Id: I3ef32613de348bca1d58cddf4ec1296d4828b51a
2021-04-30 16:46:06 +00:00
Nicolas Geoffray
6a311471a6 Allow boot animation to update boot status.
This CL was missed from the topic:
https://android-review.googlesource.com/q/topic:bootanim-percent

Test: update ART module, see animation go to 100%
Bug: 184881321
Change-Id: I59706718af11751a7e1f4b5ab1ff2793f554fb19
2021-04-28 15:17:09 +01:00
Treehugger Robot
98914119ae Merge "[incfs] Allow everyone read the IncFS sysfs features" 2021-04-26 22:19:37 +00:00
Hridya Valsaraju
e95e0ec0a5 Revert "Add neverallows for debugfs access"
Revert submission 1668411

Reason for revert: Suspect for b/186173384
Reverted Changes:
Iaa4fce9f0:Check that tracefs files are labelled as tracefs_t...
I743a81489:Exclude vendor_modprobe from debugfs neverallow re...
I63a22402c:Add neverallows for debugfs access
I289f2d256:Add a neverallow for debugfs mounting

Change-Id: I9b7d43ac7e2ead2d175b265e97c749570c95e075
2021-04-23 16:38:20 +00:00
Yurii Zubrytskyi
b382f02bf4 [incfs] Allow everyone read the IncFS sysfs features
Every process needs to be able to determine the IncFS features
to choose the most efficient APIs to call

Bug: 184357957
Test: build + atest PackageManagerShellCommandTest
Change-Id: Ia84e3fecfd7be1209af076452cc27cc68aefd80d
2021-04-21 15:15:40 -07:00
Hridya Valsaraju
a0b504a484 Add neverallows for debugfs access
Android R launching devices and newer must not ship with debugfs
mounted. For Android S launching devices and newer, debugfs must only be
mounted in userdebug/eng builds by init(for boot time initializations)
and dumpstate(for grabbing debug information from debugfs using the
dumpstate HAL).

This patch adds neverallow statements to prevent othe processes
being provided access to debugfs when the flag PRODUCT_SET_DEBUGFS_RESTRICTIONS
is set to true.

Test: make with/without PRODUCT_SET_DEBUGFS_RESTRICTIONS
Bug: 184381659
Change-Id: I63a22402cf6b1f57af7ace50000acff3f06a49be
2021-04-21 14:13:22 -07:00
Orion Hodson
cb0627099e Merge "Add odrefresh_data_file for odrefresh metrics" 2021-04-15 08:51:01 +00:00
Janis Danisevskis
79d167704e Add keystore2 namespace for LocksettingsService.
Bug: 184664830
Test: N/A
Change-Id: Ie04186eddaae689b968690b2bb0d3692c81ac645
2021-04-14 16:03:13 -07:00
Orion Hodson
7c6b3eb963 Add odrefresh_data_file for odrefresh metrics
Metrics are written to /data/misc/odrefresh by odrefresh during early
boot, then native code in ART system_server initialization passes them
to statsd and deletes the metrics files. This hand-off is necessary
because statsd does not start until after odsign and odrefresh have run.

Bug: 169925964
Test: manual
Change-Id: I8054519a714907819886dd6e5e78f3b5796d0898
2021-04-09 15:50:28 +01:00
Janis Danisevskis
b488a8fe1a Keystore 2.0: Remove keystore2.enable property.
Bug: 171563717
Test: N/A
Change-Id: I85819a71dc24777a9d54f0c83b8b29da9f48cec1
2021-03-19 10:07:49 -07:00
Treehugger Robot
baf84ee461 Merge "Add SELinux policy for using userfaultfd" 2021-03-17 15:04:51 +00:00
Lokesh Gidra
06edcd8250 Add SELinux policy for using userfaultfd
ART runtime will be using userfaultfd for a new heap compaction
algorithm. After enabling userfaultfd in android kernels (with SELinux
support), the feature needs policy that allows { create ioctl read }
operations on userfaultfd file descriptors.

Bug: 160737021
Test: Manually tested by exercising userfaultfd ops in ART
Change-Id: I9ccb7fa9c25f91915639302715f6197d42ef988e
2021-03-17 04:57:22 -07:00
Howard Chen
28003eeda4 Merge "Support copy-on-write persistent data block when running a DSU" 2021-03-17 02:07:03 +00:00
Treehugger Robot
20a1a984ad Merge "Keystore 2.0: Rename KeystoreUserManager to KeystoreMaintenance" 2021-03-11 11:20:11 +00:00
Treehugger Robot
b9b067ce5e Merge "Fix broken neverallow rules" 2021-03-11 07:33:30 +00:00
Lorenzo Colitti
a46921b4db Merge changes from topic "clatd-vendor"
* changes:
  Properly set the property_context for net.tcp_init_rwnd.
  Add selinux policy for the new net.464xlat.cellular.enabled prop.
2021-03-10 16:53:41 +00:00
Lorenzo Colitti
26d3d4a5a2 Properly set the property_context for net.tcp_init_rwnd.
This property is many years old and it does not have a property
context associated with it. It is set by the system server (in
particular, ConnectivityService code, in the Tethering module)
and read by init, which does:

on property:net.tcp_def_init_rwnd=*
    write /proc/sys/net/ipv4/tcp_default_init_rwnd ${net.tcp_def_init_rwnd}

There is no need to add read access to init because init can read
and write any property.

Test: m
Fix: 170917042
Change-Id: I594b09656a094cd2ef3e4fd9703e46bf7b2edd4c
2021-03-10 20:28:26 +09:00
Lorenzo Colitti
082ebd2107 Add selinux policy for the new net.464xlat.cellular.enabled prop.
This property is written by an .rc file - see aosp/1553819 - and
read by the connectivity mainline code in the system server.

Test: m
Bug: 182333299
Change-Id: Ibac622f6a31c075b64387aadb201ad6cdd618ebd
2021-03-10 15:58:48 +09:00
Howard Chen
55665d63da Support copy-on-write persistent data block when running a DSU
The persistent data block is protected by a copy-on-write scratchpad when
running a Dynamic System Update (DSU). The copy-on-write scratchpad
uses a backing file for write operations. This CL adds permissions
to write the backing file for the PersistentDataBlockService.

Bug: 175852148
Test: gsi_tool install & vts_kernel_net_tests

Change-Id: Id0efe407e707fc382679c0eee249af52f877f5d2
2021-03-10 13:02:02 +08:00
Inseob Kim
85acf6ef70 Fix broken neverallow rules
neverallow rules with allowlist should look like:

    neverallow { domain -allow1 -allow2 } ...

Bug: 181744894
Test: m selinux_policy
Test: pcregrep -M -r "neverallow\s+{(\s*#.*\s*)*\s+-" .
Change-Id: Ibab72ccc1fbacb99b62fe127b4122e1ac22b938a
2021-03-10 10:44:22 +09:00
Janis Danisevskis
f3fe4cfc06 Keystore 2.0: Rename KeystoreUserManager to KeystoreMaintenance
Test: N/A
Change-Id: I40c07e40cb0a852814058fe89d57c44ea85f1994
2021-03-09 14:35:16 -08:00
Collin Fijalkovich
4f7a435b71 Merge "Remove sepolicy surrounding notify_traceur" 2021-03-09 19:13:26 +00:00
Jeffrey Vander Stoep
f6f2a79a2a Merge "Give resume_on_reboot key as separate context" 2021-03-08 08:33:16 +00:00
Alexander Potapenko
3d52817da4 Selinux policy for bootreceiver tracing instance
Create contexts for /sys/kernel/tracing/instances/bootreceiver
Allow read access to files in this dir for system_server.

Bug: 172316664
Bug: 181778620
Test: manual runs with KFENCE enabled
Signed-off-by: Alexander Potapenko <glider@google.com>
Change-Id: I7021a9f32b1392b9afb77294a1fd0a1be232b1f2
2021-03-05 08:53:39 +01:00
Tianjie
21ab75279a Give resume_on_reboot key as separate context
As part of the keystore2 requirement, we give the keys used for
resume on reboot a separate context in keystore. And grant system
server the permission to generate, use and delete it.

Bug: 172780686
Test: resume on reboot works after using keystore2
Change-Id: I6b47625a0864a4aa87b815c6d2009cc19ad151a0
2021-03-04 12:20:19 -08:00
Wonsik Kim
08a25e6709 Revert "Selinux policy for bootreceiver tracing instance"
Revert submission 1572240-kernel_bootreceiver

Reason for revert: DroidMonitor: Potential culprit for Bug 181778620 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Reverted Changes:
Ic1c49a695:init.rc: set up a tracing instance for BootReceive...
I828666ec3:Selinux policy for bootreceiver tracing instance

Change-Id: I9a8da7ae501a4b7c3d6cb5bf365458cfd1bef906
2021-03-03 22:47:02 +00:00
Alexander Potapenko
31251aa6ec Selinux policy for bootreceiver tracing instance
Create contexts for /sys/kernel/tracing/instances/bootreceiver
Allow read access to files in this dir for system_server.

Bug: 172316664
Test: manual runs with KFENCE enabled
Signed-off-by: Alexander Potapenko <glider@google.com>
Change-Id: I828666ec3154aadf138cfa552832a66ad8f4a201
2021-03-02 16:53:12 +01:00
Collin Fijalkovich
d6cd6279bf Remove sepolicy surrounding notify_traceur
We no longer use this sysprop-based interface for communication between
Traceur and Perfetto, this change removes the associated policy.

Test: atest TraceurUiTests
Bug: 179923899
Change-Id: Ic59d866d3c75a3f804f6c19a703d6d10560c627a
2021-02-25 13:24:31 -08:00
Janis Danisevskis
1aad552cfd Merge "Keystore 2.0: Add permissions and policy for user manager AIDL." 2021-02-18 23:00:29 +00:00
Weilun Du
e76978cef7 Merge "Revert^2 "Add qemu.hw.mainkeys to system property_contexts"" 2021-02-18 21:40:53 +00:00
Gavin Corkery
3bb3559e2e Merge "Add sepolicy for scheduling module data directories" 2021-02-18 20:51:51 +00:00
Treehugger Robot
ad580990c4 Merge "Add sepolicy swcodec native flag namespace." 2021-02-17 21:30:16 +00:00
Weilun Du
e2a8a145ec Revert^2 "Add qemu.hw.mainkeys to system property_contexts"
509b35e5d9

Bug: 180412668
Merged-In: I4067bba36613fa41e3c7a085da76cda4784753ad
Change-Id: I4067bba36613fa41e3c7a085da76cda4784753ad
2021-02-17 18:29:59 +00:00
Hasini Gunasinghe
685ca0c888 Keystore 2.0: Add permissions and policy for user manager AIDL.
Bug: 176123105
Test: User can set a password and unlock the phone.
Change-Id: I96c033328eb360413e82e82c0c69210dea2ddac9
2021-02-17 08:55:31 -08:00
Treehugger Robot
bdfc2c96ce Merge "Add /data/misc/a11ytrace folder to store accessibility trace files." 2021-02-17 13:02:34 +00:00
Elliott Hughes
adaf4fe7a9 Merge "init/ueventd and system_server no longer need access to /dev/hw_random." 2021-02-16 20:08:39 +00:00
Ram Muthiah
523a649401 Merge "Revert "Add qemu.hw.mainkeys to system property_contexts"" 2021-02-16 19:05:10 +00:00
Ram Muthiah
509b35e5d9 Revert "Add qemu.hw.mainkeys to system property_contexts"
Revert submission 1582845-qemu-prop

Reason for revert: aosp_hawk-userdebug is broken on an RVC branch
Reverted Changes:
Idfc2bffa5:Add qemu.hw.mainkeys to system property_contexts
If013ff33f:Remove qemu.hw.mainkeys from vendor_qemu_prop
Bug: 180412668
Change-Id: I335afb931eaeb019f66e3feedea80b0c8888f7a3
2021-02-16 18:58:10 +00:00
Hongming Jin
58f83415ea Add /data/misc/a11ytrace folder to store accessibility trace files.
Bug: 157601519
Test: adb shell cmd accessibility start-trace
      adb shell cmd accessibility stop-trace
Change-Id: Id4224cee800fe3e10f33794c96048366a0bf09bb
2021-02-16 09:35:09 -08:00
Nick Chalko
81a4dd40d6 Add sepolicy swcodec native flag namespace.
Test: add sepolicy, build, check GetServerConfigurableFlag function
Bug: 179286276
Change-Id: Ia16d110900251b3fb3e3959d73524c8814199270
2021-02-16 09:22:16 -08:00
Weilun Du
23bb01756e Merge "Add qemu.hw.mainkeys to system property_contexts" 2021-02-16 16:44:00 +00:00
Gavin Corkery
cd3bb575ab Add sepolicy for scheduling module data directories
Test: Manually test writing and reading files
Bug: 161353402
Change-Id: Ifbc0e4db0ec51f6565a0f52df06b1d148577b788
2021-02-15 22:31:27 +00:00
Treehugger Robot
cbf08f8cc7 Merge changes from topic "uid_pid with recovery mode"
* changes:
  sepolicy: grant system_server process group creation rights
  sepolicy: rules for uid/pid cgroups v2 hierarchy
2021-02-13 21:32:31 +00:00
Marco Ballesio
98a5e60592 sepolicy: grant system_server process group creation rights
system_server must be allowed to create process groups in behalf of
processes spawned by the app zygote

Bug: 62435375
Bug: 168907513
Test: verified that webview processes are migrated in their own process
group

Change-Id: Icd9cd53b759a79fe4dc46f7ffabc0cf248e6e4b8
2021-02-12 15:16:18 -08:00
Elliott Hughes
5aaf7f3461 init/ueventd and system_server no longer need access to /dev/hw_random.
We let the kernel worry about that now.

Bug: http://b/179086242
Test: treehugger
Change-Id: I51bdfaf7488717cc4e4c642261e31d1801cfba68
2021-02-12 09:33:22 -08:00
Treehugger Robot
83d6f96fdc Merge "Allow dumpsys meminfo to print out DMA-BUF statistics" 2021-02-11 23:48:04 +00:00
Marco Ballesio
aa4ce95c6f sepolicy: rules for uid/pid cgroups v2 hierarchy
Bug: 168907513
Test: verified the correct working of the v2 uid/pid hierarchy in normal
and recovery modes

This reverts commit aa8bb3a29b.

Change-Id: Ib344d500ea49b86e862e223ab58a16601eebef47
2021-02-11 23:40:38 +00:00
Hridya Valsaraju
0001dee765 Allow dumpsys meminfo to print out DMA-BUF statistics
These permissions fix the following denials:

avc: denied { read } for name="buffers" dev="sysfs" ino=3267
scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_dmabuf_stats:s0
tclass=dir permissive=1
avc: denied { open } for path="/sys/kernel/dmabuf/buffers" dev="sysfs"
ino=3267 scontext=u:r:system_server:s0
tcontext=u:object_r:sysfs_dmabuf_stats:s0 tclass=dir permissive=1
avc: denied { read } for name="size" dev="sysfs"
ino=30556 scontext=u:r:system_server:s0
tcontext=u:object_r:sysfs_dmabuf_stats:s0 tclass=file permissive=1
avc: denied { open } for path="/sys/kernel/dmabuf/buffers/41673/size" dev="sysfs"
ino=30556 scontext=u:r:system_server:s0
tcontext=u:object_r:sysfs_dmabuf_stats:s0 tclass=file permissive=1
avc: denied { getattr } for path="/sys/kernel/dmabuf/buffers/41673/size" dev="sysfs"
ino=30556 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_dmabuf_stats:s0
tclass=file permissive=1
avc: denied { read } for name="dma_heap" dev="tmpfs" ino=344
scontext=u:r:system_server:s0 tcontext=u:object_r:dmabuf_heap_device:s0
tclass=dir permissive=1
avc: denied { open } for path="/dev/dma_heap" dev="tmpfs" ino=344
scontext=u:r:system_server:s0 tcontext=u:object_r:dmabuf_heap_device:s0
tclass=dir permissive=1

Test: adb shell dumpsys meminfo
Bug: 167709539
Change-Id: Ifa43fd16369d5da1db16e45ff0e189da0c975b75
2021-02-11 10:04:26 -08:00
Weilun Du
180a277d67 Add qemu.hw.mainkeys to system property_contexts
Bug: 178143857

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: Idfc2bffa52016d1e880974bb193025400e90a538
2021-02-11 04:18:54 +00:00
Treehugger Robot
654f8b82a8 Merge "Fix ANR permission denial for AIDL HALs." 2021-02-10 21:16:35 +00:00
Steven Moreland
afb345c94b Fix ANR permission denial for AIDL HALs.
Recently, WatchDog gained the ability to query AIDL HAL PIDs in order to
amend ANR reports. However, since this was tested on cuttlefish (and
b/65201432 means that system_server is permissive), the denial was not
enforced, and broke ANRs in the dogfood population.

Fixes: 179753319
Test: simulate hanging w/ 'adb shell am hang', and the following denial
   no longer occurs:
02-10 00:50:05.719   200   200 E SELinux : avc:  denied  { list } for
pid=575 uid=1000 name=service_manager scontext=u:r:system_server:s0
tcontext=u:r:servicemanager:s0 tclass=service_manager permissive=1

Change-Id: I210527ad7492b155d7cf08c7d67894ef602d37a6
2021-02-10 17:06:00 +00:00
Pavel Grafov
20bc79bb3f Keystore 2.0: Allow system_server to manage wifi keys
This is needed because Wifi module needs to import and
generate keys and it runs in system_server.

Also, remove "grant" from system_app and system_server
since there is no need to grant any keys.

Test: Create an enterprise wifi config with EAP-TLS
Bug: 171305388
Change-Id: I50c25f2fe52e968c8cdf1ea20d110f9f052699db
2021-02-09 20:36:51 +00:00
Treehugger Robot
efef83f745 Merge "Allow dumpsys to read total DMA-BUF heap pool size" 2021-02-09 14:16:42 +00:00
Xiao Ma
bbd48ff311 Merge "Allow connectivity namespace to enable native level access flags." 2021-02-08 01:40:51 +00:00
Josh Gao
ae73b479fc Merge "Let system_server truncate tombstones." 2021-02-05 20:35:19 +00:00
Treehugger Robot
96acdc0b22 Merge "Revert^3 "sepolicy: rules for uid/pid cgroups v2 hierarchy"" 2021-02-05 01:59:16 +00:00
Marco Ballesio
aa8bb3a29b Revert^3 "sepolicy: rules for uid/pid cgroups v2 hierarchy"
a54bed6907

Bug: 151660495
Test: verified proper boot in regular mode and proper working of adb in
recovery

Change-Id: Id70d27a6162af6ede94661005d80a2a780057089
2021-02-04 22:33:14 +00:00
Josh Gao
7ae03a5eb6 Let system_server truncate tombstones.
Test: manual
Change-Id: If352a98309dc2aa19157c6fc5d65577741ccbaad
2021-02-04 13:12:20 -08:00
Hridya Valsaraju
2c3ef29ed5 Allow dumpsys to read total DMA-BUF heap pool size
These permissions are added to allow dumpsys to read
/sys/kernel/dma_heap/total_pools_kb.

Fixes the following sepolicy denials:
avc: denied { read } for name="total_pools_kb" dev="sysfs" ino=3252
scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
avc: denied { open } for path="/sys/kernel/dma_heap/total_pools_kb"
dev="sysfs" ino=3252 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0
tclass=file permissive=1
avc: denied { getattr } for path="/sys/kernel/dma_heap/total_pools_kb"
dev="sysfs" ino=3252 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0
tclass=file permissive=1

Bug: 167709539
Test: dumpsys meminfo
Change-Id: I1c15b41b067da84a7b629cafe27972f30c86ae27
2021-02-03 21:42:09 -08:00
Xiao Ma
2d6c9f0fe8 Allow connectivity namespace to enable native level access flags.
Follow the steps: go/android-native-flag-api-manual

Bug: 179099277
Test: m -j
Test: manually verify connection to wifi after flash
Change-Id: Ieb5355d40aec9ed7a42b7ae5b250b696fcf00810
2021-02-04 05:31:33 +00:00
Andrei-Valentin Onea
ef796f6180 Merge "Add data directory for appcompat" 2021-01-27 18:17:20 +00:00
Andrei Onea
850842f77c Add data directory for appcompat
This directory is used to store override config, so that they can
persist across reboot.

Test: atest CompatConfigTest
Bug: 145509340
Change-Id: I5e8f2b3093daeccd6c95dff24a8c6c0ff31235ca
2021-01-27 15:04:31 +00:00
Marco Ballesio
a54bed6907 Revert^2 "sepolicy: rules for uid/pid cgroups v2 hierarchy"
51c04ac27b

Change-Id: Idc35a84b5faabfb9bdd7a7693f51b11938eb0489
2021-01-27 06:07:48 +00:00
Seigo Nonaka
1237d422ef Merge "Add /data/fonts/files directory" 2021-01-25 05:47:03 +00:00
Linzhao Ye
bab989d315 Merge "Add SePolicy for system_server accessing sysfs uhid." 2021-01-23 17:08:47 +00:00
Seigo Nonaka
9c3707f76a Add /data/fonts/files directory
The updated font files will be stored to /data/fonts/files and
all application will read it for drawing text.
Thus, /data/fonts/files needs to be readable by apps and only writable
by system_server (and init).

Bug: 173517579
Test: atest CtsGraphicsTestCases
Test: Manually done
Change-Id: Ia76b109704f6214eb3f1798e8d21260343eda231
2021-01-22 11:58:55 -08:00
Chris Ye
c0e7206c73 Add SePolicy for system_server accessing sysfs uhid.
Add SePolicy to allow Android input manager accessing sysfs uhid folder.

Bug: 161633432
Test: dumpsys input and watch for input device battery status.
Change-Id: I6ed1ab45f1cff409982c36627e12e62667819f37
2021-01-22 17:56:45 +00:00
Tianjie Xu
d06dfa3320 Merge "Make system server a client of boot control HAL" 2021-01-21 23:18:55 +00:00
Yurii Zubrytskyi
314e6d9450 Merge "IncFS: update SE policies for the new API" 2021-01-21 18:00:33 +00:00
Kevin Jeon
132f7696d0 Allow system_server read access to SurfaceFlinger
This change gives system_server read permissions to SurfaceFlinger in
order to pin it with PinnerService.

Bug: 176197656
Test: adb shell dumpsys pinner
      /system/bin/surfaceflinger was successfully pinned.
Change-Id: Ic845eebe298ec2d602b86003c07889f37fc44159
2021-01-20 16:52:58 +00:00
Yurii Zubrytskyi
80dfa06984 IncFS: update SE policies for the new API
IncFS in S adds a bunch of new ioctls, and requires the users
to read its features in sysfs directory. This change adds
all the features, maps them into the processes that need to
call into them, and allows any incfs user to query the features

Bug: 170231230
Test: incremental unit tests
Change-Id: Ieea6dca38ae9829230bc17d0c73f50c93c407d35
2021-01-19 12:57:15 -08:00
Orion Hodson
74b129b77c Merge "Permissions for odrefresh and /data/misc/apexdata/com.android.art" 2021-01-19 09:37:36 +00:00
Tianjie
c447b9b09c Make system server a client of boot control HAL
To support multi-client resume on reboot, the recovery system
service want to query the active boot slot on the next boot; and
abort the reboot if the active slot is different from clients'
expectation.

Denial:
SELinux : avc:  denied  { find } for interface=android.hardware.boot::IBootControl
sid=u:r:system_server:s0 pid=1700 scontext=u:r:system_server:s0
tcontext=u:object_r:hal_bootctl_hwservice:s0 tclass=hwservice_manager permissive=1

Bug: 173808057
Test: adb shell cmd recovery reboot-and-apply ota reason
Change-Id: I6a303d8dcbae89a2287d96ae3116109e2a43bbd6
2021-01-16 19:18:05 -08:00