commit | a3502b504d3c4868bd8716e00dd649101bbe3cb3 | [log] [tgz] |
---|---|---|
author | Primiano Tucci <primiano@google.com> | Mon Jun 29 11:28:58 2020 +0100 |
committer | Primiano Tucci <primiano@google.com> | Mon Jun 29 18:51:40 2020 +0100 |
tree | d9ecb9020b67dd91f7e83f6149a047e5b2a015fe | |
parent | ee1ad0698bf61f55a1da4a0bb4f84f8705f4c041 [diff] |
ftrace: fix pointer stability of events_ vector This fixes an extremely subtle bug which causes traced_probes to crash when tracing on some specific devices. The root cause of the bug is the fact that in rare cirumstances the events_ vector can be resized after construction, after some Event* poitners have been handed out, hence invalidating them. The rare circumstance is: - The trace config ends up hitting a "generic event" path, i.e. the ftrace event is not known at compile time but exists on the target device (note this is not that unlikely because the expansion of some atrace categories in ftrace_config_muxer.cc can end up adding events like sde/sde_cmd_release_bw which are not in the compile-time list. - The ftrace event ID of the generic event above is > than the max(ID of events known at compile time) - The vector resize() ends up hitting the unhappy realloc() path which changes the data() pointer and mem-copies everything, invalidating all pointers. Fix: use std::deque, which guarantees pointer stability. Bug: 159998308 Change-Id: Id21fabf0c940fd0e5302518c0170686d61aaf847 Merged-In: Id21fabf0c940fd0e5302518c0170686d61aaf847 (cherry picked from commit bd3e8ecca937a76318c68ec8e8da72cb5c0239ba) (cherry picked from commit 5cceb8adf772f3638577dea0d255b8bef3a743e5)
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://docs.perfetto.dev or the /docs/ directory for documentation.