Calling into weird address on Linux #525

Closed
opened 2022-09-10 16:38:04 +00:00 by iacore · 2 comments
iacore commented 2022-09-10 16:38:04 +00:00 (Migrated from github.com)

First, I patched mach to build with latest zig on linux.

Then, I ran zig build run-example-boids. A window pops up for 3 seconds, then the program crashed

Here's the backtrace.

134 ❯ lldb zig-out/bin/example-boids
(lldb) target create "zig-out/bin/example-boids"
Current executable set to '/home/user/computing/tool-other/mach/zig-out/bin/example-boids' (x86_64).
(lldb) r
Process 8368 launched: '/home/user/computing/tool-other/mach/zig-out/bin/example-boids' (x86_64)
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Process 8368 stopped
* thread #1, name = 'example-boids', stop reason = signal SIGSEGV: address access protected (fault address: 0xae5e90)
    frame #0: 0x0000000000ae5e90 example-boids`__unnamed_58
example-boids`__unnamed_58:
->  0xae5e90 <+0>: nop    
    0xae5e91 <+1>: inl    $0x90, %eax
    0xae5e93 <+3>: addb   %al, (%rax)
    0xae5e95 <+5>: addb   %al, (%rax)
(lldb) bt
* thread #1, name = 'example-boids', stop reason = signal SIGSEGV: address access protected (fault address: 0xae5e90)
  * frame #0: 0x0000000000ae5e90 example-boids`__unnamed_58
    frame #1: 0x00000000004492f9 example-boids`::APIRequestAdapter() at Instance.cpp:171:9
    frame #2: 0x0000000000908a49 example-boids`Platform.init [inlined] .app.gpu.dawn_impl.Interface.instanceRequestAdapter(instance=0x0000000000b62840, options=0x00007fffffffcb08, callback=0x0000000000ae5e90, userdata=0x00007fffffffcb20) at dawn_impl.zig:669:39
    frame #3: 0x0000000000908a0a example-boids`Platform.init [inlined] .app.gpu.instance.Instance.requestAdapter(instance=0x0000000000b62840, options=0x00007fffffffcb08, context=0x00007fffffffcb20) at instance.zig:51:36
    frame #4: 0x00000000009089d2 example-boids`Platform.init(allocator=std.mem.Allocator @ 0x00007fffffffe0a8, core=0x00007ffff7baf000) at native.zig:93:34
    frame #5: 0x00000000009060a6 example-boids`.app.mach.Core.init(allocator=std.mem.Allocator @ 0x00007fffffffe0a8, core=0x00007ffff7baf000) at Core.zig:41:43
    frame #6: 0x0000000000903625 example-boids`coreInit(allocator=std.mem.Allocator @ 0x00007fffffffe0a8) at native.zig:629:18
    frame #7: 0x00000000009031b9 example-boids`main at native.zig:608:28
    frame #8: 0x00000000009043b0 example-boids`std.start.main at start.zig:576:37
    frame #9: 0x00000000009043a4 example-boids`std.start.main [inlined] std.start.initEventLoopAndCallMain at start.zig:510:12
    frame #10: 0x00000000009043a4 example-boids`std.start.main [inlined] std.start.callMainWithArgs(argc=1, argv=0x00007fffffffe598, envp=[][*:0]u8 @ 0x00007fffffffe340) at start.zig:460:36
    frame #11: 0x0000000000904343 example-boids`std.start.main(c_argc=1, c_argv=0x00007fffffffe598, c_envp=0x00007fffffffe5a8) at start.zig:475:12
    frame #12: 0x00007ffff7bd32d0 libc.so.6`___lldb_unnamed_symbol3142 + 128
    frame #13: 0x00007ffff7bd338a libc.so.6`__libc_start_main + 138
    frame #14: 0x000000000042e9b5 example-boids`_start at start.S:115
