Commit graph

1682 commits

Author SHA1 Message Date
Andres Oportus
2f0d04962a Merge "Allow only system_server to read uid_time_in_state" am: 439364d20e am: e96aad0998
am: 3ce2c6f866

Change-Id: Ic54d118a477d1827952e1c54216ff01838d985d7
2017-07-01 13:04:04 +00:00
Andres Oportus
3ce2c6f866 Merge "Allow only system_server to read uid_time_in_state" am: 439364d20e
am: e96aad0998

Change-Id: I0742836c6b613afeab2dcf6d59c37dd9787dc91a
2017-07-01 12:59:05 +00:00
Andres Oportus
e96aad0998 Merge "Allow only system_server to read uid_time_in_state"
am: 439364d20e

Change-Id: I726672b2e3379e2e53d3c6b26482147f11d06d8e
2017-07-01 12:54:07 +00:00
Treehugger Robot
439364d20e Merge "Allow only system_server to read uid_time_in_state" 2017-07-01 12:48:41 +00:00
Jeff Vander Stoep
4d5721a5a3 Remove adbd tcontexts from domain_deprecated
Logs indicate apps, system_server, and runas are the only
domains that require this permission.

Bug: 28760354
Test: check logs.
Change-Id: I93dc53ec2d892bb91c0cd6f5d7e9cbf76b9bcd9f
2017-07-01 06:30:58 +00:00
Andres Oportus
97b955de13 Allow only system_server to read uid_time_in_state
Bug: 62706738
Bug: 34133340
Test: Check that uid_time_in_state can't be read from
the shell without root permissions and that
"dumpsys batterystats --checkin| grep ctf" shows frequency
data (system_server was able to read uid_time_in_state)

Change-Id: Ic6a54da4ebcc9e10b0e3af8f14a45d7408e8686e
(cherry picked from commit 4dc88795d0)
2017-06-30 22:07:57 -07:00
Jeff Vander Stoep
6907f57417 Merge "hal_tetheroffload: Grant permissions" into oc-dr1-dev
am: 243c46cc46

Change-Id: I08aa08c6e23c0e78569d06c4e4e36a27dd861459
2017-06-29 04:32:30 +00:00
TreeHugger Robot
243c46cc46 Merge "hal_tetheroffload: Grant permissions" into oc-dr1-dev 2017-06-29 04:26:11 +00:00
Jeff Vander Stoep
e58a8de5e7 hal_tetheroffload: Grant permissions
avc: denied { read write } scontext=u:r:ipacm:s0
tcontext=u:r:system_server:s0 tclass=netlink_netfilter_socket
avc: denied { setopt } scontext=u:r:ipacm:s0
tcontext=u:r:system_server:s0 tclass=netlink_netfilter_socket
avc: denied { getattr } scontext=u:r:ipacm:s0
tcontext=u:r:system_server:s0 tclass=netlink_netfilter_socket
avc: denied { create } for scontext=u:r:system_server:s0
tcontext=u:r:system_server:s0 tclass=netlink_netfilter_socket

Bug: 29337859
Bug: 32163131
Test: adb shell getenforce
Enforcing
adb shell dumpsys connectivity tethering
Tethering:
  ...
  Log:
    ...
    06-28 11:46:58.841 - SET master tether settings: ON
    06-28 11:46:58.857 - [OffloadController] tethering offload started
And logs show some signs of happiness:
    06-28 11:46:58.853   816   947 I IPAHALService: IPACM was provided two FDs (18, 19)
    06-28 11:46:58.853  1200  1571 I zygote64: Looking for service android.hardware.tetheroffload.control@1.0::IOffloadControl/default
Change-Id: I0c63bd2de334b4ca40e54efb9df4ed4904667e21
2017-06-29 04:24:14 +00:00
Jeff Vander Stoep
cbe69fe83e Merge "Suppress su access to pdx sockets" into oc-dr1-dev
am: ae548746dc

Change-Id: Ie16d24ad9e950e279ca79ba89ec1aaf4ab273ef5
2017-06-27 22:25:59 +00:00
TreeHugger Robot
ae548746dc Merge "Suppress su access to pdx sockets" into oc-dr1-dev 2017-06-27 22:21:27 +00:00
Jeff Vander Stoep
4b7cf4fba1 Suppress su access to pdx sockets
Su runs in permissive mode and denials should be suppressed.

