[sanitizer] Restore perf_event_attr handling.

This time in a forward/backward compatible way.