tracing: Allocate mask_str buffer dynamically