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

Today's nightly (stack probes) causes capnpc to segfault #43110

Closed
FauxFaux opened this issue Jul 7, 2017 · 2 comments
Closed

Today's nightly (stack probes) causes capnpc to segfault #43110

FauxFaux opened this issue Jul 7, 2017 · 2 comments

Comments

@FauxFaux
Copy link

FauxFaux commented Jul 7, 2017

When capnpc is called from a build script, it segfaults. This did not happen on yesterday's nightly. It doesn't seem to happen outside of build scripts. I don't get why that would be.

Testcase: https://github.com/FauxFaux/capnpc-segfault

You need capnp on your path (although it's irrelevant); apt install capnproto on recent Debian/Ubuntu.

% rustup run nightly-2017-07-06 cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs

% rustup run nightly cargo build 
   Compiling capnpc-segfault v0.1.0 (fi...t)
error: failed to run custom build command for `capnpc-segfault v0.1.0 (fi..t)`
process didn't exit successfully: `...lt/target/debug/build/c...4a/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)

% rustup run nightly rustc --version
rustc 1.20.0-nightly (696412de7 2017-07-06)
% OUT_DIR=/tmp RUST_BACKTRACE=1 rust-gdb --args target/debug/build/*/build-script-build /tmp
...
(gdb) bt
#0  0x000055555567f8ec in compiler_builtins::probestack::__rust_probestack () at /checkout/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/src/probestack.rs:55
#1  0x00005555555f0e31 in capnpc::codegen::generate_node (gen=0x0, node_id=0, node_name="", parent_node_id=core::option::Option::None) at /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/codegen.rs:1014
#2  0x00005555555f166d in capnpc::codegen::generate_node (gen=0x7fffffffc3f0, node_id=12947750709585725918, node_name="entry", parent_node_id=core::option::Option::None)
    at /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/codegen.rs:1030
#3  0x0000555555617988 in capnpc::codegen::main<std::process::ChildStdout> (inp=ChildStdout = {...}, out_dir=0x7ffff6c20038) at /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/codegen.rs:1846
#4  0x0000555555624b44 in capnpc::run_command (command=Command = {...}) at /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/lib.rs:76
#5  0x0000555555625849 in capnpc::CompilerCommand::run (self=0x7fffffffde30) at /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/lib.rs:162
#6  0x0000555555566831 in build_script_build::main () at build.rs:4

The faulting code looks pretty innocent, and we're only two frames down the recursion?

https://github.com/capnproto/capnpc-rust/blob/e775eec5af5eea77e8ed4919a647fab9fc877343/src/codegen.rs#L1019

Presumably related to 5dbd97d / #43052.

Happens on this machine:

  • Ubuntu Zesty (17.04); 4.10.0-26-generic #30-Ubuntu amd64, i7 Ivy-Bridge, 24GB RAM.

But not on:

  • Ubuntu Trusty (16.04); 4.4.0-79-generic #100-Ubuntu, amd64, E3-1 Xeon, 16GB RAM.

...presumably because the second machine has not been rebooted to pick up the stack guard fixes.

@est31
Copy link
Member

est31 commented Jul 7, 2017

I've got a similar issue, see #43102

@alexcrichton
Copy link
Member

Ah yes I believe this is the same as #43102 so I'm going to close in favor of that, but thanks for the report @FauxFaux!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants