• jameslahm's avatar
    [sampler] Fix data race in Sampler::DoSample · 6e586b48
    jameslahm authored
    In Sampler::DoSample, we only guard SignalHandler::Installed before
    and Sampler::Stop may happen at the same time, which may cause SIGPROF
    signal handler was already restored before SIGPROF was emit and trigger
    profiling timer expired. This CL changes Sampler::DoSample to use
    SignalHandler::mutex() to guard the entire function and also change
    the mutex to recursive mutex.
    
    Bug: v8:12838
    Change-Id: I5195742ecdbade342986755233840d7be5d83c62
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3616429Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
    Commit-Queue: 王澳 <wangao.james@bytedance.com>
    Cr-Commit-Position: refs/heads/main@{#80308}
    6e586b48
sampler.cc 21.7 KB