From 7e357eb73177d08de45d815635a854ad93e2484d Mon Sep 17 00:00:00 2001 From: chenyc5 Date: Thu, 3 Nov 2022 09:57:47 +0800 Subject: [PATCH] Make bpf_attach_tracepoint() available as soon as possible The "sys.init.perf_lsm_hooks" is set on TestPerEventSelinux and it is before early-init, but it need trigger by queue_property_triggers and it is after late-init (zygote start on late-init). The property is ready on load_bpf_programs, make sure bpf_attach_tracepoint() is available on zygote start. Bug: 257102190 Test: cat /sys/fs/bpf/map_time_in_state_uid_time_in_state_map Change-Id: I5aa102df54b82e1584882800e93efd06ccf61c16 --- rootdir/init.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 123148e4d..1eec06139 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -1223,7 +1223,7 @@ on property:net.tcp_def_init_rwnd=* # controlling access. On older kernels, the paranoid value is the only means of # controlling access. It is normally 3 (allow only root), but the shell user # can lower it to 1 (allowing thread-scoped pofiling) via security.perf_harden. -on property:sys.init.perf_lsm_hooks=1 +on load_bpf_programs && property:sys.init.perf_lsm_hooks=1 write /proc/sys/kernel/perf_event_paranoid -1 on property:security.perf_harden=0 && property:sys.init.perf_lsm_hooks="" write /proc/sys/kernel/perf_event_paranoid 1