Commit Graph

21422 Commits

Author SHA1 Message Date
Inseob Kim
07c6671bc4 Merge "Add attributes for exported properties" 2019-09-20 03:01:21 +00:00
Inseob Kim
19b99f18c8 Add attributes for exported properties
This introduces some attributes that can be used to restrict access to
exported properties so that one can easily check from which the
properties can be accessed, and that OEMs can extend their own exported
properties.

Bug: 71814576
Bug: 131162102
Test: boot aosp_cf_x86_phone-userdebug
Test: logcat | grep "avc: "
Change-Id: I6f988ec1cb94fa64563ca6cb91b7702da5d604e3
2019-09-19 05:07:50 +00:00
Treehugger Robot
f38b478272 Merge "Add file_contexts for "com.android.vndk" APEX" 2019-09-18 17:35:07 +00:00
Treehugger Robot
ff75b228ae Merge "idmap: add binderservice permissions" 2019-09-18 14:18:08 +00:00
Jeff Vander Stoep
0f00cd283e idmap: add binderservice permissions
Allow dumpsys to dump process information for bug reports.

Test: build
Test: adb bugreport
Bug: 140541614
Change-Id: Ia361e8c8de2cc5f798e746dffcf067393fd6bcae
2019-09-18 13:47:09 +02:00
Jooyung Han
42d33e0226 Add file_contexts for "com.android.vndk" APEX
This new apex is a VNDK APEX which is going to replace /system/lib/vndk
libraries.

Bug: 134357236
Bug: 139772411
Test: m com.android.vndk

Change-Id: I9bdda5bc7862917a196b894cc562e0351db76c52
2019-09-18 10:35:39 +09:00
Treehugger Robot
4db20c6922 Merge "neverallow init *:process noatsecure" 2019-09-17 06:08:18 +00:00
Paul Crowley
aaf2a5e09a Merge "Allow toolbox to rm -rf /data/per_boot" 2019-09-17 05:40:05 +00:00
Paul Crowley
2367ba358f Allow toolbox to rm -rf /data/per_boot
Bug: 140882488
Test: create files and dirs in /data/per_boot, check they're removed.
Change-Id: Idf0ba09cbe51cbff6a7b2a464c4651a1f7fcf343
2019-09-16 10:18:57 -07:00
Nick Kralevich
a1458c64d3 neverallow init *:process noatsecure
The use of sensitive environment variables, such as LD_PRELOAD, is disallowed
when init is executing other binaries. The use of LD_PRELOAD for init spawned
services is generally considered a no-no, as it injects libraries which the
binary was not expecting. This is especially problematic for APEXes. The use
of LD_PRELOAD via APEXes is a layering violation, and inappropriately loads
code into a process which wasn't expecting that code, with potentially
unexpected side effects.

Test: compiles
Bug: 140789528
Change-Id: Ia781ec7318e700cddfd52df97c504b771f413504
2019-09-16 09:50:32 -07:00
Pete Bentley
aada820069 Revert "SEPolicy: dontaudit attempts to create marker files."
This reverts commit a9b718a1ed.

Reason for revert: No longer be necessary after
http://r.android.com/1120246 lands as this causes BoringSSL to only write
flag files if a particular environment variable is set, and this variable
will only be set for the self test binaries which have permission to
write to /dev/boringssl.

Bug: 140918050
Test: Manually observed audit log after change
Change-Id: I851f4aea991d91c67b64535829eea5b9594a3e2c
2019-09-13 12:25:13 +01:00
Steven Thomas
726150eda4 Merge "Allow access to the "refresh_rate_switching" system property" 2019-09-13 00:55:33 +00:00
Tom Cherry
2176375a8a Merge "ueventd: allow using external firmware handlers" 2019-09-12 22:52:37 +00:00
Steven Thomas
f98c3902c2 Allow access to the "refresh_rate_switching" system property
Bug: 136592946
Bug: 138261472

Test: Ran with the patch applied, confirmed surface flinger can access
the system property.

Change-Id: I259a488399c5e698de384322852ea81ea1a96e7d
Merged-In: I259a488399c5e698de384322852ea81ea1a96e7d
2019-09-11 18:30:50 -07:00
Tobias Thierer
a9b718a1ed SEPolicy: dontaudit attempts to create marker files.
Binaries other than boringssl_self_test_exec are not allowed
to create marker files /dev/boringssl/selftest/[hash].

