This is an archive of the discontinued LLVM Phabricator instance.

ELF: Only unlink regular files
ClosedPublic

Authored by tstellar on Jun 30 2017, 4:23 PM.

Details

Summary

If the output file is a character file (e.g. /dev/null) unlinking it could
potentially destabilize the user's system. For example,
unlinking causes lld %input -o /dev/null to replace /dev/null with a
regular file, which will lead to unexpected behavior in other programs
that read from /dev/null, and worse than expected peformance for
programs that write to /dev/null.

This makes it possible to run the test-release.sh script as root.
Prior to this patch, the ELF/basic.s test would replace
/dev/null with a regular file, which would cause crashes in llvm
test-suite programs that piped /dev/null to stdin.

For example, if you run the test-relase.sh script as root,

Diff Detail

Repository
rL LLVM

Event Timeline

tstellar created this revision.Jun 30 2017, 4:23 PM
ruiu accepted this revision.Jun 30 2017, 5:01 PM

LGTM, but are you using lld as root?

This revision is now accepted and ready to land.Jun 30 2017, 5:01 PM
In D34917#797509, @ruiu wrote:

LGTM, but are you using lld as root?

Yes, the automation system I'm using uses the root.

This revision was automatically updated to reflect the committed changes.