Page MenuHomePhabricator

[TSan] fix Go runtime test on amd64 with PIE

Authored by pelikan on Mar 3 2018, 11:01 AM.



Without this diff, the test segfaults. Examining the generated executable
(which gets auto-deleted likely by cmake/ninja) yields this error message:

ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12)

Note that the address has more than 47 bits, which on amd64 means special
treatment and therefore points out an overflow. The allocation came from
__tsan_map_shadow on a .data pointer, which (on my work Debian-based box)
means the 0x550000000000 range. This doesn't correspond to the constants
mentioned in tsan_platform.h for Go binaries on Linux/amd64.

The diff therefore allocates memory in the sort of area Go programs would,
and prevents the test from crashing. It would be nice if reviewers kindly
considered other setups and architectures :-)

Diff Detail


Event Timeline

pelikan created this revision.Mar 3 2018, 11:01 AM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptMar 3 2018, 11:01 AM
pelikan updated this revision to Diff 136927.Mar 3 2018, 11:19 AM

add errno printout, in case something goes wrong on the buildbots

dvyukov accepted this revision.Mar 15 2018, 3:20 AM

It actually fails on my laptop in the same way now. But works with this patch.

This revision is now accepted and ready to land.Mar 15 2018, 3:20 AM
pelikan updated this revision to Diff 138518.Mar 15 2018, 3:49 AM

sync to HEAD

pelikan updated this revision to Diff 138519.Mar 15 2018, 3:50 AM

sync again - something's wrong with Git

Harbormaster completed remote builds in B16111: Diff 138519.
pelikan updated this revision to Diff 138529.Mar 15 2018, 4:49 AM

sync again?

This revision was automatically updated to reflect the committed changes.