Skip to content
Snippets Groups Projects
Commit 43303c8b authored by Jeff Vander Stoep's avatar Jeff Vander Stoep Committed by Jeffrey Vander Stoep
Browse files

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
parent 70d2bb43
No related branches found
No related tags found
No related merge requests found
...@@ -486,7 +486,9 @@ ...@@ -486,7 +486,9 @@
(typeattributeset proc_meminfo_26_0 (proc_meminfo)) (typeattributeset proc_meminfo_26_0 (proc_meminfo))
(typeattributeset proc_misc_26_0 (proc_misc)) (typeattributeset proc_misc_26_0 (proc_misc))
(typeattributeset proc_modules_26_0 (proc_modules)) (typeattributeset proc_modules_26_0 (proc_modules))
(typeattributeset proc_net_26_0 (proc_net)) (typeattributeset proc_net_26_0
( proc_net
proc_qtaguid_stat))
(typeattributeset proc_overcommit_memory_26_0 (proc_overcommit_memory)) (typeattributeset proc_overcommit_memory_26_0 (proc_overcommit_memory))
(typeattributeset proc_perf_26_0 (proc_perf)) (typeattributeset proc_perf_26_0 (proc_perf))
(typeattributeset proc_security_26_0 (proc_security)) (typeattributeset proc_security_26_0 (proc_security))
......
...@@ -17,6 +17,7 @@ genfscon proc /modules u:object_r:proc_modules:s0 ...@@ -17,6 +17,7 @@ genfscon proc /modules u:object_r:proc_modules:s0
genfscon proc /mounts u:object_r:proc_mounts:s0 genfscon proc /mounts u:object_r:proc_mounts:s0
genfscon proc /net u:object_r:proc_net:s0 genfscon proc /net u:object_r:proc_net:s0
genfscon proc /net/xt_qtaguid/ctrl u:object_r:qtaguid_proc:s0 genfscon proc /net/xt_qtaguid/ctrl u:object_r:qtaguid_proc:s0
genfscon proc /net/xt_qtaguid/ u:object_r:proc_qtaguid_stat:s0
genfscon proc /cpuinfo u:object_r:proc_cpuinfo:s0 genfscon proc /cpuinfo u:object_r:proc_cpuinfo:s0
genfscon proc /pagetypeinfo u:object_r:proc_pagetypeinfo:s0 genfscon proc /pagetypeinfo u:object_r:proc_pagetypeinfo:s0
genfscon proc /softirqs u:object_r:proc_timer:s0 genfscon proc /softirqs u:object_r:proc_timer:s0
......
...@@ -700,6 +700,7 @@ allow system_server ion_device:chr_file r_file_perms; ...@@ -700,6 +700,7 @@ allow system_server ion_device:chr_file r_file_perms;
r_dir_file(system_server, proc_asound) r_dir_file(system_server, proc_asound)
r_dir_file(system_server, proc_net) r_dir_file(system_server, proc_net)
r_dir_file(system_server, proc_qtaguid_stat)
allow system_server { allow system_server {
proc_loadavg proc_loadavg
proc_meminfo proc_meminfo
......
...@@ -171,11 +171,13 @@ userdebug_or_eng(` ...@@ -171,11 +171,13 @@ userdebug_or_eng(`
# Write to /proc/net/xt_qtaguid/ctrl file. # Write to /proc/net/xt_qtaguid/ctrl file.
allow appdomain qtaguid_proc:file rw_file_perms; allow appdomain qtaguid_proc:file rw_file_perms;
# read /proc/net/xt_qtguid/stats r_dir_file({ appdomain -ephemeral_app -isolated_app }, proc_net)
r_dir_file({ appdomain -ephemeral_app}, proc_net) # read /proc/net/xt_qtguid/*stat* to per-app network data usage.
# Exclude isolated app which may not use network sockets.
r_dir_file({ appdomain -isolated_app }, proc_qtaguid_stat)
# Everybody can read the xt_qtaguid resource tracking misc dev. # Everybody can read the xt_qtaguid resource tracking misc dev.
# So allow all apps to read from /dev/xt_qtaguid. # So allow all apps to read from /dev/xt_qtaguid.
allow appdomain qtaguid_device:chr_file r_file_perms; allow { appdomain -isolated_app } qtaguid_device:chr_file r_file_perms;
# Grant GPU access to all processes started by Zygote. # Grant GPU access to all processes started by Zygote.
# They need that to render the standard UI. # They need that to render the standard UI.
......
...@@ -12,6 +12,7 @@ type proc_overcommit_memory, fs_type; ...@@ -12,6 +12,7 @@ type proc_overcommit_memory, fs_type;
type usermodehelper, fs_type; type usermodehelper, fs_type;
type sysfs_usermodehelper, fs_type, sysfs_type; type sysfs_usermodehelper, fs_type, sysfs_type;
type qtaguid_proc, fs_type, mlstrustedobject; type qtaguid_proc, fs_type, mlstrustedobject;
type proc_qtaguid_stat, fs_type, mlstrustedobject;
type proc_bluetooth_writable, fs_type; type proc_bluetooth_writable, fs_type;
type proc_abi, fs_type; type proc_abi, fs_type;
type proc_asound, fs_type; type proc_asound, fs_type;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment