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

p384 - signal: 11, SIGSEGV: invalid memory reference #906

Closed
sundeep-kokkonda opened this issue Jul 5, 2023 · 1 comment
Closed

p384 - signal: 11, SIGSEGV: invalid memory reference #906

sundeep-kokkonda opened this issue Jul 5, 2023 · 1 comment

Comments

@sundeep-kokkonda
Copy link

When the p384 crate compiling we are getting 'signal: 11, SIGSEGV: invalid memory reference' error. This issue is occurring on 32-bit architecture machines when doing DEBUG build.
Also, this issue is observed only when building this in Yocto. In rust tarball sources we couldn't reproduce the issue.

Below is the build command and error message.

**Build command:**
process didn't exit successfully: `rustc --crate-name p384 --edition=2021 /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/rustc-1.70.0-src/vendor/p384/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="arithmetic"' --cfg 'feature="default"' --cfg 'feature="digest"' --cfg 'feature="ecdh"' --cfg 'feature="ecdsa"' --cfg 'feature="ecdsa-core"' --cfg 'feature="pem"' --cfg 'feature="pkcs8"' --cfg 'feature="sha2"' --cfg 'feature="sha384"' --cfg 'feature="std"' -C metadata=d8c37f70a895ae9a -C extra-filename=-d8c37f70a895ae9a --out-dir /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/i686-poky-linux-gnu/debug/deps --target i686-poky-linux-gnu -C linker=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/wrapper/target-rust-ccld -L dependency=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/i686-poky-linux-gnu/debug/deps -L dependency=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/debug/deps --extern ecdsa_core=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/i686-poky-linux-gnu/debug/deps/libecdsa-e85642649bf0e7c9.rmeta --extern elliptic_curve=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/i686-poky-linux-gnu/debug/deps/libelliptic_curve-df69f4c85eaa7a64.rmeta --extern sha2=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/build/target/i686-poky-linux-gnu/debug/deps/libsha2-98350f9e69a514c9.rmeta --cap-lints allow -L /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot/usr/lib/rustlib/i686-poky-linux-gnu/lib --remap-path-prefix=/home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0=/usr/src/debug/cargo/1.70.0-r0` (signal: 11, SIGSEGV: invalid memory reference)

**Error:**
{"artifact":"./out-dir/p384-d8c37f70a895ae9a.d","emit":"dep-info"}
{"artifact":"./out-dir/libp384-d8c37f70a895ae9a.rmeta","emit":"metadata"}
...
...
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0xae9eb3)[0x7fcf8b8e9eb3]
| /home/work/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6(+0x376e0)[0x7fcf8aa976e0]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x2bff2d3)[0x7fcf8d9ff2d3]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1ad9d61)[0x7fcf8c8d9d61]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1ada845)[0x7fcf8c8da845]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1adb402)[0x7fcf8c8db402]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1adb402)[0x7fcf8c8db402]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1adb402)[0x7fcf8c8db402]
|... <<< same above line repeated several times >>> ...
|...
|...
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1adb402)[0x7fcf8c8db402]
| /home/work/poky/build/tmp/work/core2-32-poky-linux/cargo/1.70.0-r0/recipe-sysroot-native/usr/lib/librustc_driver-62e98be45f5bb4e6.so(+0x1adb402)[0x7fcf8c8db402]
| error: could not compile `p384` (lib)

We've tried to fix the issue and below 2 ways are fixing the linking problem for this crate but it has some side effects on rest of the build.

  1. From build command when the '-C debuginfo=2' option removed the linking is success for this package. (But the other crates are getting failed by some other errors referring the functions from this crate are not found in the scope. May be disabling the debug causing some missing info?)
  2. By keeping '-C debuginfo=2' and by removing the features 'arithmetic, ecdh, ecdsa & ecdsa-core' also making the package to link successfully. (Is there any way I can tell cargo to remove these features from this package and it's depending packages alone?)

Is this the issue in p384 when using debug / with these features?

@tarcieri
Copy link
Member

tarcieri commented Jul 7, 2023

This sounds like a potential bug in rustc. You probably want to report it upstream here: https://github.com/rust-lang/rust/issues

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

2 participants