Right now, some processes still attempt to because:
 - Some binaries run so early during early-init that
   boringssl_self_test{32,64} hasn't had a chance to
   run yet, so the marker file doesn't exist yet, so
   the unprivileged process attempts to create it.
 - Some binaries statically link libcrypto so their
   [hash] is different from that used by
   boringssl_self_test{32,64}.

There's some ongoing work to stop those binaries even
attempting to create the marker files but it's not a
big deal if they do. Similarly, there is ongoing work
to minimize or eliminate static linking of this library.

For now, this CL turns off audit logs for this behavior
since it is harmless (a cosmetic issue) and in order to
not hold up the bulk of the logic being submitted.

Bug: 137267623
Test: Treehugger

Change-Id: I3de664c5959efd130f761764fe63515795ea9b98
2019-09-11 19:37:40 +01:00
David Anderson
ff8cd0bee9 Merge "Give dumpstate access to run lpdump." 2019-09-10 21:36:39 +00:00
Treehugger Robot
535d297a5f Merge "Root of /data belongs to init (re-landing)" 2019-09-10 04:14:17 +00:00
David Anderson
dc2a7873bd Give dumpstate access to run lpdump.
Bug: 140204341
Test: adb bugreport
Change-Id: I33e544dfced7589e995223cc88084f2849efe18b
2019-09-09 17:33:20 -07:00
Treehugger Robot
4cacfc3bdf Merge "domain.te: remove /proc/sys/vm/overcommit_memory read access" 2019-09-10 00:29:37 +00:00
Treehugger Robot
aa31e64e83 Merge "Access to HALs from untrusted apps is blacklist-based" 2019-09-10 00:22:07 +00:00
Tobias Thierer
804ac36e5f Merge "Tweak boringssl_self_test.te" 2019-09-09 22:27:01 +00:00
Paul Crowley
aed0f76ee9 Root of /data belongs to init (re-landing)
Give /data itself a different label to its contents, to ensure that
only init creates files and directories there.

This change originally landed as aosp/1106014 and was reverted in
aosp/1116238 to fix b/140402208. aosp/1116298 fixes the underlying
problem, and with that we can re-land this change.

Bug: 139190159
Bug: 140402208
Test: aosp boots, logs look good
Change-Id: I1a366c577a0fff307ca366a6844231bcf8afe3bf
2019-09-09 14:42:01 -07:00
Nick Kralevich
003e858205 domain.te: remove /proc/sys/vm/overcommit_memory read access
Remove everyone's ability to read /proc/sys/vm/overcommit_memory.
Android's jemalloc implementation no longer uses this file.

init.te had multiple rules which allowed writing to this file. Get rid of
the duplicate rule.

Bug: 140736217
Test: compiles and boots
Test: bypass setup wizard and start the browser, browse the web
Change-Id: I5a2d5f450f5dde5dd55a0cedd7fbd55a6ac0beed
2019-09-09 13:39:28 -07:00
Mathieu Chartier
6e85cd91d0 Merge "Remove ability to set profilebootimage and profilesystemserver" 2019-09-09 20:08:33 +00:00
Mathieu Chartier
3079462443 Remove ability to set profilebootimage and profilesystemserver
These properties should no longer be specified in the vendor rom.

Bug: 139883463
Test: manual

(cherry picked from commit 1f6eda4111)

Exempt-From-Owner-Approval: Cherry-pick from master
Merged-In: I510c917fa3c60dcbd3f104ebe619f34c69c821e6
Change-Id: I8b7cf03d7a2faceb03b83edcb47e831fbc8c8918
2019-09-09 19:49:10 +00:00
Tobias Thierer
6b0bd4e1a1 Tweak boringssl_self_test.te
Include coredomain in initial definition of boringssl_self_test
rather than adding it later. This addresses an outstanding review
comment from http://r.android.com/1110523

Test: Treehugger
Bug: 137267623
Change-Id: I4e8d4e2e76b1c3a9b5a1f806e43e885b51cb7a60
2019-09-07 16:52:15 -07:00
Tobias Thierer
02924043e3 Merge "SEPolicy for boringssl_self_test." 2019-09-07 23:46:00 +00:00
Treehugger Robot
9aa263055b Merge "Revert "Root of /data belongs to init"" 2019-09-06 23:13:48 +00:00
Paul Crowley
d98e311952 Revert "Root of /data belongs to init"
This reverts commit 206b6535f1.

