Perf profiler crashes under ASAN due to unaligned memory access
Describe the bug
ASAN detects multiple memory safety violations in perf_profile_connector.cc including stack buffer overflow and undefined behavior due to misaligned memory access. The ASAN crash reports that stack_trace_key_t structures require 8-byte alignment but are being accessed at misaligned addresses, causing undefined behavior when reading BPF map data.
To Reproduce Steps to reproduce the behavior:
- Build
stirling_wrapperwith--config asan - Run
stirling_wrapperwith default sources (includes PerfProfileConnector) - Let it run for ~2 minutes to allow perf profiler to collect stack traces
- Observe ASAN violations and program crash
Expected behavior The perf profiler should run successfully under ASAN and not exhibit memory safety issues
Screenshots N/A
Logs stirling_wrapper_asan_output_fastbuild.txt>
App information (please complete the following information):
- Pixie version: Development build (commit 1c39c87 from main)
- K8s cluster version: N/A (running stirling_wrapper standalone)
- Node Kernel version: Linux 6.14.0-1011-gcp
- Browser version: N/A
While I lost the logs, the proc_exit source connector also has the same unaligned memory access.