-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Backtracing] Support redirection to a named file. #79049
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
[Backtracing] Support redirection to a named file. #79049
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
Mike rightly points out that it's possible for `open()` to fail with `EINTR`, which we should handle here. rdar://136977833
Explanation: Adds support for redirection of crash logs to a named file or to a directory. |
@swift-ci Please test |
(I've got another changeset to add to this — some security hardening that I think is worthwhile. Just testing it now.) |
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
@swift-ci Please 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.
Very cool, was looking forward to this for a while! Glad you got to it so quickly :)
Missed there was an unaddressed issue
It looks like we aren't actually using it, so let's just delete it. rdar://136977833
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
@swift-ci Please test macOS platform |
Yes please, would love to have this for swift-java work when we crash sometimes and the outputs get jumbled together with java's crash :-) |
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