Reason for revert: Droidfood is blocked
Bug: 140402208
Change-Id: I1d1eb014747ba5c5bb656342e53b8c4e434878d1
2019-09-06 19:59:17 +00:00
Martin Stjernholm
53f223346d Merge "Rename the context for the ART APEX." 2019-09-06 14:37:16 +00:00
Jiyong Park
e95c704b6f Access to HALs from untrusted apps is blacklist-based
Before this change, access to HALs from untrusted apps was prohibited
except for the whitelisted ones like the gralloc HAL, the renderscript
HAL, etc. As a result, any HAL that is added by partners can't be
accessed from apps. This sometimes is a big restriction for them when
they want to access their own HALs in the same-process HALs running in
apps. Although this is a vendor-to-vendor communication and thus is not
a Treble violation, that was not allowed because their HALs are not in
the whitelist in AOSP.

This change fixes the problem by doing the access control in the
opposite way; access to HALs are restricted only for the blacklisted
ones.

All the hwservice context that were not in the whitelist are now put
to blacklist.

This change also removes the neverallow rule for the binder access to
the halserverdomain types. This is not needed as the protected
hwservices living in the HAL processes are already not accessible; we
have a neverallow rule for preventing hwservice_manager from finding
those protected hwservices from untrusted apps.

Bug: 139645938
Test: m

Merged-In: I1e63c11143f56217eeec05e2288ae7c91e5fe585
(cherry picked from commit 580375c923)

Change-Id: I4e611091a315ca90e3c181f77dd6a5f61d3a6468
2019-09-06 14:10:38 +09:00
Treehugger Robot
cd1d6deaa5 Merge "neverallow_macros: add watch* perms" 2019-09-05 19:43:19 +00:00
Martin Stjernholm
d7951d2647 Rename the context for the ART APEX.
Test: Boot (with default flattened APEXes)
Bug: 135753770
Change-Id: I551e88a250d3bd891f63a6bccee0682d0d0de7cf
2019-09-05 19:49:05 +01:00
Treehugger Robot
e0ecf49c38 Merge "system_app: neverallow /data/local/tmp access" 2019-09-05 18:38:00 +00:00
Nick Kralevich
6a7a72b07a neverallow_macros: add watch* perms
In cases where directory read access has been neverallowed via
no_rw_dir_perms, also neverallow the various watch* permissions.
If read was disallowed by the neverallow assertions, there's an
assumption that watch was also intended to not be allowed. Make that
assumption explicit.

References:
* https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ac5656d8a4cdd93cd2c74355ed12e5617817e0e7
* c4ab8edf74
* dddbaaf1e8

Test: compiles
Change-Id: I8139eaf1165a5090c7b48e45f353170e58ddf1d9
2019-09-05 09:54:43 -07:00
Xin Li
b40c2adaad Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:31 +00:00
Nick Kralevich
6e893ec1fe system_app: neverallow /data/local/tmp access
/data/local/tmp is an attacker controlled location which system_apps
should not be depending on. system_apps should only depend on files in
their home directory and files passed to them by file descriptor. To
support this best practice, neverallow access to /data/local/tmp. This
adds a compile time assertion and CTS test to assert that this rule is
never present.

