-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Backtracing] Support redirection to a named file. #79007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add the ability to specify a filename or directory name as the output-to setting in `SWIFT_BACKTRACE`. If the option is set to a directory name, generate a unique filename in that directory using the process name, process ID and timestamp. rdar://136977833
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you! 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any security worries here with, say, a suid root binary being told to write to a file the user doesn't have permission to touch, or can we count on the standard OS permissions to take care of it?
The backtracer will never run for a |
Mike rightly points out that it's possible for `open()` to fail with `EINTR`, which we should handle here. rdar://136977833
@swift-ci Please smoke test |
@swift-ci Please smoke test |
We should harden the output path setting so that it can't be used as part of an exploit to get a crashing process to overwrite a file at an attacker-controller path, or to divert the crash report to `/dev/null` to hide their tracks or other such undesirable activity. Take a copy of the setting at start-up and write-protect it to prevent attackers overwriting it. Note that we already protect against attempts to trigger the backtracer from privileged programs (both on Darwin and Linux); this is really a belt and braces measure to make life harder for attackers. rdar://136977833
451801e
to
6c7eda8
Compare
@swift-ci Please smoke test |
Add the ability to specify a filename or directory name as the output-to setting in
SWIFT_BACKTRACE
. If the option is set to a directory name, generate a unique filename in that directory using the process name, process ID and timestamp.rdar://136977833