First, I [patched mach to build with latest zig on linux](https://github.com/hexops/mach/pull/526). Then, I ran `zig build run-example-boids`. A window pops up for 3 seconds, then the program crashed Here's the backtrace. ``` 134 ❯ lldb zig-out/bin/example-boids (lldb) target create "zig-out/bin/example-boids" Current executable set to '/home/user/computing/tool-other/mach/zig-out/bin/example-boids' (x86_64). (lldb) r Process 8368 launched: '/home/user/computing/tool-other/mach/zig-out/bin/example-boids' (x86_64) MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0 Process 8368 stopped * thread #1, name = 'example-boids', stop reason = signal SIGSEGV: address access protected (fault address: 0xae5e90) frame #0: 0x0000000000ae5e90 example-boids`__unnamed_58 example-boids`__unnamed_58: -> 0xae5e90 <+0>: nop 0xae5e91 <+1>: inl $0x90, %eax 0xae5e93 <+3>: addb %al, (%rax) 0xae5e95 <+5>: addb %al, (%rax) (lldb) bt * thread #1, name = 'example-boids', stop reason = signal SIGSEGV: address access protected (fault address: 0xae5e90) * frame #0: 0x0000000000ae5e90 example-boids`__unnamed_58 frame #1: 0x00000000004492f9 example-boids`::APIRequestAdapter() at Instance.cpp:171:9 frame #2: 0x0000000000908a49 example-boids`Platform.init [inlined] .app.gpu.dawn_impl.Interface.instanceRequestAdapter(instance=0x0000000000b62840, options=0x00007fffffffcb08, callback=0x0000000000ae5e90, userdata=0x00007fffffffcb20) at dawn_impl.zig:669:39 frame #3: 0x0000000000908a0a example-boids`Platform.init [inlined] .app.gpu.instance.Instance.requestAdapter(instance=0x0000000000b62840, options=0x00007fffffffcb08, context=0x00007fffffffcb20) at instance.zig:51:36 frame #4: 0x00000000009089d2 example-boids`Platform.init(allocator=std.mem.Allocator @ 0x00007fffffffe0a8, core=0x00007ffff7baf000) at native.zig:93:34 frame #5: 0x00000000009060a6 example-boids`.app.mach.Core.init(allocator=std.mem.Allocator @ 0x00007fffffffe0a8, core=0x00007ffff7baf000) at Core.zig:41:43 frame #6: 0x0000000000903625 example-boids`coreInit(allocator=std.mem.Allocator @ 0x00007fffffffe0a8) at native.zig:629:18 frame #7: 0x00000000009031b9 example-boids`main at native.zig:608:28 frame #8: 0x00000000009043b0 example-boids`std.start.main at start.zig:576:37 frame #9: 0x00000000009043a4 example-boids`std.start.main [inlined] std.start.initEventLoopAndCallMain at start.zig:510:12 frame #10: 0x00000000009043a4 example-boids`std.start.main [inlined] std.start.callMainWithArgs(argc=1, argv=0x00007fffffffe598, envp=[][*:0]u8 @ 0x00007fffffffe340) at start.zig:460:36 frame #11: 0x0000000000904343 example-boids`std.start.main(c_argc=1, c_argv=0x00007fffffffe598, c_envp=0x00007fffffffe5a8) at start.zig:475:12 frame #12: 0x00007ffff7bd32d0 libc.so.6`___lldb_unnamed_symbol3142 + 128 frame #13: 0x00007ffff7bd338a libc.so.6`__libc_start_main + 138 frame #14: 0x000000000042e9b5 example-boids`_start at start.S:115 ```
emidoots commented 2022-09-10 18:41:46 +00:00 (Migrated from github.com)

Let me know if you experience any issues still after my suggestion: https://github.com/hexops/mach/pull/526#issuecomment-1242785391

Let me know if you experience any issues still after my suggestion: https://github.com/hexops/mach/pull/526#issuecomment-1242785391
iacore commented 2022-09-14 15:30:10 +00:00 (Migrated from github.com)

Yeah it works after updating

Yeah it works after updating
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#525
No description provided.