]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #54265 - arielb1:civilize-proc-macros, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 22 Sep 2018 11:56:08 +0000 (11:56 +0000)
committerbors <bors@rust-lang.org>
Sat, 22 Sep 2018 11:56:08 +0000 (11:56 +0000)
avoid leaking host details in proc macro metadata decoding

proc macro crates are essentially implemented as dynamic libraries using
a dlopen-based ABI. They are also Rust crates, so they have 2 worlds -
the "host" world in which they are defined, and the "target" world in
which they are used.

For all the "target" world knows, the proc macro crate might not even
be implemented in Rust, so leaks of details from the host to the target
must be avoided for correctness.

Because the "host" DefId space is different from the "target" DefId
space, any leak involving a DefId will have a nonsensical or
out-of-bounds DefKey, and will cause all sorts of crashes.

This PR fixes all leaks I have found in `decoder`. In particular, #54059
was caused by host native libraries leaking into the target, which feels
like it might even be a correctness issue if it doesn't cause an ICE.

Fixes #54059

1  2 
src/librustc_metadata/cstore_impl.rs

Simple merge