From 439608bfb012c2e147afa7f79ae15d9208e9a83a Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Tue, 2 Mar 2021 16:50:16 +0100 Subject: [PATCH] init.rc: set up a tracing instance for BootReceiver.java This instance will be used to monitor the error_report_end tracing events sent by kernel tools in the case of a memory corruption. Bug: 172316664 Bug: 181778620 Test: manual runs with KFENCE enabled Signed-off-by: Alexander Potapenko Change-Id: Ibc5cd3b60fb99030cc55db6b490d6d4bbbca3963 --- rootdir/init.rc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 04e954e31..0e1e98b84 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -620,6 +620,15 @@ on late-fs # Load trusted keys from dm-verity protected partitions exec -- /system/bin/fsverity_init --load-verified-keys + # Set up a tracing instance for system_server to monitor error_report_end events. + # These are sent by kernel tools like KASAN and KFENCE when a memory corruption + # is detected. + mkdir /sys/kernel/tracing/instances/bootreceiver 0700 system system + restorecon_recursive /sys/kernel/tracing/instances/bootreceiver + write /sys/kernel/tracing/instances/bootreceiver/buffer_size_kb 1 + write /sys/kernel/tracing/instances/bootreceiver/trace_options disable_on_free + write /sys/kernel/tracing/instances/bootreceiver/events/error_report/error_report_end/enable 1 + on post-fs-data mark_post_data