avc: denied { getattr } for scontext=u:r:su:s0
tcontext=u:object_r:pdx_display_client_endpoint_socket:s0
tclass=unix_stream_socket permissive=1
avc: denied { getattr } for scontext=u:r:su:s0
tcontext=u:object_r:pdx_display_manager_endpoint_socket:s0
tclass=unix_stream_socket permissive=1
avc: denied { getattr } for scontext=u:r:su:s0
tcontext=u:object_r:pdx_display_vsync_endpoint_socket:s0
tclass=unix_stream_socket permissive=1
avc: denied { getattr } for scontext=u:r:su:s0
tcontext=u:object_r:pdx_bufferhub_client_endpoint_socket:s0
tclass=unix_stream_socket permissive=1
avc: denied { getattr } for scontext=u:r:su:s0
tcontext=u:object_r:pdx_performance_client_endpoint_socket:s0
tclass=unix_stream_socket permissive=1

Bug: 35197529
Test: policy builds
Change-Id: Ia643c6e776e5e5bd473d857d523c3be91d32c40a
2017-06-26 16:33:14 -07:00
Stephen Smalley
06a22e41fe Define smc_socket security class. am: 2be9799bcc am: 52909aca44
am: ad01d1f6ab

Change-Id: Ia8a0f7b4378f6e66a148dcbd4d55fcb8f66f4176
2017-06-26 22:18:08 +00:00
Stephen Smalley
ad01d1f6ab Define smc_socket security class. am: 2be9799bcc
am: 52909aca44

Change-Id: I613dc32aac4b3276924717e8066fd2cd229b81ec
2017-06-26 22:14:20 +00:00
Jeff Vander Stoep
f962aa620e Add another extraneous neverallow rule to force attribute inclusion am: c75aa50d5d
am: a128aca6c9

Change-Id: I5432110e7e009c29b27dee40c543203c1b17059a
2017-06-26 22:03:06 +00:00
Stephen Smalley
52909aca44 Define smc_socket security class.
am: 2be9799bcc

Change-Id: If42bc0d3fc50db8294c8a9fd083d915b8e47a95e
2017-06-26 22:02:28 +00:00
Jeff Vander Stoep
a128aca6c9 Add another extraneous neverallow rule to force attribute inclusion
am: c75aa50d5d

Change-Id: I39eecd67a97de193d53ab298a1ef3e8443bb9391
2017-06-26 22:00:37 +00:00
Jeff Vander Stoep
e3c7880ef5 Add another extraneous neverallow rule to force attribute inclusion
am: c75aa50d5d

Change-Id: I91bbecf1b60944fb43022dcc5f5ffe452b713193
2017-06-26 22:00:37 +00:00
Stephen Smalley
2be9799bcc Define smc_socket security class.
Linux kernel commit da69a5306ab9 ("selinux: support distinctions among all
network address families") triggers a build error if a new address family
is added without defining a corresponding SELinux security class.  As a
result, the smc_socket class was added to the kernel to resolve a build
failure as part of merge commit 3051bf36c25d that introduced AF_SMC circa
Linux 4.11.  Define this security class and its access vector, add
it to the socket_class_set macro, and exclude it from webview_zygote
like other socket classes.

Test:  Policy builds

Change-Id: Idbb8139bb09c6d1c47f1a76bd10f4ce1e9d939cb
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-26 21:44:58 +00:00
Jeff Vander Stoep
c75aa50d5d Add another extraneous neverallow rule to force attribute inclusion
Due to the massively increased number of attributes in SELinux policy
as part of the treble changes, we have had to remove attributes from
policy for performance reasons.  Unfortunately, some attributes are
required to be in policy to ensure that our neverallow rules are being
properly enforced.  Usually this is not a problem, since neverallow rules
indicate that an attribute should be kept, but this is not currently the
case when the attribute is part of a negation in a group.

This is particularly problematic with treble since some attributes may
exist for HALs that have no implementation, and thus no types.  In
particular, this has caused an issue with the neverallows added in our
macros.  Add an extraneous neverallow rule to each of those auto-generated
neverallow rules to make sure that they are not removed from policy, until
the policy compiler is fixed to avoid this.  Also add corresponding rules
for other types which have been removed due to no corresponding rules.

Bug: 62658302
Bug: 62999603
Test: Build Marlin policy.
Test: verify attribute exists in policy using sepolicy-analyze.
    sepolicy-analyze $OUT/vendor/etc/selinux/precompiled_sepolicy \
    attribute hal_tetheroffload_server
Test: CTS neverallow tests pass.
    cts-tradefed run cts -m CtsSecurityHostTestCases -t \
    android.cts.security.SELinuxNeverallowRulesTest
Change-Id: I62596ba8198ffdcbb4315df639a834e4becaf249
2017-06-26 10:32:18 -07:00
Jeff Vander Stoep
0d8b983077 Merge "system_server is a client of configstore" into oc-dr1-dev
am: 25578a3096

Change-Id: I1d49bdbd662e4037843a2c6af4954a4a926c8543
2017-06-23 21:47:45 +00:00
TreeHugger Robot
25578a3096 Merge "system_server is a client of configstore" into oc-dr1-dev 2017-06-23 21:32:13 +00:00
Jeff Vander Stoep
23e0a7f23a system_server is a client of configstore
avc:  denied  { find } for
interface=android.hardware.configstore::ISurfaceFlingerConfigs
scontext=u:r:system_server:s0
tcontext=u:object_r:hal_configstore_ISurfaceFlingerConfigs:s0
tclass=hwservice_manager permissive=0

Bug: 35197529
Test: Device boots without this denial
Change-Id: Ia43bc5879e03a1f2056e373b17cc6533636f98b1
2017-06-23 11:20:20 -07:00
Tomonori Nanbu
b9621bbacc Merge "Add sepolicy for hal_wifi to access /proc/modules" am: 6acd70b918 am: ded0b58d62
am: 9d86e622e3

Change-Id: Ib83f52f4dae096d42dedf17898cf20d8c3923f2e
2017-06-22 15:51:01 +00:00
Tomonori Nanbu
9d86e622e3 Merge "Add sepolicy for hal_wifi to access /proc/modules" am: 6acd70b918
am: ded0b58d62

Change-Id: I574e60486bb12214e33a8e9aabf7794d4ebc0b1a
2017-06-22 15:45:20 +00:00
Treehugger Robot
6acd70b918 Merge "Add sepolicy for hal_wifi to access /proc/modules" 2017-06-22 15:35:14 +00:00
Jeff Vander Stoep
aae5c4c8c5 Merge "Exempt tetheroffload hal from network socket restrictions" into oc-dev am: 6351c374c2
am: d9301ac6fa

Change-Id: I4b272a59a7e48e1f0f15ddd1acb7e8f6b836ca40
2017-06-21 23:34:41 +00:00
Jeff Vander Stoep
d9301ac6fa Merge "Exempt tetheroffload hal from network socket restrictions" into oc-dev
am: 6351c374c2

Change-Id: I6e661aa37702c36e9003dcf41dbed4b754122c87
2017-06-21 23:32:08 +00:00
Jeff Vander Stoep
319d70993d Merge "Exempt tetheroffload hal from network socket restrictions" into oc-dev
am: 6351c374c2

Change-Id: I16cbe7b654532367829a0df2dcfa929c38e547fd
2017-06-21 23:31:12 +00:00
TreeHugger Robot
6351c374c2 Merge "Exempt tetheroffload hal from network socket restrictions" into oc-dev 2017-06-21 23:26:22 +00:00
Dan Cashman
11dcf1976f Remove neverallow preventing hwservice access for apps. am: 3e307a4de5
am: 044d20729b

Change-Id: Ia6f8a806adae230df50f8d06edcf4ba9d2ae4352
2017-06-21 21:41:10 +00:00
Dan Cashman
044d20729b Remove neverallow preventing hwservice access for apps.
am: 3e307a4de5

Change-Id: Ic144d924948d7b8e73939806d761d27337dbebef
2017-06-21 21:38:19 +00:00
Dan Cashman
317c4171d2 Remove neverallow preventing hwservice access for apps.
am: 3e307a4de5

Change-Id: I90e567c8138fa75bf792af181890d0af627b6f48
2017-06-21 21:37:32 +00:00
Jeff Vander Stoep
d75a2c0cc8 Exempt tetheroffload hal from network socket restrictions
The tetheroffload hal must be able to use network sockets as part of
its job.

Bug: 62870833
Test: neverallow-only change builds.
Change-Id: I630b36340796a5ecb5db08e732b0978dd82835c7
2017-06-21 12:46:21 -07:00
Dan Cashman
3e307a4de5 Remove neverallow preventing hwservice access for apps.
Same-process HALs are forbidden except for very specific HALs that have
been provided and whitelisted by AOSP.  As a result, a vendor extension
HAL may have a need to be accessed by untrusted_app.  This is still
discouraged, and the existing AOSP hwservices are still forbidden, but
remove the blanket prohibition.  Also indicate that this is temporary,
and that partners should expect to get exceptions to the rule into AOSP
in the future.

Bug: 62806062
Test: neverallow-only change builds.  Verify new attribute is in policy.
Change-Id: I6d3e659147d509a3503c2c9e0b6bb9016cc75832
2017-06-21 12:30:36 -07:00
Yabin Cui
330d447778 Allow run-as to read/write unix_stream_sockets created by adbd.
This is to Allow commands like `adb shell run-as ...`.

Bug: http://b/62358246
Test: run commands manually.
Change-Id: I7bb6c79a6e27ff1224a80c6ddeffb7f27f492bb2
(cherry picked from commit 1847a38b4a)
2017-06-20 13:50:54 -07:00
Yabin Cui
e786cbfc91 Avoid audit when running adb shell -t run-as xxx. am: 3b7d9e49df am: 6e46ccdf57
am: ed88246c57

Change-Id: Id7a784cbe65961f876f4d2d167303dcf7854ae21
2017-06-20 20:04:28 +00:00
Yabin Cui
ed88246c57 Avoid audit when running adb shell -t run-as xxx. am: 3b7d9e49df
am: 6e46ccdf57

Change-Id: I5241333ec9099c7db3154cfcdb41003c65e235a0
2017-06-20 19:59:55 +00:00
Yabin Cui
3b7d9e49df Avoid audit when running adb shell -t run-as xxx.
run-as uses file descriptor created by adbd when running
`adb shell -t run-as xxx`. It produces audit warnings like below:

[ 2036.555371] c1    509 type=1400 audit(1497910817.864:238): avc: granted { use } for pid=4945 comm="run-as" path="/dev/pts/0" dev="devpts" ino=3 scontext=u:r:runas:s0 tcontext=u:r:adbd:s0 tclass=fd

Bug: http://b/62358246
Test: test manually that the warning disappears.
Change-Id: I19023ac876e03ce2afe18982fe753b07e4c876bb
2017-06-19 16:02:07 -07:00
Tom Cherry
0e6a3d87e9 Merge "Add getpgid to system_service and init" into oc-dr1-dev 2017-06-19 20:38:37 +00:00
Tom Cherry
d5f0aba025 Add getpgid to system_service and init
In libprocessgroup, we want to only send signals once to processes,
particularly for SIGTERM.  We must send the signal both to all
processes within a POSIX process group and a cgroup.  To ensure that
we do not duplicate the signals being sent, we check the processes in
the cgroup to see if they're in the POSIX process groups that we're
killing.  If they are, we skip sending a second signal.  This requires
getpgid permissions, hence this SELinux change.

avc: denied { getpgid } for pid=797 comm="ActivityManager" scontext=u:r:system_server:s0 tcontext=u:r:untrusted_app_25:s0:c512,c768 tclass=process permissive=1
avc: denied { getpgid } for pid=797 comm="ActivityManager" scontext=u:r:system_server:s0 tcontext=u:r:untrusted_app_25:s0:c512,c768 tclass=process permissive=1
avc: denied { getpgid } for pid=797 comm="ActivityManager" scontext=u:r:system_server:s0 tcontext=u:r:system_app:s0 tclass=process permissive=1
avc: denied { getpgid } for pid=797 comm="ActivityManager" scontext=u:r:system_server:s0 tcontext=u:r:system_app:s0 tclass=process permissive=1
avc: denied { getpgid } for pid=1 comm="init" scontext=u:r:init:s0 tcontext=u:r:zygote:s0 tclass=process permissive=1
avc: denied { getpgid } for pid=1 comm="init" scontext=u:r:init:s0 tcontext=u:r:zygote:s0 tclass=process permissive=1
avc: denied { getpgid } for pid=1 comm="init" scontext=u:r:init:s0 tcontext=u:r:system_server:s0 tclass=process permissive=1
avc: denied { getpgid } for pid=1 comm="init" scontext=u:r:init:s0 tcontext=u:r:system_server:s0 tclass=process permissive=1

Bug: 37853905
Bug: 62418791
Test: Boot, kill zygote, reboot
Change-Id: Ib6c265dbaac8833c47145ae28fb6594ca8545570
(cherry picked from commit c59eb4d853)
2017-06-19 11:26:48 -07:00
Dan Cashman
3b2bf73db6 Merge "Add extraneous neverallow rule to enforce attribute inclusion." into oc-dev am: b5aeaf6dfa
am: 6f94efafd8

Change-Id: I1aceeeb61ca9e558dd32b3ef33e07b6a551387e6
2017-06-16 20:51:50 +00:00
Dan Cashman
2f2fd36539 Merge "Add extraneous neverallow rule to enforce attribute inclusion." into oc-dev
am: b5aeaf6dfa

Change-Id: Ib0ac9cf10c7cb9fd2462e0036307e2552d19b93b
2017-06-16 20:46:00 +00:00
Dan Cashman
6f94efafd8 Merge "Add extraneous neverallow rule to enforce attribute inclusion." into oc-dev
am: b5aeaf6dfa

Change-Id: Ibcf17f7bbea4923abc5d1713227568bb35c6674b
2017-06-16 20:45:50 +00:00
TreeHugger Robot
b5aeaf6dfa Merge "Add extraneous neverallow rule to enforce attribute inclusion." into oc-dev 2017-06-16 20:37:52 +00:00
Dan Cashman
939b50ff61 Add extraneous neverallow rule to enforce attribute inclusion.
Due to the massively increased number of attributes in SELinux policy
as part of the treble changes, we have had to remove attributes from
policy for performance reasons.  Unfortunately, some attributes are
required to be in policy to ensure that our neverallow rules are being
properly enforced.  Usually this is not a problem, since neverallow rules
indicate that an attribute should be kept, but this is not currently the
case when the attribute is part of a negation in a group.

This is particularly problematic with treble since some attributes may
exist for HALs that have no implementation, and thus no types.  In
particular, this has caused an issue with the neverallows added in our
macros.  Add an extraneous neverallow rule to each of those auto-generated
neverallow rules to make sure that they are not removed from policy, until
the policy compiler is fixed to avoid this.  Also add corresponding rules
for other types which have been removed due to no corresponding rules.

Bug: 62591065
Bug: 62658302
Test: Attributes present in policy and CTS passes.  sepolicy-analyze also
works on platform-only policy.
Change-Id: Ic3fc034cdbd04a94167f8240cf562297e8d7c762
2017-06-16 11:19:53 -07:00
Sandeep Patil
ac8d43b37c radio: disalllow radio and rild socket for treble devices am: d3381cd9e6
am: 8aa283fef3

Change-Id: I7593dd0f7f2888fb5b2aa5a20b258d3a370146fe
2017-06-16 17:28:08 +00:00
Sandeep Patil
8aa283fef3 radio: disalllow radio and rild socket for treble devices
am: d3381cd9e6

Change-Id: Iaabe00cb6e919b4e35896c0d9ef1770aee3b2363
2017-06-16 17:22:42 +00:00
Sandeep Patil
516d855524 radio: disalllow radio and rild socket for treble devices
am: d3381cd9e6

Change-Id: I33215b5c9d894823f3928742a8712ef42d803156
2017-06-16 17:22:42 +00:00
Tom Cherry
c638217732 Merge "Add getpgid to system_service and init" am: 2122f1fe95 am: 043068593a
am: 24d0cad327

Change-Id: Ieffac9d2e5ff8500534cf9935eff9918989c2fb4
2017-06-15 17:30:23 +00:00