This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Restore stderr when using forkpty() to spawn external symbolizer
ClosedPublic

Authored by kubamracek on Nov 30 2015, 3:31 AM.

Details

Summary

In AtosSymbolizer, we're using forkpty() to create a new pseudo-terminal to communicate with the atos tool (we need that to avoid output buffering in interactive mode). This however redirects both stdout and stderr into a single stream, so when we read the output, we can't distinguish between errors and standard replies. Let's save&restore stderr to avoid that.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 41379.Nov 30 2015, 3:31 AM
kubamracek retitled this revision from to [sanitizer] Restore stderr when using forkpty() to spawn external symbolizer.
kubamracek updated this object.
kubamracek added reviewers: samsonov, glider, kcc, dvyukov.
kubamracek added subscribers: llvm-commits, zaks.anna.
dvyukov edited edge metadata.Nov 30 2015, 3:49 AM

LGTM with a nit

lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
95 ↗(On Diff #41379)

add close(saved_stderr) after this line just for completeness

This revision was automatically updated to reflect the committed changes.