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

[BUG] libuv makes sim/macOS crash #15228

Open
1 task done
yamt opened this issue Dec 17, 2024 · 1 comment
Open
1 task done

[BUG] libuv makes sim/macOS crash #15228

yamt opened this issue Dec 17, 2024 · 1 comment
Labels
Arch: simulator Issues related to the SIMulator OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working

Comments

@yamt
Copy link
Contributor

yamt commented Dec 17, 2024

Description / Steps to reproduce the issue

libuv crashes (a NULL dereference) as the following on sim/macOS. (macOS 15.2, x86-64, Xcode 16.1)
that is, the constructor is called too early it seems.
while we have a mechanism to defer constructor calls on sim,
there are at least two problems:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa8)
  * frame #0: 0x0000000100007f15 nuttx`nxsched_get_stackinfo(pid=0, stackinfo=0x00007ff7bfee96d8) at sched_get_stackinfo.c:103:38
    frame #1: 0x000000010002e0d9 nuttx`tls_get_info at tls_getinfo.c:64:9
    frame #2: 0x000000010002e0a6 nuttx`task_get_info at task_getinfo.c:52:33
    frame #3: 0x000000010002b92c nuttx`atexit_register(type=4, func=(nuttx`uv_library_shutdown at uv-common.c:941), arg=0x0000000000000000, dso=0x0000000100113328) at lib_atexit.c:70:36
    frame #4: 0x000000010002bc4a nuttx`__cxa_atexit(func=(nuttx`uv_library_shutdown at uv-common.c:941), arg=0x0000000000000000, dso_handle=0x0000000100113328) at lib_atexit.c:270:10
    frame #5: 0x00000001000fccb8 nuttx`__GLOBAL_init_65535 + 24
    frame #6: 0x00007ff8045d2729 dyld`invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 241
    frame #7: 0x00007ff80460b4e9 dyld`invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 241
    frame #8: 0x00007ff8045ffb73 dyld`invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 543
    frame #9: 0x00007ff8045ba07b dyld`dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 249
    frame #10: 0x00007ff8045febe8 dyld`dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 176
    frame #11: 0x00007ff80460b0d4 dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 470
    frame #12: 0x00007ff8045d25c2 dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 150
    frame #13: 0x00007ff8045d8af7 dyld`dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 21
    frame #14: 0x00007ff8045d2928 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 276
    frame #15: 0x00007ff8045d6141 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const + 147
    frame #16: 0x00007ff8045d29bc dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 90
    frame #17: 0x00007ff8045ee1f7 dyld`dyld4::APIs::runAllInitializersForMain() + 277
    frame #18: 0x00007ff8045bf52e dyld`dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3433
    frame #19: 0x00007ff8045be792 dyld`dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const + 572
    frame #20: 0x00007ff8045be27f dyld`start + 1727
(lldb)

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

macOS 15.2

NuttX Version

master

Issue Architecture

[Arch: simulator]

Issue Area

[Area: Other]

Verification

  • I have verified before submitting the report.
@yamt yamt added the Type: Bug Something isn't working label Dec 17, 2024
@github-actions github-actions bot added Arch: simulator Issues related to the SIMulator OS: Mac Issues related to MacOS (building system, etc) labels Dec 17, 2024
@yamt
Copy link
Contributor Author

yamt commented Dec 17, 2024

while it might not crash on linux, i suspect it's broken there as well because using nuttx atexit on sim startup seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: simulator Issues related to the SIMulator OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant