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

AddressSanitizer stack-use-after-scope crash when running app #15165

Open
1 task done
qarmin opened this issue Jul 25, 2024 · 1 comment
Open
1 task done

AddressSanitizer stack-use-after-scope crash when running app #15165

qarmin opened this issue Jul 25, 2024 · 1 comment
Labels
bug [core label] linux

Comments

@qarmin
Copy link

qarmin commented Jul 25, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Zed - b56e4ff

When compiling app with nightly rust compiler + Address sanitizer, app crashes after opening:

  • This is profile.release in Cargo.toml - need to replace entire existing section
[profile.release]
overflow-checks = true
panic = "abort"
debug = true
  • compiling zed with address sanitizer + nightly compiler
rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu
RUSTFLAGS="-Zsanitizer=address" cargo +nightly install --path crates/zed --locked --target x86_64-unknown-linux-gnu
  • running app(asan options are needed to see debug symbols - still a little broken, but better than nothing)
export RUST_BACKTRACE=1
export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer-18) # also available addr2line, which will run 2 minutes, but will create better backtrace
export ASAN_OPTIONS=symbolize=1
zed

crashes when running with info

==181108==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7c82f37cc680 at pc 0x5b3faba39734 bp 0x7c82f49fbd60 sp 0x7c82f49fbd58
WRITE of size 8 at 0x7c82f37cc680 thread T14
    #0 0x5b3faba39733 in <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::size_hint /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/slice/iter/macros.rs:173
    #1 0x5b3faba39733 in <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::size_hint /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/adapters/enumerate.rs:56
    #2 0x5b3faba39733 in <cranelift_entity::iter::Iter<K,V> as core::iter::traits::iterator::Iterator>::size_hint /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-entity-0.106.2/src/iter.rs:37
    #3 0x5b3fab9bda12 in <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::size_hint /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/adapters/filter_map.rs:129
    #4 0x5b3fab9bda12 in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_from_iter_nested.rs:29
    #5 0x5b3fab9bda12 in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_from_iter.rs:33
    #6 0x5b3faba136b9 in <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/mod.rs:2971
    #7 0x5b3faba136b9 in core::iter::traits::iterator::Iterator::collect /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/traits/iterator.rs:2005
    #8 0x5b3faba136b9 in wasmtime_environ::module_environ::ModuleEnvironment::translate_payload /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-environ-19.0.2/src/module_environ.rs:229
    #9 0x5b3faba10317 in wasmtime_environ::module_environ::ModuleEnvironment::translate /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-environ-19.0.2/src/module_environ.rs:189
    #10 0x5b3faba4f85c in wasmtime_environ::component::translate::Translator::translate_payload /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-environ-19.0.2/src/component/translate.rs:533
    #11 0x5b3faba4f85c in wasmtime_environ::component::translate::Translator::translate /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-environ-19.0.2/src/component/translate.rs:330
    #12 0x5b3fab2ce5d1 in wasmtime::compile::build_component_artifacts /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-19.0.2/src/compile.rs:127
    #13 0x5b3fab2ce5d1 in wasmtime::runtime::component::component::Component::from_binary /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-19.0.2/src/runtime/component/component.rs:234
    #14 0x5b3fa5b235be in extension::wasm_host::WasmHost::load_extension::{{closure}} /home/rafal/test/zed/crates/extension/src/wasm_host.rs:117
    #15 0x5b3fa608c235 in <core::pin::Pin<P> as core::future::future::Future>::poll /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/future/future.rs:123
    #16 0x5b3fa608c235 in async_task::raw::RawTask<F,T,S,M>::run /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:557
    #17 0x5b3facbc1f75 in async_task::runnable::Runnable<M>::run /home/rafal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781
    #18 0x5b3facbc1f75 in gpui::platform::linux::dispatcher::LinuxDispatcher::new::{{closure}}::{{closure}} /home/rafal/test/zed/crates/gpui/src/platform/linux/dispatcher.rs:44
    #19 0x5b3facbc1f75 in std::sys::backtrace::__rust_begin_short_backtrace /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:155
    #20 0x5b3facf24e71 in std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}} /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:542
    #21 0x5b3facf24e71 in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/panic/unwind_safe.rs:272
    #22 0x5b3facf24e71 in std::panicking::try::do_call /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/panicking.rs:553
    #23 0x5b3facf24e71 in std::panicking::try /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/panicking.rs:517
    #24 0x5b3facf24e71 in std::panic::catch_unwind /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/panic.rs:350
    #25 0x5b3facf24e71 in std::thread::Builder::spawn_unchecked_::{{closure}} /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:541
    #26 0x5b3facf24e71 in core::ops::function::FnOnce::call_once{{vtable.shim}} /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/ops/function.rs:250
    #27 0x5b3faeae02ba in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/boxed.rs:2064
    #28 0x5b3faeae02ba in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/boxed.rs:2064
    #29 0x5b3faeae02ba in std::sys::pal::unix::thread::Thread::new::thread_start /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/pal/unix/thread.rs:108
    #30 0x5b3fa1479118 in asan_thread_start(void*) /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239
    #31 0x7c8302e9ca93 in start_thread nptl/./nptl/pthread_create.c:447
    #32 0x7c8302f29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Address 0x7c82f37cc680 is located in stack of thread T14 at offset 128 in frame
    #0 0x5b3fab9bd7bf in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_from_iter.rs:32

  This frame has 7 object(s):
    [32, 56) '_3.i10.i.i.i'
    [96, 104) 'f.i.i.i.i.i.i'
    [128, 152) '_3.i8.i' <== Memory access at offset 128 is inside this variable
    [192, 200) 'f.i.i.i.i'
    [224, 248) '_22.i'
    [288, 312) '_19.i'
    [352, 376) 'vector.i'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
