rr icon indicating copy to clipboard operation
rr copied to clipboard

Fix replay divergence with LeakSanitizer

Open Keno opened this issue 3 years ago • 2 comments

LeakSanitizer reads all writable memory regions of loaded shared libraries to find any pointer references that are still live at the end of the process (in order to be able to complain about the ones that are not, but were also not freed). Unfortunately, at the moment, this causes it to read the globals.in_replay flag, causing a divergence. Fix that by moving the in_replay flag to the rr page, which already differs between record/replay anyway (and is already excluded from scanning by LeakSanitizer, because it's not marked PF_W).

Keno avatar Aug 02 '22 20:08 Keno

Actually, the same issue applies to breakpoint_value, so I'll have to move that also.

Keno avatar Aug 02 '22 23:08 Keno

Actually, the same issue applies to breakpoint_value, so I'll have to move that also.

Just to keep track, I did that and the lsan test case works now. I didn't update the test case included here, because it's not super easy to predict when breakpoint_value would have generally been set, and it didn't always trigger with lsan either, but I think the test case will help prevent future regressions of people introducing divergent memory content into the PF_W mappings of any .sos.

Keno avatar Aug 03 '22 06:08 Keno

I've updated this to address the review comment. Sorry about the delay.

Keno avatar Sep 07 '22 08:09 Keno