File tree 8 files changed +46
-0
lines changed
8 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -973,6 +973,9 @@ get_prop(system_server, time_prop)
973
973
# on low memory kills.
974
974
get_prop(system_server, system_lmk_prop)
975
975
976
+ # Only system server can access BINDER_FREEZE
977
+ allowxperm system_server binder_device:chr_file ioctl { BINDER_FREEZE };
978
+
976
979
# ##
977
980
# ## Neverallow rules
978
981
# ##
@@ -1172,3 +1175,7 @@ neverallow system_server self:perf_event ~{ open write cpu kernel };
1172
1175
1173
1176
# Do not allow any domain other than init or system server to set the property
1174
1177
neverallow { domain -init -system_server } socket_hook_prop:property_service set;
1178
+
1179
+ # BINDER_FREEZE is used to block ipc transactions to frozen processes, so it
1180
+ # can be accessed by system_server only (b/143717177)
1181
+ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_FREEZE };
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ allow domain ashmem_libcutils_device:chr_file rw_file_perms;
80
80
# /dev/binder can be accessed by ... everyone! :)
81
81
allow { domain -hwservicemanager -vndservicemanager } binder_device:chr_file rw_file_perms;
82
82
83
+ # Restrict binder ioctls to an allowlist. Additional ioctl commands may be
84
+ # added to individual domains, but this sets safe defaults for all processes.
85
+ allowxperm domain binder_device:chr_file ioctl unpriv_binder_ioctls;
86
+
83
87
# /dev/binderfs needs to be accessed by everyone too!
84
88
allow domain binderfs:dir { getattr search };
85
89
allow domain binderfs_logs_proc:dir search;
Original file line number Diff line number Diff line change @@ -132,7 +132,11 @@ define(`BC_RELEASE', `0x40046306')
132
132
define(`BC_REPLY', `0x40406301')
133
133
define(`BC_REQUEST_DEATH_NOTIFICATION', `0x400c630e')
134
134
define(`BC_TRANSACTION', `0x40406300')
135
+ define(`BINDER_FREEZE', `0x400c620e')
136
+ define(`BINDER_GET_NODE_DEBUG_INFO', `0xc018620b')
137
+ define(`BINDER_GET_NODE_INFO_FOR_REF', `0xc018620c')
135
138
define(`BINDER_SET_CONTEXT_MGR', `0x40046207')
139
+ define(`BINDER_SET_CONTEXT_MGR_EXT', `0x4018620d')
136
140
define(`BINDER_SET_IDLE_PRIORITY', `0x40046206')
137
141
define(`BINDER_SET_IDLE_TIMEOUT', `0x40086203')
138
142
define(`BINDER_SET_MAX_THREADS', `0x40046205')
Original file line number Diff line number Diff line change @@ -66,3 +66,11 @@ PPPIOCGASYNCMAP PPPIOCSFLAGS PPPIOCGFLAGS PPPIOCGCALLINFO
66
66
PPPIOCBUNDLE PPPIOCGMPFLAGS PPPIOCSMPFLAGS PPPIOCSMPMTU
67
67
PPPIOCSMPMRU PPPIOCGCOMPRESSORS PPPIOCSCOMPRESSOR PPPIOCGIFNAME
68
68
}')
69
+
70
+ # unprivileged binder ioctls
71
+ define(`unpriv_binder_ioctls', `{
72
+ BINDER_WRITE_READ BINDER_SET_IDLE_TIMEOUT BINDER_SET_MAX_THREADS
73
+ BINDER_SET_IDLE_PRIORITY BINDER_SET_CONTEXT_MGR BINDER_THREAD_EXIT
74
+ BINDER_VERSION BINDER_GET_NODE_DEBUG_INFO BINDER_GET_NODE_INFO_FOR_REF
75
+ BINDER_SET_CONTEXT_MGR_EXT
76
+ }')
Original file line number Diff line number Diff line change @@ -973,6 +973,9 @@ get_prop(system_server, time_prop)
973
973
# on low memory kills.
974
974
get_prop(system_server, system_lmk_prop)
975
975
976
+ # Only system server can access BINDER_FREEZE
977
+ allowxperm system_server binder_device:chr_file ioctl { BINDER_FREEZE };
978
+
976
979
# ##
977
980
# ## Neverallow rules
978
981
# ##
@@ -1172,3 +1175,7 @@ neverallow system_server self:perf_event ~{ open write cpu kernel };
1172
1175
1173
1176
# Do not allow any domain other than init or system server to set the property
1174
1177
neverallow { domain -init -system_server } socket_hook_prop:property_service set;
1178
+
1179
+ # BINDER_FREEZE is used to block ipc transactions to frozen processes, so it
1180
+ # can be accessed by system_server only (b/143717177)
1181
+ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_FREEZE };
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ allow domain ashmem_libcutils_device:chr_file rw_file_perms;
80
80
# /dev/binder can be accessed by ... everyone! :)
81
81
allow { domain -hwservicemanager -vndservicemanager } binder_device:chr_file rw_file_perms;
82
82
83
+ # Restrict binder ioctls to an allowlist. Additional ioctl commands may be
84
+ # added to individual domains, but this sets safe defaults for all processes.
85
+ allowxperm domain binder_device:chr_file ioctl unpriv_binder_ioctls;
86
+
83
87
# /dev/binderfs needs to be accessed by everyone too!
84
88
allow domain binderfs:dir { getattr search };
85
89
allow domain binderfs_logs_proc:dir search;
Original file line number Diff line number Diff line change @@ -132,7 +132,11 @@ define(`BC_RELEASE', `0x40046306')
132
132
define(`BC_REPLY', `0x40406301')
133
133
define(`BC_REQUEST_DEATH_NOTIFICATION', `0x400c630e')
134
134
define(`BC_TRANSACTION', `0x40406300')
135
+ define(`BINDER_FREEZE', `0x400c620e')
136
+ define(`BINDER_GET_NODE_DEBUG_INFO', `0xc018620b')
137
+ define(`BINDER_GET_NODE_INFO_FOR_REF', `0xc018620c')
135
138
define(`BINDER_SET_CONTEXT_MGR', `0x40046207')
139
+ define(`BINDER_SET_CONTEXT_MGR_EXT', `0x4018620d')
136
140
define(`BINDER_SET_IDLE_PRIORITY', `0x40046206')
137
141
define(`BINDER_SET_IDLE_TIMEOUT', `0x40086203')
138
142
define(`BINDER_SET_MAX_THREADS', `0x40046205')
Original file line number Diff line number Diff line change @@ -66,3 +66,11 @@ PPPIOCGASYNCMAP PPPIOCSFLAGS PPPIOCGFLAGS PPPIOCGCALLINFO
66
66
PPPIOCBUNDLE PPPIOCGMPFLAGS PPPIOCSMPFLAGS PPPIOCSMPMTU
67
67
PPPIOCSMPMRU PPPIOCGCOMPRESSORS PPPIOCSCOMPRESSOR PPPIOCGIFNAME
68
68
}')
69
+
70
+ # unprivileged binder ioctls
71
+ define(`unpriv_binder_ioctls', `{
72
+ BINDER_WRITE_READ BINDER_SET_IDLE_TIMEOUT BINDER_SET_MAX_THREADS
73
+ BINDER_SET_IDLE_PRIORITY BINDER_SET_CONTEXT_MGR BINDER_THREAD_EXIT
74
+ BINDER_VERSION BINDER_GET_NODE_DEBUG_INFO BINDER_GET_NODE_INFO_FOR_REF
75
+ BINDER_SET_CONTEXT_MGR_EXT
76
+ }')
You can’t perform that action at this time.
0 commit comments