Thread T14 created by T0 here:
    #0 0x5b3fa14611f1 in pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:250
    #1 0x5b3faeae00f1 in std::sys::pal::unix::thread::Thread::new /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/pal/unix/thread.rs:87
    #2 0x5b3facf23bb6 in std::thread::Builder::spawn_unchecked_ /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:581
    #3 0x5b3facf23bb6 in std::thread::Builder::spawn_unchecked /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:456
    #4 0x5b3facc83c58 in std::thread::Builder::spawn /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:388
    #5 0x5b3facc83c58 in std::thread::spawn /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/thread/mod.rs:698
    #6 0x5b3facc83c58 in gpui::platform::linux::dispatcher::LinuxDispatcher::new::{{closure}} /home/rafal/test/zed/crates/gpui/src/platform/linux/dispatcher.rs:40
    #7 0x5b3facc83c58 in core::iter::adapters::map::map_fold::{{closure}} /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/adapters/map.rs:89
    #8 0x5b3facc83c58 in core::iter::traits::iterator::Iterator::fold /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/traits/iterator.rs:2588
    #9 0x5b3facc83c58 in <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/adapters/map.rs:129
    #10 0x5b3faca73435 in core::iter::traits::iterator::Iterator::for_each /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/traits/iterator.rs:818
    #11 0x5b3faca73435 in alloc::vec::Vec<T,A>::extend_trusted /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/mod.rs:3107
    #12 0x5b3faca73435 in <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_extend.rs:26
    #13 0x5b3faca73435 in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_from_iter_nested.rs:62
    #14 0x5b3faca73435 in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/spec_from_iter.rs:33
    #15 0x5b3face17928 in <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/vec/mod.rs:2971
    #16 0x5b3face17928 in core::iter::traits::iterator::Iterator::collect /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/iter/traits/iterator.rs:2005
    #17 0x5b3face17928 in gpui::platform::linux::dispatcher::LinuxDispatcher::new /home/rafal/test/zed/crates/gpui/src/platform/linux/dispatcher.rs:54
    #18 0x5b3facd1401e in gpui::platform::linux::platform::LinuxCommon::new /home/rafal/test/zed/crates/gpui/src/platform/linux/platform.rs:110
    #19 0x5b3fac739b42 in gpui::platform::linux::x11::client::X11Client::new /home/rafal/test/zed/crates/gpui/src/platform/linux/x11/client.rs:177
    #20 0x5b3fac4b1288 in gpui::platform::current_platform /home/rafal/test/zed/crates/gpui/src/platform.rs:79
    #21 0x5b3fac503a79 in gpui::app::App::new /home/rafal/test/zed/crates/gpui/src/app.rs:115
    #22 0x5b3fa1ab4a09 in zed::main /home/rafal/test/zed/crates/zed/src/main.rs:305
    #23 0x5b3fa1a114c2 in core::ops::function::FnOnce::call_once /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/ops/function.rs:250
    #24 0x5b3fa1a114c2 in std::sys::backtrace::__rust_begin_short_backtrace /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:155
    #25 0x5b3fa187783b in std::rt::lang_start /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/rt.rs:158
    #26 0x7c8302e2a1c9 in __libc_start_call_main csu/../sysdeps/x86/libc-start.c:58
    #27 0x7c8302e2a28a in __libc_start_main_impl csu/../csu/libc-start.c:360
    #28 0x5b3fa13f66c4 in _start ??:?

SUMMARY: AddressSanitizer: stack-use-after-scope /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/slice/iter/macros.rs:173 in <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::size_hint

Environment

System:
  Host: rafal-komputer Kernel: 6.8.0-38-generic arch: x86_64 bits: 64
  Desktop: GNOME v: 46.0 Distro: Ubuntu 24.04 LTS (Noble Numbat)
CPU:
  Info: quad core model: Intel Core i7-4770 bits: 64 type: MT MCP cache:
    L2: 1024 KiB
  Speed (MHz): avg: 3592 min/max: 800/3900 cores: 1: 3592 2: 3592 3: 3592
    4: 3592 5: 3592 6: 3592 7: 3592 8: 3592
Graphics:
  Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
    driver: amdgpu v: kernel
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X:
    loaded: amdgpu unloaded: fbdev,modesetting,radeon,vesa dri: radeonsi
    gpu: amdgpu resolution: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: radeonsi,swrast platforms: x11,surfaceless,device
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 24.0.9-0ubuntu0.1
    renderer: AMD Radeon RX 570 Series (radeonsi polaris10 LLVM 17.0.6 DRM 3.57
    6.8.0-38-generic)
  API: Vulkan v: 1.3.275 drivers: N/A surfaces: xcb,xlib

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

@qarmin qarmin added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Jul 25, 2024
@maxdeviant
Copy link
Member

@qarmin Thanks for the report!

It seems like this might be something that needs to be reported to wasmtime.

@notpeter notpeter added linux and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jul 28, 2024
@github-actions github-actions bot added admin read Pending admin review triage Maintainer needs to classify the issue labels Nov 5, 2024
@notpeter notpeter removed triage Maintainer needs to classify the issue admin read Pending admin review labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] linux
Projects
None yet
Development

No branches or pull requests

3 participants