Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uplibc.so.6 in project directory causes major problems #42851
Comments
Mark-Simulacrum
added
T-compiler
T-libs
labels
Jun 23, 2017
This comment has been minimized.
This comment has been minimized.
metux
commented
Jul 12, 2017
|
Why does the compile dlopen() anything from the source tree ? |
This comment has been minimized.
This comment has been minimized.
|
I had similar questions I wonder if I could ship a libc in a crates.io crate with a rewritten stub to the function it's trying to open to do random stuff on some users computer. |
This comment has been minimized.
This comment has been minimized.
|
Do you have |
This comment has been minimized.
This comment has been minimized.
|
It's not clear to me why the assumption is that this is coming from a |
This comment has been minimized.
This comment has been minimized.
|
No I do not have "." in my LD_LIBRARY. To make this even easier, please copy your libc.so.6 to some new cargo project, open this new libc in your favorite hex editor, zero out the elf header, run cargo clean followed by cargo build and it will report that libc.so.6 has an invalid header... |
This comment has been minimized.
This comment has been minimized.
|
I believe in this case it was assumed that dlopen was called because in the original report dlopen is explicitly mentioned as having a bad argument by rustc. Of course it may be some side effect, etc. But on two separate machines I can repro this fairly worrisome issue (e.g. Local libc used without messing with LD env variables), which suggests that dlopen is used |
This comment has been minimized.
This comment has been minimized.
|
What does the output of |
This comment has been minimized.
This comment has been minimized.
|
Ah I'm pretty sure this is caused by rustc using RPATH in dynamic array. Also I think this might be a security vulnerability EDIT: Actually not sure. Except that it's a problem |
This comment has been minimized.
This comment has been minimized.
|
I do not see this behavior with a stock x86_64-unknown-linux-gnu 1.18 release, for reference.
|
This comment has been minimized.
This comment has been minimized.
|
Something is setting LD path and it is not me. I believe it is cargo. Running strings on cargo shows that LD_LIB env variable is in the binary, and briefly grepping through source shows that it does collect a set of env variables, and LD_LIB is amongst them, which is even more worrisome. Unfortunately not in front of a computer at the moment, so can't paste output but someone sets LD variable to the rustup nightly toolchain (amongst other things) @sfackler are you not able to repro this ? |
This comment has been minimized.
This comment has been minimized.
|
What about nightly cargo ? |
This comment has been minimized.
This comment has been minimized.
And some output filtered to
So it looks reproducible at least with rustup on nightly. |
This comment has been minimized.
This comment has been minimized.
|
@sfackler could you paste entire output of LD_DEBUG=libs with and without libc.so.6 in project root directory ? |
sfackler
added
regression-from-stable-to-nightly
T-dev-tools
and removed
T-compiler
T-libs
labels
Jul 12, 2017
This comment has been minimized.
This comment has been minimized.
|
@jmesmon thank you, I was starting to think I was losing my mind ;) I'm sure it's a nightly issue now (cannot repro on stable) and that someone (cargo I'm looking at you since the variable mysteriously appears after control is transferred to the one in rustup directory) is setting the env variable |
This comment has been minimized.
This comment has been minimized.
|
Ok yeah it does look like nightly cargo is messing this up:
|
This comment has been minimized.
This comment has been minimized.
|
Sorry I don't really understand anything here, not sure how much help I'll be |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton the root of the issue is that cargo's started producing a weird LD_LIBRARY_PATH:
This in particular includes `` (i.e. the current directory), as well as |
This comment has been minimized.
This comment has been minimized.
|
In contrast, stable Cargo produces this LD_LIBRARY_PATH:
The fact that those |
This comment has been minimized.
This comment has been minimized.
|
I believe the tls and x86_64 |
This comment has been minimized.
This comment has been minimized.
|
Oh, weird! |
sfackler
referenced this issue
Jul 12, 2017
Closed
cargo inserts an empty path in LD_LIBRARY_PATH #4277
sfackler
added
regression-from-stable-to-beta
and removed
regression-from-stable-to-nightly
labels
Jul 13, 2017
This comment has been minimized.
This comment has been minimized.
|
This is also present on beta |
This comment has been minimized.
This comment has been minimized.
|
@Mark-Simulacrum can you bisect cargo prs? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I've "bisected" the change to #41978 , which did this update of cargo, which seems to confirm @mbrubeck 's suspicion. |
This comment has been minimized.
This comment has been minimized.
|
Note that when running without rustup, I can't reproduce the bug. |
This comment has been minimized.
This comment has been minimized.
|
Submitted PR rust-lang/cargo#4278. |
brson
assigned
alexcrichton
Jul 13, 2017
brson
added
the
P-high
label
Jul 13, 2017
This comment has been minimized.
This comment has been minimized.
|
Should be fixed on current beta. Can anyone confirm? |
This comment has been minimized.
This comment has been minimized.
|
Fixed for me! Great work! |
m4b commentedJun 23, 2017
Steps to repro:
cpalibc.so.6to your project directorycargo testorcargo buildThis might require an older libc.so.6, or something; looks like something is trying
dlopenthe version in my directory (also, why?), and the ABI is bad for whatever reason (just guessing).Original issue: das-labor/panopticon#304