Skip to content
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

Don't use env::current_exe with libbacktrace #33554

Merged
merged 1 commit into from
May 14, 2016

Conversation

sfackler
Copy link
Member

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault at best.

cc #21889

r? @alexcrichton
cc @semarie

// down that executable this is. We can't use env::current_exe because
// libbacktrace will break in unboundedly horrible ways if the file at that
// path doesn't actually correspond to this process at the time we look at
// it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate here and indicate that it's a security concern for not reading an arbitrary executable? Basically emphasize the facts of:

  • You can probably trick current_exe to point at any file, or rather that's the worst case.
  • There's been at least one bug reported in libbacktrace for corrupt dwarf info
  • We don't know of any other vulnerabilities, but at worse we assume that arbitrary code execution is possible with corrupt dwarf info to libbacktrace (until we find evidence to the contrary)

And thus we don't pass a pathname to libbacktrace

@semarie
Copy link
Contributor

semarie commented May 11, 2016

I agree with the comment of @alexcrichton.

I expect also some tests should be marked ignored for some platforms (like run-pass/backtrace.rs for example).

@sfackler
Copy link
Member Author

Updated. I fixed run-pass/backtrace-debuginfo.rs - I guess we'll let the builders find out what other tests need to be fixed.

@alexcrichton
Copy link
Member

@bors: r+ 9c2e691

Manishearth added a commit to Manishearth/rust that referenced this pull request May 12, 2016
…hton

Don't use env::current_exe with libbacktrace

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc rust-lang#21889

r? @alexcrichton
cc @semarie
@nagisa
Copy link
Member

nagisa commented May 12, 2016

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc rust-lang#21889
@sfackler
Copy link
Member Author

Thanks, fixed.

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented May 12, 2016

📌 Commit 9393e52 has been approved by alexcrichton

eddyb added a commit to eddyb/rust that referenced this pull request May 13, 2016
…hton

Don't use env::current_exe with libbacktrace

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc rust-lang#21889

r? @alexcrichton
cc @semarie
@sfackler sfackler added the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 14, 2016
Manishearth added a commit to Manishearth/rust that referenced this pull request May 14, 2016
…hton

Don't use env::current_exe with libbacktrace

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc rust-lang#21889

r? @alexcrichton
cc @semarie
bors added a commit that referenced this pull request May 14, 2016
Rollup of 9 pull requests

- Successful merges: #33544, #33552, #33554, #33555, #33560, #33566, #33572, #33574, #33576
- Failed merges:
@bors bors merged commit 9393e52 into rust-lang:master May 14, 2016
@sfackler sfackler deleted the no-current-exe branch May 15, 2016 16:32
@alexcrichton alexcrichton added the beta-accepted Accepted for backporting to the compiler in the beta channel. label May 16, 2016
@alexcrichton
Copy link
Member

Accepted for backport at libs triage

aturon added a commit that referenced this pull request May 17, 2016
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 18, 2016
// be in "permanent memory", so we copy it to a static and then use the
// static as the pointer.
// Things don't work so well on not-Linux since libbacktrace can't track
// down that executable this is. We at one point used env::current_exe but
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this meant to say: "down what executable this is. ..." ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants