Skip to content

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

Closed
@FauxFaux

Description

@FauxFaux

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions