Commit graph

142 commits

Author SHA1 Message Date
Tri Vo
1ec780732d Remove proc and sysfs access from system_app and platform_app. am: 06d7dca4a1 am: 32205bc52a
am: 0e1770d76b

Change-Id: I30e7650a7468a76075f227d2c3edca08ae046097
2018-01-20 01:46:10 +00:00
Tri Vo
06d7dca4a1 Remove proc and sysfs access from system_app and platform_app.
Bug: 65643247
Test: manual
Test: browse internet
Test: take a picture
Change-Id: I9faff44b7a025c7422404d777113e40842ea26dd
2018-01-20 01:05:21 +00:00
Jeff Vander Stoep
89ea84aabb relabel files in /proc/net/xt_qtaguid/ am: 43303c8b89 am: 02dbf4e0a1
am: 2beb891520

Change-Id: Idfe7ef49572476508ef52391f221029d662ffad8
2018-01-11 20:43:04 +00:00
Jeff Vander Stoep
43303c8b89 relabel files in /proc/net/xt_qtaguid/
/proc/net/xt_qtaguid is used by apps to track their network data
use. Limit access to just zygote spawned processes - apps and
system_server, omitting access to isolated_app which is not allowed
to create network sockets.
As Android moves to eBPF for app's network data stats, access to
/proc/net/xt_qtaguid will be removed entirely. Segmenting access off
is the first step.
Bug: 68774956

This change also helps further segment and whitelist access to
files in /proc/net and is a step in the lockdown of /proc/net.
Bug: 9496886

Test: boot Taimen. Walk through setup-wizard. Make phone call and
    video call. Browse web. Watch youtube. Navigate in maps.
Test: cts-tradefed run cts -m CtsAppSecurityHostTestCases -t \
    android.appsecurity.cts.AppSecurityTests
Test: cts-tradefed run cts -m CtsNativeNetTestCases
Test: cts-tradefed run cts -m CtsIncidentHostTestCases -t \
    com.android.server.cts.NetstatsIncidentTest
Test: cts-tradefed run cts -m CtsOsTestCases -t \
    android.os.cts.StrictModeTest
Test: cts-tradefed run cts -m CtsNetTestCases -t \
    android.net.cts.TrafficStatsTest
Test: cts-tradefed run cts -m CtsUsageStatsTestCases -t \
    android.app.usage.cts.NetworkUsageStatsTest
Test: vts-tradefed run vts -m VtsQtaguidTest
Change-Id: Idddd318c56b84564142d37b11dcc225a2f2800ea
2018-01-11 16:46:36 +00:00
Primiano Tucci
214f47963b Perfetto SELinux policies am: c80f9e037b am: 3ed0362a30
am: 7c5113d79f

Change-Id: I70969b44d0fe8cc732848453bcbb8657df7fd08c
2018-01-10 00:43:53 +00:00
Primiano Tucci
c80f9e037b Perfetto SELinux policies
Perfetto is a performance instrumentation and logging framework,
living in AOSP's /external/pefetto.
Perfetto introduces in the system one binary and two daemons
(the binary can specialize in either depending on the cmdline).

1) traced: unprivileged daemon. This is architecturally similar to logd.
   It exposes two UNIX sockets:
   - /dev/socket/traced_producer : world-accessible, allows to stream
     tracing data. A tmpfs file descriptor is sent via SCM_RIGHTS
     from traced to each client process, which needs to be able to
     mmap it R/W (but not X)
   - /dev/socket/traced_consumer : privilege-accessible (only from:
     shell, statsd). It allows to configure tracing and read the trace
     buffer.
2) traced_probes: privileged daemon. This needs to:
   - access tracingfs (/d/tracing) to turn tracing on and off.
   - exec atrace
   - connect to traced_producer to stream data to traced.

init.rc file:
https://android-review.googlesource.com/c/platform/external/perfetto/+/575382/14/perfetto.rc

Bug: 70942310
Change-Id: Ia3b5fdacbd5a8e6e23b82f1d6fabfa07e4abc405
2018-01-10 00:18:46 +00:00
Luis Hector Chavez
9c72ef8904 Merge "Revert "Allow callers of uevent_kernel_*() access to /proc/sys/kernel/overflowuid"" am: 3ec0dbf7d1 am: df624b3479
am: 45b0aa3308

Change-Id: I9c08801a5fdf232f2e70d2d97e22e7d2e90dcbbb
2018-01-09 20:21:47 +00:00
Luis Hector Chavez
7ae939e84b Revert "Allow callers of uevent_kernel_*() access to /proc/sys/kernel/overflowuid"
This reverts commit 640e595a68. The
corresponding code in libcutils was removed, so this is now unneeded.

Bug: 71632076
Test: aosp_sailfish still works

Change-Id: I615bab83e9a83bc14439b8ab90c00d3156b0a7c4
2018-01-08 13:09:34 -08:00
Chenbo Feng
7921ff073b sepolicy: Allow mount cgroupv2 and bpf fs am: 254ad0da3a am: 956e099ec6
am: 13c3ed2836

Change-Id: I5a753a23f0b03d7d8db14337efd6ea970a90a38b
2018-01-02 22:12:04 +00:00
Chenbo Feng
254ad0da3a sepolicy: Allow mount cgroupv2 and bpf fs
Some necessary sepolicy rule changes for init process to create directory,
mount cgroupv2 module and mount bpf filesystem. Also allow netd to create
and pin bpf object as files and read it back from file under the
directory where bpf filesystem is mounted.

Test: bpf maps show up under /sys/fs/bpf/
Change-Id: I579d04f60d7e20bd800d970cd28cd39fda9d20a0
2018-01-02 11:52:33 -08:00
Ricky Wai
7494cc133c Add Network Watchlist data file selinux policy(Used in ConfigUpdater) am: ff3b957e63 am: 56a9edb19e
am: a70a3ca0ba

Change-Id: I208790e37ba208f72b02a5caf595d84b34dd8cb2
2018-01-02 18:29:22 +00:00
Ricky Wai
ff3b957e63 Add Network Watchlist data file selinux policy(Used in ConfigUpdater)
Bug: 63908748
Test: Able to boot
Change-Id: I14d8856d7aac7be9d1f26ecf5bfff69ea5ee9607
2018-01-02 18:16:46 +00:00
Jeffrey Vander Stoep
678082147d Revert "Audit app access to /proc/net/*"
This reverts commit 84f9685972.

Fixes: 70874565
Reason for revert: massive logspam during phone calls.

Change-Id: If00e46535f71209eea999e4d5d499bf40a5f16fd
2017-12-21 20:05:26 -08:00
xshu
96b44bec14 Wifi hal - Firmware dump permissions am: 6ad3c891bc am: 40868b952e
am: 5a90141fbd

Change-Id: I62223088adf7681ba868822efe43264c8fc4c987
2017-12-19 01:04:51 +00:00
xshu
6ad3c891bc Wifi hal - Firmware dump permissions
we are aiming to improve logging performance by having wifi hal
directly write to the flash.

Wifi hal need to be able to create, write, and delete files in
a directory. This will be restricted to userdebug and eng builds only.