This is conceptually a tightening of already defined neverallow rules in
domain.te. The existing neverallow assertions exclude appdomain, which
is too broad:

  neverallow {
    domain
    -adbd
    -appdomain
    -dumpstate
    -init
    -installd
    -simpleperf_app_runner
    -system_server # why?
    userdebug_or_eng(`-uncrypt')
  } shell_data_file:dir { open search };

  # Same as above for /data/local/tmp files. We allow shell files
  # to be passed around by file descriptor, but not directly opened.
  neverallow {
    domain
    -adbd
    -appdomain
    -dumpstate
    -installd
    userdebug_or_eng(`-uncrypt')
  } shell_data_file:file open;

Test: compiles
Change-Id: Ib7178e2b9d5a41c03837a535f7db5eaf10319aac
2019-09-05 09:24:41 -07:00
Hector Dearman
b56a49d979 Allow adb forward to traced consumer socket
Currently shell can connect to the traced_consumer_socket allowing it to
configure/start/stop and collect traces. This allows a host tool (e.g. Android Studio or
https://ui.perfetto.dev) to connect to the device via adb and collect traces. It would
be better if rather than executing shell commands the host tool could directly communicate
with the consumer socket. This is possible using adb forward:

adb forward tcp:9903 localfilesystem:/dev/socket/traced_consumer

However in this case adbd is connecting to the socket - not shell.

This CL allows adbd to connect to the socket which allows host tools to collect
traces without having to do everything though shell commands.

Denial:
08-30 11:28:05.809 10254 10254 W adbd    : type=1400 audit(0.0:1129): avc: denied { write } for name="traced_consumer" dev="tmpfs" ino=6719 scontext=u:r:adbd:s0 tcontext=u:object_r:traced_consumer_socket:s0 tclass=sock_file permissive=0

Test: Cherry pick CL to master, make, flash
adb logcat | grep denied
adb forward tcp:9903 localfilesystem:/dev/socket/traced_consumer

Bug: b/139536756
Change-Id: Ie08e687c0b06d0e1121009e8cd70319a8f907ae2
2019-09-05 10:12:47 +00:00
Tobias Thierer
353ad0fd47 SEPolicy for boringssl_self_test.
This CL adds hand-written SELinux rules to:
 - define the boringssl_self_test security domain
 - label the corresponding files at type boringssl_self_test_marker
   and boringssl_self_test_exec.
 - define an automatic transition from init to boringssl_self_test
   domains, plus appropriate access permissions.

Bug: 137267623
Test: When run together with the other changes from draft CL topic
      http://aosp/q/topic:bug137267623_bsslselftest, check that:
      - both /dev/boringssl/selftest/* marker files are
        present after the device boots.
      - Test: after the boringssl_self_test{32,64} binaries have
        run, no further SELinux denials occur for processes
        trying to write the marker file.

Change-Id: I77de0bccdd8c1e22c354d8ea146e363f4af7e36f
2019-09-05 02:40:57 +01:00
Xin Li
c390444129 DO NOT MERGE - Merge Android 10 into master
Bug: 139893257
Change-Id: If4ff6828d14882efc70ab48e5e36ffe99e0c3289
2019-09-04 13:35:29 -07:00
Martin Stjernholm
58e4384286 Split off ART rules for new ART APEX.
am: f6bd00af8b

Change-Id: If6e89c44c3e4429eed0f593e7a225f1a6f8e1d80
2019-09-02 03:46:11 -07:00
Martin Stjernholm
f6bd00af8b Split off ART rules for new ART APEX.
Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: Iab56f6b5bb7a59fbeaad214a64fbd959060574f4
Merged-In: Iab56f6b5bb7a59fbeaad214a64fbd959060574f4
2019-08-30 17:47:31 +01:00
Paul Crowley
e9465fceb6 Merge "Root of /data belongs to init"
am: b935b6c664

Change-Id: I39a36ec663c98ac55be886e886da4afbf34e9cf2
2019-08-29 23:10:42 -07:00
Paul Crowley
b935b6c664 Merge "Root of /data belongs to init" 2019-08-30 05:23:12 +00:00
Paul Crowley
206b6535f1 Root of /data belongs to init
Give /data itself a different label to its contents, to ensure that
only init creates files and directories there.

Bug: 139190159
Test: aosp boots, logs look good
Change-Id: I3ee654a928bdab3f5d435ab6ac24040d9bdd9abe
2019-08-29 15:08:21 -07:00
Victor Hsieh
0a0e46fa4a Merge "sepolicy: dontaudit cap_sys_admin on userdebug/eng"
am: 845e04ba73

Change-Id: I6a0e797dda80e90a1b0983bac49c012c50389d16
2019-08-29 12:01:26 -07:00
Treehugger Robot
845e04ba73 Merge "sepolicy: dontaudit cap_sys_admin on userdebug/eng" 2019-08-29 18:40:40 +00:00
Victor Hsieh
b7f2f0b878 sepolicy: dontaudit cap_sys_admin on userdebug/eng
When fsverity_init tries to access files in /system or /product
partition AFTER adb remount, SELinux denial is generated:

avc: denied { sys_admin } for capability=21
scontext=u:r:fsverity_init:s0 tcontext=u:r:fsverity_init:s0
tclass=capability permissive=0

This is due to some internal access to an xattr inside overlayfs, but it
should not report this.

Before the message can be surpressed, dontaudit it to keep the log clean.

Test: no more error log
Bug: 132323675
Change-Id: I323c9330ee6e6b897d1a4e1e74f6e7e0ef1eaa89
2019-08-29 09:39:31 -07:00
Steven Moreland
b27a746f50 Merge "Remove vintf_service."
am: cacefc6a78

Change-Id: Id30138a0955dc7883d83daa2b655a06efebcaaf7
2019-08-28 19:15:40 -07:00
Treehugger Robot
cacefc6a78 Merge "Remove vintf_service." 2019-08-29 01:58:04 +00:00