| Message ID | 20241030111601.284064-1-Yash.Shinde@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | cargo: Increase RUST_MIN_STACK size to avoid SIGSEGV in DEBUG builds only. | expand |
Adding the log file for more details.
On 2024-10-30 7:16 a.m., Yash.Shinde@windriver.com wrote: > From: Yash Shinde<Yash.Shinde@windriver.com> > > For some Rust crates, like building p384 in DEBUG mode, a SIGSEGV > is encountered as follows: > > note: rustc unexpectedly overflowed its stack! this is a bug > note: maximum backtrace depth reached, frames may have been lost > note: we would appreciate a report athttps://github.com/rust-lang/rust > note: backtrace dumped due to SIGSEGV! resuming signal > error: could not compile `p384` (lib) > > WARNING: Backtrace (BB generated script): > #1: oe_cargo_build, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 193 > #2: cargo_do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 165 > #3: do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 160 > #4: main, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 206 > > Setting RUST_MIN_STACK to 8MB conditionally for DEBUG builds only handles > the stack overflow and SIGSEGV. s/to 8MB/from 2MB to 8MB/ Best to explain what the current default value in your commit log in case the rust devs increase the limit some day. From: rust.git on
On 30-10-2024 19:54, Randy MacLeod wrote: > On 2024-10-30 7:16 a.m., Yash.Shinde@windriver.com wrote: >> From: Yash Shinde<Yash.Shinde@windriver.com> >> >> For some Rust crates, like building p384 in DEBUG mode, a SIGSEGV >> is encountered as follows: >> >> note: rustc unexpectedly overflowed its stack! this is a bug >> note: maximum backtrace depth reached, frames may have been lost >> note: we would appreciate a report athttps://github.com/rust-lang/rust >> note: backtrace dumped due to SIGSEGV! resuming signal >> error: could not compile `p384` (lib) >> >> WARNING: Backtrace (BB generated script): >> #1: oe_cargo_build, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 193 >> #2: cargo_do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 165 >> #3: do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 160 >> #4: main, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 206 >> >> Setting RUST_MIN_STACK to 8MB conditionally for DEBUG builds only handles >> the stack overflow and SIGSEGV. > > s/to 8MB/from 2MB to 8MB/ > > Best to explain what the current default value in your commit log in > case the rust devs increase the limit some day. > > From: > rust.git on
On 2024-10-31 5:35 a.m., Yash Shinde wrote: > > On 30-10-2024 19:54, Randy MacLeod wrote: >> On 2024-10-30 7:16 a.m., Yash.Shinde@windriver.com wrote: >>> From: Yash Shinde<Yash.Shinde@windriver.com> >>> >>> For some Rust crates, like building p384 in DEBUG mode, a SIGSEGV >>> is encountered as follows: >>> >>> note: rustc unexpectedly overflowed its stack! this is a bug >>> note: maximum backtrace depth reached, frames may have been lost >>> note: we would appreciate a report >>> athttps://github.com/rust-lang/rust >>> note: backtrace dumped due to SIGSEGV! resuming signal >>> error: could not compile `p384` (lib) >>> >>> WARNING: Backtrace (BB generated script): >>> #1: oe_cargo_build, >>> /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, >>> line 193 >>> #2: cargo_do_compile, >>> /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, >>> line 165 >>> #3: do_compile, >>> /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, >>> line 160 >>> #4: main, >>> /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, >>> line 206 >>> >>> Setting RUST_MIN_STACK to 8MB conditionally for DEBUG builds only >>> handles >>> the stack overflow and SIGSEGV. >> >> s/to 8MB/from 2MB to 8MB/ >> >> Best to explain what the current default value in your commit log in >> case the rust devs increase the limit some day. >> >> From: >> rust.git on
On 31-10-2024 19:32, Randy MacLeod wrote: > > We discussed this issue and agreed that since it doesn't affect YP AB > since there are no DEBUG builds done there > and more importantly since it's really a work-around rather than a > fix, we'll continue to work with upstream p384 > crate owners to resolve the issue. Forcing users to change the stack > size, even for debug builds, is not a good policy > and hopefully some of the code-generation tools that are inputs to > p384 can be adjusted to reduce stack usage. > > ../Randy > This issue is now fixed by removing unused mut variables in p384 crate and thus reducing the codegen. (https://github.com/RustCrypto/elliptic-curves/commit/7652c5842cde60acc1e739ebbba34614cb158f8b) The current stable version of the RustCrypto p384 crate is v0.13.0, which is also the default version for building with Rust. But, the fix has been merged into the pre-release versions "p384/v0.14.0-pre.2" and "p384/v0.14.0-pre.1." of p384 crate. I have opened a discussion thread in p384 crate: https://github.com/RustCrypto/elliptic-curves/discussions/1102 to ask the crate developers either to update p384 crate into new version with the fix, or backport it to "v.0.13.0". We can wait for upstream unless someone wants to merge a patch for master now. Let me know your thoughts on this. Regards, Yash
On Thu, 2024-11-14 at 16:32 +0530, Yash Shinde via lists.openembedded.org wrote: > > On 31-10-2024 19:32, Randy MacLeod wrote: > > > > We discussed this issue and agreed that since it doesn't affect YP AB > > since there are no DEBUG builds done there > > and more importantly since it's really a work-around rather than a > > fix, we'll continue to work with upstream p384 > > crate owners to resolve the issue. Forcing users to change the stack > > size, even for debug builds, is not a good policy > > and hopefully some of the code-generation tools that are inputs to > > p384 can be adjusted to reduce stack usage. > > > > ../Randy > > > This issue is now fixed by removing unused mut variables in p384 crate > and thus reducing the codegen. > (https://github.com/RustCrypto/elliptic-curves/commit/7652c5842cde60acc1e739ebbba34614cb158f8b) > > The current stable version of the RustCrypto p384 crate is v0.13.0, > which is also the default version for building with Rust. > But, the fix has been merged into the pre-release versions > "p384/v0.14.0-pre.2" and "p384/v0.14.0-pre.1." of p384 crate. > > I have opened a discussion thread in p384 crate: > https://github.com/RustCrypto/elliptic-curves/discussions/1102 > to ask the crate developers either to update p384 crate into new version > with the fix, or backport it to "v.0.13.0". > > We can wait for upstream unless someone wants to merge a patch for > master now. Let me know your thoughts on this. Firstly, big thanks for working through this. Getting issues like this fixed at source in the upstream is infinitely preferable to carrying weird workarounds. I think it should be fine to wait for the upstream change to filter through to us? Cheers, Richard
diff --git a/meta/recipes-devtools/rust/cargo_1.79.0.bb b/meta/recipes-devtools/rust/cargo_1.79.0.bb index 123032cdf7..4917b25c0c 100644 --- a/meta/recipes-devtools/rust/cargo_1.79.0.bb +++ b/meta/recipes-devtools/rust/cargo_1.79.0.bb @@ -37,6 +37,9 @@ do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" do_compile:prepend () { export RUSTC_BOOTSTRAP="1" + if [ "${DEBUG_BUILD}" = "1" ]; then + export RUST_MIN_STACK=8388608 + fi } do_install () {