blob: 0b717dcf0769e96aaafa482ab07af128d5999e26 [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute dumpstate coredomain;
Primiano Tucci2f998092021-01-07 17:12:21 +00002type dumpstate_tmpfs, file_type;
Alex Klyubinf5446eb2017-03-23 14:27:32 -07003
dcashmancc39f632016-07-22 13:13:11 -07004init_daemon_domain(dumpstate)
5
6# Execute and transition to the vdc domain
7domain_auto_trans(dumpstate, vdc_exec, vdc)
dcashman2e00e632016-10-12 14:58:09 -07008
Chris Morin1d88bf52022-02-12 13:52:39 -08009# Create tmpfs files for using memfd descriptors to get output from child
10# processes.
11tmpfs_domain(dumpstate)
12
Joel Scherpelz5e901bb2017-04-25 11:53:51 +090013# Acquire advisory lock on /system/etc/xtables.lock from ip[6]tables
14allow dumpstate system_file:file lock;
15
ynwange68d2d22016-07-01 12:18:54 -070016allow dumpstate storaged_exec:file rx_file_perms;
17
Hongming Jin58f83412021-02-09 12:03:40 -080018# /data/misc/a11ytrace for accessibility traces
19userdebug_or_eng(`
20 allow dumpstate accessibility_trace_data_file:dir r_dir_perms;
21 allow dumpstate accessibility_trace_data_file:file r_file_perms;
22')
23
Vishnu Nair2d6942d2017-11-17 08:23:32 -080024# /data/misc/wmtrace for wm traces
25userdebug_or_eng(`
26 allow dumpstate wm_trace_data_file:dir r_dir_perms;
27 allow dumpstate wm_trace_data_file:file r_file_perms;
28')
29
Jeff Sharkeyef5e5c82023-02-06 14:25:48 -070030# /data/system/dropbox for dropbox entries
31userdebug_or_eng(`
32 allow dumpstate dropbox_data_file:dir r_dir_perms;
33 allow dumpstate dropbox_data_file:file r_file_perms;
34')
35
Ted Bauereaeb65f2024-07-01 19:36:21 +000036r_dir_file(dumpstate, aconfig_storage_metadata_file);
Ted Bauereaeb65f2024-07-01 19:36:21 +000037
Mike Made3a3e42018-12-03 10:35:40 -080038# Allow dumpstate to make binder calls to incidentd
39binder_call(dumpstate, incidentd)
40
ThiƩbaud Weksteen3b1c8432023-01-04 12:57:11 +110041# Kill incident in case of a timeout
42allow dumpstate incident:process { signal sigkill };
43
ynwange68d2d22016-07-01 12:18:54 -070044# Allow dumpstate to make binder calls to storaged service
45binder_call(dumpstate, storaged)
Keun-young Park43e8fae2017-03-03 13:13:25 -080046
Yao Chenb10ff332018-01-17 16:17:28 -080047# Allow dumpstate to make binder calls to statsd
48binder_call(dumpstate, statsd)
49
Joel Galenson7c275a62018-11-13 12:35:17 -080050# Allow dumpstate to talk to gpuservice over binder
51binder_call(dumpstate, gpuservice);
52
Joel Galenson657470a2018-12-05 11:01:04 -080053# Allow dumpstate to talk to idmap over binder
54binder_call(dumpstate, idmap);
55
Alex Hong906c7242020-11-10 14:12:38 +080056# Allow dumpstate to talk to profcollectd over binder
57userdebug_or_eng(`
58 binder_call(dumpstate, profcollectd)
59')
60
Changyeon Jo152a2f12023-09-26 18:44:35 +000061# Allow dumpstate to talk to automotive_display_service over binder
62binder_call(dumpstate, automotive_display_service)
63
Jan Sebechlebskyde644172023-11-30 10:57:16 +010064# Allow dumpstate to talk to virtual_camera service over binder
65binder_call(dumpstate, virtual_camera)
66
Kangping Donge1ee7682023-12-01 13:02:38 +080067# Allow dumpstate to talk to ot_daemon service over binder
68binder_call(dumpstate, ot_daemon)
69
Hung Nguyen3a75cd62025-03-17 12:50:31 -070070# Allow dumpstate to talk to mmd service over binder
71binder_call(dumpstate, mmd)
72
Keun-young Park43e8fae2017-03-03 13:13:25 -080073# Collect metrics on boot time created by init
74get_prop(dumpstate, boottime_prop)
Andreas Gampe7468db62018-01-24 17:56:25 -080075
Steven Moreland9f41fc02024-02-16 22:38:26 +000076get_prop(dumpstate, misctrl_prop)
77
Andreas Gampe7468db62018-01-24 17:56:25 -080078# Signal native processes to dump their stack.
79allow dumpstate {
Chong Zhang81f5b9f2020-10-15 12:38:30 -070080 mediatranscoding
Andreas Gampe7468db62018-01-24 17:56:25 -080081 statsd
Chalard Jeana4c9f7b2019-04-05 17:33:56 +090082 netd
Jan Sebechlebskyde644172023-11-30 10:57:16 +010083 virtual_camera
Kangping Donge1ee7682023-12-01 13:02:38 +080084 ot_daemon
Andreas Gampe7468db62018-01-24 17:56:25 -080085}:process signal;
Joel Galenson03ff9f92018-02-14 14:32:38 -080086
David Drysdalee1075f72023-03-17 12:21:32 +000087# Only allow dumpstate to dump Keystore on debuggable builds.
Eric Biggersf9519a62021-05-04 20:59:32 -070088userdebug_or_eng(`
89 allow dumpstate keystore:process signal;
90')
David Drysdalee1075f72023-03-17 12:21:32 +000091dontaudit dumpstate keystore:process { signal };
Eric Biggersf9519a62021-05-04 20:59:32 -070092
Joel Galenson03ff9f92018-02-14 14:32:38 -080093# For collecting bugreports.
Hridya Valsaraju23f9f512021-05-04 22:01:51 -070094no_debugfs_restriction(`
95 allow dumpstate debugfs_wakeup_sources:file r_file_perms;
96')
97
Joel Galenson03ff9f92018-02-14 14:32:38 -080098allow dumpstate dev_type:blk_file getattr;
99allow dumpstate webview_zygote:process signal;
Hridya Valsaraju6217b662021-01-10 21:09:37 -0800100allow dumpstate sysfs_dmabuf_stats:file r_file_perms;
Joel Galenson03ff9f92018-02-14 14:32:38 -0800101dontaudit dumpstate update_engine:binder call;
Alistair Delva2bbf1ce2020-12-02 16:04:12 -0800102
103# Read files in /proc
104allow dumpstate {
Steven Moreland832dc372023-12-21 01:22:13 +0000105 config_gz
Alistair Delva2bbf1ce2020-12-02 16:04:12 -0800106 proc_net_tcp_udp
107 proc_pid_max
108}:file r_file_perms;
Joe Onorato5536a082018-12-07 17:20:14 -0800109
110# For comminucating with the system process to do confirmation ui.
111binder_call(dumpstate, incidentcompanion_service)
David Andersondc2a7872019-09-06 14:52:21 -0700112
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900113# Set properties.
114# dumpstate_prop is used to share state with the Shell app.
115set_prop(dumpstate, dumpstate_prop)
116set_prop(dumpstate, exported_dumpstate_prop)
117
118# dumpstate_options_prop is used to pass extra command-line args.
119set_prop(dumpstate, dumpstate_options_prop)
120
121# Allow dumpstate to kill vendor dumpstate service by init
122set_prop(dumpstate, ctl_dumpstate_prop)
123
David Andersondc2a7872019-09-06 14:52:21 -0700124# For dumping dynamic partition information.
125set_prop(dumpstate, lpdumpd_prop)
126binder_call(dumpstate, lpdumpd)
David Anderson14eaa6c2019-09-09 17:52:06 -0700127
Enrico Granata645c3902021-10-01 13:11:36 -0600128# For dumping hypervisor information.
129get_prop(dumpstate, hypervisor_prop)
130
David Anderson14eaa6c2019-09-09 17:52:06 -0700131# For dumping device-mapper and snapshot information.
132allow dumpstate gsid_exec:file rx_file_perms;
133set_prop(dumpstate, ctl_gsid_prop)
134binder_call(dumpstate, gsid)
Yifan Hong91709db2019-10-29 14:12:16 -0700135
Devin Moore96456572024-01-31 17:48:43 +0000136#Allow access to /dev/binderfs/binder_logs
Steven Moreland248f0e02024-05-17 22:30:40 +0000137userdebug_or_eng(`
138 allow dumpstate binderfs_logs_transactions:file r_file_perms;
139')
Steven Moreland496f08d2024-06-03 19:30:04 +0000140dontaudit dumpstate binderfs_logs_transactions:file r_file_perms;
Steven Moreland9956cdf2024-05-23 19:38:57 +0000141allow dumpstate binderfs_logs_transaction_history:file r_file_perms;
Devin Moore96456572024-01-31 17:48:43 +0000142
Yifan Hong91709db2019-10-29 14:12:16 -0700143r_dir_file(dumpstate, ota_metadata_file)
Primiano Tucci2f998092021-01-07 17:12:21 +0000144
145# For starting (and killing) perfetto --save-for-bugreport. If a labelled trace
146# is being recorded, the command above will serialize it into
147# /data/misc/perfetto-traces/bugreport/*.pftrace .
148domain_auto_trans(dumpstate, perfetto_exec, perfetto)
149allow dumpstate perfetto:process signal;
150allow dumpstate perfetto_traces_data_file:dir { search };
151allow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms;
152allow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink };
153
154# When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null
155# (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport
156# zip file. These rules are to allow perfetto.te to inherit dumpstate's
157# /dev/null.
158allow perfetto dumpstate_tmpfs:file rw_file_perms;
159allow perfetto dumpstate:fd use;
Ramji Jiyani3b59a532022-03-11 21:21:57 +0000160
161# system_dlkm_file for /system_dlkm partition
162allow dumpstate system_dlkm_file:dir getattr;
MƄrten Kongstad098e9092022-09-20 14:19:30 +0200163
164# Allow dumpstate to execute derive_sdk in its own domain
165domain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk)
Inseob Kim75806ef2024-03-27 17:18:41 +0900166
167net_domain(dumpstate)
168binder_use(dumpstate)
169wakelock_use(dumpstate)
170
171# Allow setting process priority, protect from OOM killer, and dropping
172# privileges by switching UID / GID
173allow dumpstate self:global_capability_class_set { setuid setgid sys_resource };
174
175# Allow dumpstate to scan through /proc/pid for all processes
176r_dir_file(dumpstate, domain)
177
178allow dumpstate self:global_capability_class_set {
179 # Send signals to processes
180 kill
181 # Run iptables
182 net_raw
183 net_admin
184};
185
186# Allow executing files on system, such as:
187# /system/bin/toolbox
188# /system/bin/logcat
189# /system/bin/dumpsys
190allow dumpstate system_file:file execute_no_trans;
191not_full_treble(`allow dumpstate vendor_file:file execute_no_trans;')
192allow dumpstate toolbox_exec:file rx_file_perms;
193
194# hidl searches for files in /system/lib(64)/hw/
195allow dumpstate system_file:dir r_dir_perms;
196
197# Create and write into /data/anr/
198allow dumpstate self:global_capability_class_set { dac_override dac_read_search chown fowner fsetid };
199allow dumpstate anr_data_file:dir rw_dir_perms;
200allow dumpstate anr_data_file:file create_file_perms;
201
202# Allow reading /data/system/uiderrors.txt
203# TODO: scope this down.
204allow dumpstate system_data_file:file r_file_perms;
205
206# Allow dumpstate to append into apps' private files.
ThiƩbaud Weksteen76f72612024-05-15 10:43:45 +1000207allow dumpstate app_data_file_type:file append;
Inseob Kim75806ef2024-03-27 17:18:41 +0900208
209# Read dmesg
210allow dumpstate self:global_capability2_class_set syslog;
211allow dumpstate kernel:system syslog_read;
212
213# Read /sys/fs/pstore/console-ramoops
214allow dumpstate pstorefs:dir r_dir_perms;
215allow dumpstate pstorefs:file r_file_perms;
216
217# Get process attributes
218allow dumpstate domain:process getattr;
219
220# Signal java processes to dump their stack
221allow dumpstate { appdomain system_server zygote app_zygote }:process signal;
222
223# Signal native processes to dump their stack.
224allow dumpstate {
225 # This list comes from native_processes_to_dump in dumputils/dump_utils.c
226 audioserver
227 cameraserver
228 drmserver
229 inputflinger
230 mediadrmserver
231 mediaextractor
232 mediametrics
233 mediaserver
234 mediaswcodec
235 sdcardd
236 surfaceflinger
237 vold
238
239 # This list comes from hal_interfaces_to_dump in dumputils/dump_utils.c
240 evsmanagerd
241 hal_audio_server
242 hal_audiocontrol_server
243 hal_bluetooth_server
244 hal_broadcastradio_server
245 hal_camera_server
246 hal_codec2_server
247 hal_drm_server
248 hal_evs_server
249 hal_face_server
250 hal_fingerprint_server
251 hal_graphics_allocator_server
252 hal_graphics_composer_server
253 hal_health_server
254 hal_input_processor_server
255 hal_neuralnetworks_server
256 hal_omx_server
257 hal_power_server
258 hal_power_stats_server
259 hal_sensors_server
260 hal_thermal_server
261 hal_vehicle_server
262 hal_vr_server
263 system_suspend_server
264}:process signal;
265
ThiƩbaud Weksteen4164a5a2024-06-13 12:04:53 +1000266# On userdebug, dumpstate may fork and execute a command as su. Make sure the
267# timeout logic is allowed to terminate the child process if necessary.
268userdebug_or_eng(`
269 allow dumpstate su:process { signal sigkill };
270')
271
Inseob Kim75806ef2024-03-27 17:18:41 +0900272# Connect to tombstoned to intercept dumps.
273unix_socket_connect(dumpstate, tombstoned_intercept, tombstoned)
274
275# Access to /sys
276allow dumpstate sysfs_type:dir r_dir_perms;
277
278allow dumpstate {
279 sysfs_devices_block
280 sysfs_dm
281 sysfs_loop
282 sysfs_usb
283 sysfs_zram
284}:file r_file_perms;
285
286# Ignore other file access under /sys.
287dontaudit dumpstate sysfs:file r_file_perms;
288
289# Other random bits of data we want to collect
290no_debugfs_restriction(`
291 allow dumpstate debugfs:file r_file_perms;
292 auditallow dumpstate debugfs:file r_file_perms;
293
294 allow dumpstate debugfs_mmc:file r_file_perms;
295')
296
297# df for
298allow dumpstate {
299 block_device
300 cache_file
301 metadata_file
302 rootfs
303 selinuxfs
304 storage_file
305 tmpfs
306}:dir { search getattr };
307allow dumpstate fuse_device:chr_file getattr;
308allow dumpstate { dm_device cache_block_device }:blk_file getattr;
309allow dumpstate { cache_file rootfs }:lnk_file { getattr read };
310
311# Read /dev/cpuctl and /dev/cpuset
312r_dir_file(dumpstate, cgroup)
313r_dir_file(dumpstate, cgroup_v2)
314
315# Allow dumpstate to make binder calls to any binder service
316binder_call(dumpstate, binderservicedomain)
317binder_call(dumpstate, { appdomain artd netd wificond })
318
319# Allow dumpstate to call dump() on specific hals.
320dump_hal(hal_audio)
321dump_hal(hal_audiocontrol)
322dump_hal(hal_authgraph)
323dump_hal(hal_authsecret)
324dump_hal(hal_bluetooth)
325dump_hal(hal_broadcastradio)
326dump_hal(hal_camera)
327dump_hal(hal_codec2)
328dump_hal(hal_contexthub)
329dump_hal(hal_drm)
330dump_hal(hal_dumpstate)
331dump_hal(hal_evs)
332dump_hal(hal_face)
333dump_hal(hal_fingerprint)
334dump_hal(hal_gnss)
335dump_hal(hal_graphics_allocator)
336dump_hal(hal_graphics_composer)
337dump_hal(hal_health)
338dump_hal(hal_identity)
339dump_hal(hal_input_processor)
340dump_hal(hal_keymint)
341dump_hal(hal_light)
342dump_hal(hal_memtrack)
343dump_hal(hal_neuralnetworks)
344dump_hal(hal_nfc)
345dump_hal(hal_oemlock)
346dump_hal(hal_power)
347dump_hal(hal_power_stats)
348dump_hal(hal_rebootescrow)
349dump_hal(hal_secretkeeper)
350dump_hal(hal_sensors)
351dump_hal(hal_thermal)
352dump_hal(hal_vehicle)
Nikita Ioffe439563f2024-12-10 18:33:22 +0000353dump_hal(hal_vm_capabilities)
Inseob Kim75806ef2024-03-27 17:18:41 +0900354dump_hal(hal_weaver)
355dump_hal(hal_wifi)
356
357# Vibrate the device after we are done collecting the bugreport
358hal_client_domain(dumpstate, hal_vibrator)
359
360# Reading /proc/PID/maps of other processes
361allow dumpstate self:global_capability_class_set sys_ptrace;
362
363# Allow the bugreport service to create a file in
364# /data/data/com.android.shell/files/bugreports/bugreport
365allow dumpstate shell_data_file:dir create_dir_perms;
366allow dumpstate shell_data_file:file create_file_perms;
367
368# Run a shell.
369allow dumpstate shell_exec:file rx_file_perms;
370
371# For running am and similar framework commands.
372# Run /system/bin/app_process.
373allow dumpstate zygote_exec:file rx_file_perms;
374
375# For Bluetooth
376allow dumpstate bluetooth_data_file:dir search;
377allow dumpstate bluetooth_logs_data_file:dir r_dir_perms;
378allow dumpstate bluetooth_logs_data_file:file r_file_perms;
379
380# For Nfc
381allow dumpstate nfc_logs_data_file:dir r_dir_perms;
382allow dumpstate nfc_logs_data_file:file r_file_perms;
383
Nattharat Jariyanuntanaetdd2e2ba2024-05-15 08:16:16 +0000384# For uwb
385allow dumpstate apex_module_data_file:dir search;
386allow dumpstate apex_system_server_data_file:dir search;
387allow dumpstate apex_uwb_data_file:dir r_dir_perms;
388allow dumpstate apex_uwb_data_file:file r_file_perms;
389
Inseob Kim75806ef2024-03-27 17:18:41 +0900390# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access
391allow dumpstate gpu_device:chr_file rw_file_perms;
392allow dumpstate gpu_device:dir r_dir_perms;
393
394# logd access
395read_logd(dumpstate)
396control_logd(dumpstate)
397read_runtime_log_tags(dumpstate)
398
399# Read files in /proc
400allow dumpstate {
Alessio Balsini419f7a72024-12-11 13:43:58 +0000401 proc_allocinfo
Inseob Kim75806ef2024-03-27 17:18:41 +0900402 proc_bootconfig
403 proc_buddyinfo
404 proc_cmdline
405 proc_meminfo
406 proc_modules
407 proc_net_type
408 proc_pipe_conf
409 proc_pagetypeinfo
Bart Searsdbca6252024-08-04 23:06:24 +0000410 proc_qtaguid_ctrl
411 proc_qtaguid_stat
Inseob Kim75806ef2024-03-27 17:18:41 +0900412 proc_slabinfo
413 proc_version
414 proc_vmallocinfo
415 proc_vmstat
416}:file r_file_perms;
417
418# Read network state info files.
419allow dumpstate net_data_file:dir search;
420allow dumpstate net_data_file:file r_file_perms;
421
422# List sockets via ss.
Bo Huaa577262024-12-01 21:14:32 +0000423allow dumpstate self:netlink_tcpdiag_socket { create_socket_perms_no_ioctl nlmsg_read };
Inseob Kim75806ef2024-03-27 17:18:41 +0900424
425# Access /data/tombstones.
426allow dumpstate tombstone_data_file:dir r_dir_perms;
427allow dumpstate tombstone_data_file:file r_file_perms;
428
429# Access /cache/recovery
430allow dumpstate cache_recovery_file:dir r_dir_perms;
431allow dumpstate cache_recovery_file:file r_file_perms;
432
433# Access /data/misc/recovery
434allow dumpstate recovery_data_file:dir r_dir_perms;
435allow dumpstate recovery_data_file:file r_file_perms;
436
437# Access /data/misc/update_engine & /data/misc/update_engine_log
438allow dumpstate { update_engine_data_file update_engine_log_data_file }:dir r_dir_perms;
439allow dumpstate { update_engine_data_file update_engine_log_data_file }:file r_file_perms;
440# Access /data/misc/snapuserd_log
441allow dumpstate snapuserd_log_data_file:dir r_dir_perms;
442allow dumpstate snapuserd_log_data_file:file r_file_perms;
443
444# Access /data/misc/profiles/{cur,ref}/
445userdebug_or_eng(`
446 allow dumpstate { user_profile_root_file user_profile_data_file}:dir r_dir_perms;
447 allow dumpstate user_profile_data_file:file r_file_perms;
448')
449
450# Access /data/misc/logd
451allow dumpstate misc_logd_file:dir r_dir_perms;
452allow dumpstate misc_logd_file:file r_file_perms;
453
454# Access /data/misc/prereboot
455allow dumpstate prereboot_data_file:dir r_dir_perms;
456allow dumpstate prereboot_data_file:file r_file_perms;
457
458allow dumpstate app_fuse_file:dir r_dir_perms;
459allow dumpstate overlayfs_file:dir r_dir_perms;
460
461allow dumpstate {
462 service_manager_type
463 -apex_service
464 -dumpstate_service
465 -gatekeeper_service
466 -hal_service_type
467 -virtual_touchpad_service
468 -vold_service
Weston Carvalho75c1d8b2025-01-06 17:59:18 -0600469 -fwk_vold_service
Inseob Kim75806ef2024-03-27 17:18:41 +0900470 -default_android_service
471}:service_manager find;
472# suppress denials for services dumpstate should not be accessing.
473dontaudit dumpstate {
474 apex_service
475 dumpstate_service
476 gatekeeper_service
477 hal_service_type
478 virtual_touchpad_service
479 vold_service
Weston Carvalho75c1d8b2025-01-06 17:59:18 -0600480 fwk_vold_service
Inseob Kim75806ef2024-03-27 17:18:41 +0900481}:service_manager find;
482
483# Most of these are neverallowed.
484dontaudit dumpstate hwservice_manager_type:hwservice_manager find;
485
486allow dumpstate servicemanager:service_manager list;
487allow dumpstate hwservicemanager:hwservice_manager list;
488
489allow dumpstate devpts:chr_file rw_file_perms;
490
491# Read any system properties
492get_prop(dumpstate, property_type)
493
494# Access to /data/media.
495# This should be removed if sdcardfs is modified to alter the secontext for its
496# accesses to the underlying FS.
497allow dumpstate media_rw_data_file:dir getattr;
498allow dumpstate proc_interrupts:file r_file_perms;
499allow dumpstate proc_zoneinfo:file r_file_perms;
500
501# Create a service for talking back to system_server
502add_service(dumpstate, dumpstate_service)
503
504# use /dev/ion for screen capture
505allow dumpstate ion_device:chr_file r_file_perms;
506
507# Allow dumpstate to run top
508allow dumpstate proc_stat:file r_file_perms;
509
510allow dumpstate proc_pressure_cpu:file r_file_perms;
511allow dumpstate proc_pressure_mem:file r_file_perms;
512allow dumpstate proc_pressure_io:file r_file_perms;
513
514# Allow dumpstate to run ps
515allow dumpstate proc_pid_max:file r_file_perms;
516
517# Allow dumpstate to talk to installd over binder
518binder_call(dumpstate, installd);
519
520# Allow dumpstate to run ip xfrm policy
Bo Hub55aaff2024-12-01 21:14:32 +0000521allow dumpstate self:netlink_xfrm_socket { create_socket_perms_no_ioctl nlmsg_read };
Inseob Kim75806ef2024-03-27 17:18:41 +0900522
523# Allow dumpstate to run iotop
524allow dumpstate self:netlink_socket create_socket_perms_no_ioctl;
525# newer kernels (e.g. 4.4) have a new class for sockets
526allow dumpstate self:netlink_generic_socket create_socket_perms_no_ioctl;
527
528# Allow dumpstate to run ss
529allow dumpstate { domain pdx_channel_socket_type pdx_endpoint_socket_type }:socket_class_set getattr;
530
531# Allow dumpstate to read linkerconfig directory
532allow dumpstate linkerconfig_file:dir { read open };
533
534# For when dumpstate runs df
535dontaudit dumpstate {
536 mnt_vendor_file
537 mirror_data_file
538 mnt_user_file
539 mnt_product_file
540}:dir search;
541dontaudit dumpstate {
542 apex_mnt_dir
543 linkerconfig_file
544 mirror_data_file
545 mnt_user_file
Inseob Kim0b9625d2024-07-31 17:42:23 +0900546 vm_data_file
Inseob Kim75806ef2024-03-27 17:18:41 +0900547}:dir getattr;
548
Karthik Rathlavath91653c02024-12-06 13:13:24 +0530549#suppress denials for dumpstate to call vitualizationservice.
550dontaudit dumpstate virtualizationservice:binder { call };
551
Inseob Kim75806ef2024-03-27 17:18:41 +0900552# Allow dumpstate to talk to bufferhubd over binder
553binder_call(dumpstate, bufferhubd);
554
555# Allow dumpstate to talk to mediaswcodec over binder
556binder_call(dumpstate, mediaswcodec);
557
558#Access /data/misc/snapshotctl_log
559allow dumpstate snapshotctl_log_data_file:dir r_dir_perms;
560allow dumpstate snapshotctl_log_data_file:file r_file_perms;
561
562#Allow access to /dev/binderfs/binder_logs
563allow dumpstate binderfs_logs:dir r_dir_perms;
564allow dumpstate binderfs_logs:file r_file_perms;
565allow dumpstate binderfs_logs_proc:file r_file_perms;
566allow dumpstate binderfs_logs_stats:file r_file_perms;
567
568use_apex_info(dumpstate)
569
570# Allow reading files under /data/system/shutdown-checkpoints/
571allow dumpstate shutdown_checkpoints_system_data_file:dir r_dir_perms;
572allow dumpstate shutdown_checkpoints_system_data_file:file r_file_perms;
573
574###
575### neverallow rules
576###
577
578# dumpstate has capability sys_ptrace, but should only use that capability for
579# accessing sensitive /proc/PID files, never for using ptrace attach.
580neverallow dumpstate *:process ptrace;
581
582# only system_server, dumpstate, traceur_app and shell can find the dumpstate service
583neverallow {
584 domain
585 -system_server
586 -shell
587 -traceur_app
588 -dumpstate
589} dumpstate_service:service_manager find;
Nattharat Jariyanuntanaetdd2e2ba2024-05-15 08:16:16 +0000590
591# only dumpstate, system_server and related others to access apex_uwb_data_file
592neverallow {
593 domain
594 -dumpstate
595 -system_server
596 -apexd
597 -init
598 -vold_prepare_subdirs
599} apex_uwb_data_file:dir no_rw_file_perms;
600neverallow {
601 domain
602 -dumpstate
603 -system_server
604 -apexd
605 -init
606 -vold_prepare_subdirs
607} apex_uwb_data_file:file no_rw_file_perms;