Bug: 70170285
Test: compile, run on device
Change-Id: Id0cd317411f4c393d7529aa31b501046d7350edb
2017-12-18 13:11:02 -08:00
TreeHugger Robot
58bf871783 Merge "Audit app access to /proc/net/*" 2017-12-18 15:15:19 +00:00
Jeff Vander Stoep
84f9685972 Audit app access to /proc/net/*
Many processes including third party apps are expected to
access /proc/net/xt_qtaguid/stats. Give this file a new label
to avoid spamming the logs and temporarily grant read access to
all processes.

Read-only permission is adequate for all processes based on unix
permissions.
sailfish:/ # ls -laZ /proc/net/xt_qtaguid/stats
-r--r--r--  1 root net_bw_stats u:object_r:proc_net_xt_qtaguid_stats:s0 stats

Bug: 9496886
Bug: 68016944
Bug: 70722355
Test: Build/flash Sailfish. Browse in Chrome and watch videos in youtube.
    No "denied" or "granted" selinux messages observed in the logs.

Change-Id: I29f1ee806c8149988b9b93a950790d14754927ef
2017-12-15 16:34:39 -08:00
Marissa Wall
15ba57cce6 Merge "Restrict access to uid_concurrent_*_time" am: 40ed4283e4 am: 5b17322a87
am: 3337c82e7c

Change-Id: Id7dba03c422e4f9a2d094c7b26a773ababe2ab47
2017-12-13 20:27:09 +00:00
Marissa Wall
80ee23f74a Restrict access to uid_concurrent_*_time
Do not let apps read uid_concurrent_active_time and
uid_concurrent_policy_time.

b/68399339

Test: Check that they can't be read from the shell
    without root permissions and system_server was able
    to read them

Change-Id: I6f09ef608607cb9f4084ba403a1e7254b8c49a06
2017-12-12 19:19:04 +00:00
Andreas Gampe
89e02ed37b Merge "Sepolicy: Label kernel notes" am: 1d7fcdd59a am: aee0b123b7
am: 5059b423aa

Change-Id: I4665e89aba12c2a357317f2325ed60c9bfa89773
2017-12-08 00:22:26 +00:00
Andreas Gampe
9213fe0217 Sepolicy: Label kernel notes
Label /sys/kernel/notes.

Bug: 70275668
Test: m
Change-Id: Ieb666425d2db13f85225fb902fe06b0bf2335bef
2017-12-06 13:55:06 -08:00
Tri Vo
3c0a52076f Label /proc/sys/kernel/pid_max as proc_pid_max. am: 4081fd3993 am: ab35e4343b
am: a7351f93f7

Change-Id: Ifee5631ffbb9842f01683612da012286efcfaf5a
2017-11-28 19:19:06 +00:00
Tri Vo
4081fd3993 Label /proc/sys/kernel/pid_max as proc_pid_max.
And give shell domain read access to /proc/sys/kernel/pic_max.

Bug: 69569397
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
--gtest_filter=pthread.pthread_mutex_owner_tid_limit
Change-Id: Ib56c18ed553ad2c2113e6913788a4c00965483cc
2017-11-28 08:42:46 -08:00
Tri Vo
a087581232 Merge "system_server: access to /proc/sys/fs/pipe-max-size" am: 25576730c9 am: 1bd4443aa6
am: 00057abcfc

Change-Id: I6d6b75701e35b35501935162670f906f9c757d4b
2017-11-17 17:25:23 +00:00
Tri Vo
e7f4934d06 system_server: access to /proc/sys/fs/pipe-max-size
Label /proc/sys/fs/pipe-max-size with new type proc_pipe_conf and give
system_server access to it.

Addresses this denial:
avc: denied { read } for name="pipe-max-size" dev="proc" ino=93817
scontext=u:r:system_server:s0 tcontext=u:object_r:proc:s0 tclass=file
permissive=0

Bug: 69175449
Bug: 69324398
Test: sailfish boots
Test: adb bugreport
Test: craft an unresponsive app, trigger ANR, make sure traces are dumped
into /data/anr
Above denial from system_server not observed, no denials to proc_pipe_conf
observed.
Change-Id: I7c71f05820a4945ba982e29f76e9d9f4458b2b59
2017-11-16 12:30:53 -08:00
Tianjie Xu
0de7ffc5a7 Merge "Allow update_engine to access /data/misc/update_engine_log" am: 07ff610768 am: 39ec2bb6e3
am: 565a93fc6c

Change-Id: I7bcf5b4c91b949b7621499605bb049053dc9baa6
2017-11-10 22:18:26 +00:00
Tri Vo
2734f0d25b Merge changes from topic "cki_proc_init" am: aa93dad669 am: cec8b2cd1b
am: cd1bfb8480

Change-Id: Ib39d79bacd1827d4c549781d4d23d7404c183c84
2017-11-10 00:11:25 +00:00
Hakan Kvist
6fe014f8cb Allow update_engine to access /data/misc/update_engine_log
Add label update_engine_log_data_file for log files created by
update engine in directory /data/misc/update_engine_log.

Bug: 65568605
Test: manual
Change-Id: I379db82a0ea540e41cb3b8e03f93d9ce64fac7c9
2017-11-09 14:21:49 -08:00
Tri Vo
84e181bcd7 init: label /proc dependencies and remove access to proc
New types and files labeled with them:
1. proc_abi:
  /proc/sys/abi/swp

2. proc_dirty:
  /proc/sys/vm/dirty_background_ratio
  /proc/sys/vm/dirty_expire_centisecs

3. proc_diskstats:
  /proc/diskstats

4. proc_extra_free_kbytes:
  /proc/sys/vm/extra_free_kbytes

5. proc_hostname:
  /proc/sys/kernel/domainname
  /proc/sys/kernel/hostname

6. proc_hung_task:
  /proc/sys/kernel/hung_task_timeout_secs

7. proc_max_map_count:
  /proc/sys/vm/max_map_count

8. proc_panic:
  /proc/sys/kernel/panic_on_oops

9. proc_sched:
  /proc/sys/kernel/sched_child_runs_first
  /proc/sys/kernel/sched_latency_ns
  /proc/sys/kernel/sched_rt_period_us
  /proc/sys/kernel/sched_rt_runtime_us
  /proc/sys/kernel/sched_tunable_scaling
  /proc/sys/kernel/sched_wakeup_granularity_ns

10. proc_uptime:
  /proc/uptime

Files labeled with already existing types:
1. proc_perf:
  /proc/sys/kernel/perf_event_paranoid

2. proc_sysrq:
  /proc/sys/kernel/sysrq

3. usermodehelper:
  /proc/sys/kernel/core_pipe_limit

Changes to init domain:
1. Removed access to files with 'proc' label.
2. Added access to newly introduced types + proc_kmsg.

Bug: 68949041
Test: walleye boots without denials from u:r:init:s0.
Test: system/core/init/grab-bootchart.sh does not trigger denials from
u:r:init:s0
Change-Id: If1715c3821e277679c320956df33dd273e750ea2
2017-11-08 14:46:09 -08:00
Luis Hector Chavez
ba872bb288 Allow callers of uevent_kernel_*() access to /proc/sys/kernel/overflowuid am: 640e595a68 am: fe5554828e
am: 4953e49c69

Change-Id: I7f0f8d58f0cd8bb79e9d63b8f272db9f0ec2f4f5
2017-11-08 02:18:58 +00:00
Luis Hector Chavez
640e595a68 Allow callers of uevent_kernel_*() access to /proc/sys/kernel/overflowuid
Bug: 62378620
Test: Android in Chrome OS can call uevent_kernel_recv() and not fail
      with EIO.
Test: bullhead networking still works

Change-Id: I4dd5d2148ee1704c4fa23d7fd82d1ade19b58cbd
2017-11-08 01:39:28 +00:00
Jeff Vander Stoep
cae7ef0f46 Annotate data types owned by the core platform am: dd7e36c0f2 am: ed9a9cd4db
am: da866142ae

Change-Id: Id3af88a84c1d43e83f68c9df03a69d508dcdc550
2017-11-06 18:31:05 +00:00
Jeff Vander Stoep
dd7e36c0f2 Annotate data types owned by the core platform
This will be used to enforce data separation between platform and
vendor.

Test: build
Bug: 34980020
Change-Id: Ia312f00068d3982c7aae7e35bd0c96a6eb9ea3be
2017-11-06 16:38:05 +00:00
Tom Cherry
6ccc0f90f3 Merge "Add label for /proc/sys/vm/page-cluster" am: 2286b39712 am: 74e051e898
am: 3f96a8dc46

Change-Id: I9932164a205bb71ee49dcb75db2f53ae9ff39536
2017-10-25 16:23:25 +00:00
Tri Vo
c0be97f141 Merge "/proc, /sys access from uncrypt, update_engine, postinstall_dexopt" am: 71b19aa601 am: d67ded6873
am: b2cacef8af

Change-Id: I8dbe7395ac2fe400953cde06e3dbf042c207cb6e
2017-10-24 20:55:12 +00:00
Tom Cherry
8bdb1dab56 Add label for /proc/sys/vm/page-cluster
Test: boot sailfish with no audit when writing to page-cluster
Change-Id: I2bfebdf9342594d66d95daaec92d71195c93ffc8
2017-10-24 13:53:51 -07:00
Tri Vo
04fb82f232 /proc, /sys access from uncrypt, update_engine, postinstall_dexopt
New types:
1. proc_random
2. sysfs_dt_firmware_android

Labeled:
1. /proc/sys/kernel/random as proc_random.
2. /sys/firmware/devicetree/base/firmware/android/{compatible, fstab,
vbmeta} as sysfs_dt_firmware_android.

Changed access:
1. uncrypt, update_engine, postinstall_dexopt have access to generic proc
and sysfs labels removed.
2. appropriate permissions were added to uncrypt, update_engine,
update_engine_common, postinstall_dexopt.

Bug: 67416435
Bug: 67416336
Test: fake ota go/manual-ab-ota runs without denials
Test: adb sideload runs without denials to new types
Change-Id: Id31310ceb151a18652fcbb58037a0b90c1f6505a
2017-10-24 16:40:45 +00:00
Jeffrey Vander Stoep
be5a486306 Merge "hal_audio: remove access to audiohal_data_file" am: 1b223839e0 am: 0787c2ea35
am: 61ad248999

Change-Id: I98b56852873b9dca53e9780405e8d51abd9172b5
2017-10-23 23:13:19 +00:00
Jeff Vander Stoep
b1a921e24e hal_audio: remove access to audiohal_data_file
This is no longer used and violates Treble data separation.

Bug: 68057930
Test: verify on Sailfish that /data/misc/audiohal doesn't exist
    This dir appears to be Qualcomm specific and should not have
    been defined in core policy.

Change-Id: I55fba7564203a7f8a1d8612abd36ec1f89dc869d
2017-10-21 03:29:36 +00:00
Tri Vo
8dabc2ce74 Restrict netd fwk policy.
Remove netd access to sysfs_type attribute.

These were moved from vendor to fwk policy:
1. sysfs_net type declaration
2. labeling of /sys/devices/virtual/net with sysfs_net
3. netd access to sysfs_net

Bug: 65643247
Test: can browse internet without netd denials
Test: netd_unit_test, netd_integration_test without netd denials
Merged-In: Ic1b95a098f438c4c6bc969bee801bf7dd1a13f6e
Change-Id: Ic1b95a098f438c4c6bc969bee801bf7dd1a13f6e
(cherry picked from commit e62a56b717)
2017-10-20 22:07:01 +00:00
Tri Vo
e62a56b717 Restrict netd fwk policy.
Remove netd access to sysfs_type attribute.

These were moved from vendor to fwk policy:
1. sysfs_net type declaration
2. labeling of /sys/devices/virtual/net with sysfs_net
3. netd access to sysfs_net

Bug: 65643247
Test: can browse internet without netd denials
Test: netd_unit_test, netd_integration_test without netd denials
Change-Id: Ic1b95a098f438c4c6bc969bee801bf7dd1a13f6e
2017-10-17 14:46:47 -07:00
Tri Vo
1c166c6d83 Merge "Label system_server's dependencies in sysfs." am: 975efbe5d2 am: fb49dc5211 am: 8269fec076
am: 24f994bba7

Change-Id: I4656b8b13db086950040055f36c444bb01197de0
2017-10-15 05:49:31 +00:00
Tri Vo
1960215c49 Label system_server's dependencies in sysfs.
New types:
sysfs_android_usb
sysfs_ipv4
sysfs_power
sysfs_rtc
sysfs_switch
sysfs_wakeup_reasons

Labeled:
/sys/class/android_usb, /sys/devices/virtual/android_usb ->sysfs_android_usb
/sys/class/rtc -> sysfs_rtc
/sys/class/switch, /sys/devices/virtual/switch -> sysfs_switch
/sys/power/state, /sys/power/wakeup_count -> sysfs_power
/sys/kernel/ipv4 -> sysfs_ipv4
/sys/kernel/wakeup_reasons -> sysfs_wakeup_reasons

Removed access to sysfs and sysfs_type from system_server and added
appropriate access to new types.

Bug: 65643247
Test: sailfish boots without violation from system_server or to new labels.
Change-Id: I27250fd537d76c8226defa138d84fe2a4ce2d5d5
2017-10-12 14:51:20 -07:00
Tao Bao
488c4a6c68 Create sysfs_dm label. am: 5b4bea438a am: 28dca27ba2 am: a35083e015
am: 29c909ff34

Change-Id: Iba58bad1f82fbbb2221fbdb007a5c10d83925dfa
2017-10-11 17:13:43 +00:00
Tao Bao
5b4bea438a Create sysfs_dm label.
Prior to this CL, /sys/devices/virtual/block/dm-X was using the generic
sysfs label. This CL creates sysfs_dm label and grants the following
accesses:
 - update_verifier to read sysfs_dm dir and file at
   /sys/devices/virtual/block/dm-X.
 - vold to write sysfs_dm.

Bug: 63440407
Test: update_verifier successfully triggers blocks verification and
      marks a sucessful boot;
Test: No sysfs_dm related denials on sailfish.
Change-Id: I6349412707800f1bd3a2fb94d4fe505558400c95
2017-10-10 14:42:24 -07:00
Dan Cashman
eceee125d4 Merge "Remove reboot_data_file." am: f3f194c09a am: 9cac761df7 am: 17491f6b9c
am: 33edd89696

Change-Id: Iba4aba8833f3543d8e28c5d469667bbeb09b860e
2017-10-09 23:54:33 +00:00
Dan Cashman
76d0e4180a Remove reboot_data_file.
Bug: 64687998
Test: Builds.
Change-Id: I7a5b65d34382b8b76e55c523811a0f17dd9c1051
2017-10-09 14:25:10 -07:00
Tri Vo
cc5464fd7d Merge "Extend access to proc/asound/*" am: a045c854c5 am: bd435bf8e9 am: 32f7d8f89e
am: 16ef7ca87c

Change-Id: I1562fed1d63a80682684ff0dfaf6a3773eaf60f0
2017-10-06 20:10:25 +00:00
Tri Vo
464f59ae10 Extend access to proc/asound/*
Renamed this type:
proc_asound_cards -> proc_asound

Labeled /proc/asound/devices as proc_asound.

We now use proc_asound type to label files under /proc/asound which we
want to expose to system components.

Bug: 66988327
Test: Pixel 2 boots, can play sound with or without headphones, and
selinux denials to proc_asound are not seen.

Change-Id: I453d9bfdd70eb80931ec9e80f17c8fd0629db3d0
2017-10-06 10:29:03 -07:00
Dan Cashman
91d398d802 Sync internal master and AOSP sepolicy.
Bug: 37916906
Test: Builds 'n' boots.
Change-Id: Ia1d86264446ebecc1ca79f32f11354921bc77668
Merged-In: I208ec6a864127a059fb389417a9c6b259d7474cb
2017-09-26 14:38:47 -07:00