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

Winit library contains illegal instruction? #381

Closed
arianvp opened this issue Jan 9, 2018 · 4 comments
Closed

Winit library contains illegal instruction? #381

arianvp opened this issue Jan 9, 2018 · 4 comments

Comments

@arianvp
Copy link

arianvp commented Jan 9, 2018

When using Wayland, winit crashes since recently:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `target/release/testit'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x000055be86d1d3c6 in winit::platform::platform::x11::xdisplay::XConnection::new (
    error_handler=...)
    at /home/arian/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.7.6/src/platform/linux/x11/xdisplay.rs:56
56	    }

The code seems to emit a ud2 instruction which makes the CPU crash per definiton:

 │0x55be86d1d35c <winit::platform::platform::x11::xdisplay::XConnection::new+524> vmovups -0x1bd8(%rbp),%xmm0                   │
   │0x55be86d1d364 <winit::platform::platform::x11::xdisplay::XConnection::new+532> vmovups -0x1bc8(%rbp),%xmm1                   │
   │0x55be86d1d36c <winit::platform::platform::x11::xdisplay::XConnection::new+540> vmovaps %xmm1,-0x20(%rbp)                     │
   │0x55be86d1d371 <winit::platform::platform::x11::xdisplay::XConnection::new+545> movq   $0x1,(%rbx)                            │
   │0x55be86d1d378 <winit::platform::platform::x11::xdisplay::XConnection::new+552> vmovups %xmm0,0x8(%rbx)                       │
   │0x55be86d1d37d <winit::platform::platform::x11::xdisplay::XConnection::new+557> vmovaps -0x20(%rbp),%xmm0                     │
   │0x55be86d1d382 <winit::platform::platform::x11::xdisplay::XConnection::new+562> vmovups %xmm0,0x18(%rbx)                      │
   │0x55be86d1d387 <winit::platform::platform::x11::xdisplay::XConnection::new+567> mov    -0x1f8(%rbp),%rdi                      │
   │0x55be86d1d38e <winit::platform::platform::x11::xdisplay::XConnection::new+574> callq  0x55be86bd0250 <dlclose@plt>           │
   │0x55be86d1d393 <winit::platform::platform::x11::xdisplay::XConnection::new+579> mov    -0xe0(%rbp),%rdi                       │
   │0x55be86d1d39a <winit::platform::platform::x11::xdisplay::XConnection::new+586> callq  0x55be86bd0250 <dlclose@plt>           │
   │0x55be86d1d39f <winit::platform::platform::x11::xdisplay::XConnection::new+591> mov    -0x3d8(%rbp),%rdi                      │
   │0x55be86d1d3a6 <winit::platform::platform::x11::xdisplay::XConnection::new+598> callq  0x55be86bd0250 <dlclose@plt>           │
   │0x55be86d1d3ab <winit::platform::platform::x11::xdisplay::XConnection::new+603> mov    -0x33e0(%rbp),%rdi                     │
   │0x55be86d1d3b2 <winit::platform::platform::x11::xdisplay::XConnection::new+610> callq  0x55be86bd0250 <dlclose@plt>           │
   │0x55be86d1d3b7 <winit::platform::platform::x11::xdisplay::XConnection::new+615> mov    %rbx,%rax                              │
   │0x55be86d1d3ba <winit::platform::platform::x11::xdisplay::XConnection::new+618> add    $0x33d0,%rsp                           │
   │0x55be86d1d3c1 <winit::platform::platform::x11::xdisplay::XConnection::new+625> pop    %rbx                                   │
   │0x55be86d1d3c2 <winit::platform::platform::x11::xdisplay::XConnection::new+626> pop    %r14                                   │
   │0x55be86d1d3c4 <winit::platform::platform::x11::xdisplay::XConnection::new+628> pop    %rbp                                   │
   │0x55be86d1d3c5 <winit::platform::platform::x11::xdisplay::XConnection::new+629> retq                                          │
  >│0x55be86d1d3c6 <winit::platform::platform::x11::xdisplay::XConnection::new+630> ud2   
   ┌──/home/arian/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.7.6/src/platform/linux/x11/xdisplay.rs──────────────────┐
   │37                                                                                                                            │
   │38              // calling XOpenDisplay                                                                                       │
   │39              let display = unsafe {                                                                                        │
   │40                  let display = (xlib.XOpenDisplay)(ptr::null());                                                           │
   │41                  if display.is_null() {                                                                                    │
   │42                      return Err(XNotSupported::XOpenDisplayFailed);                                                        │
   │43                  }                                                                                                         │
   │44                  display                                                                                                   │
   │45              };                                                                                                            │
   │46                                                                                                                            │
   │47              Ok(XConnection {                                                                                              │
   │48                  xlib: xlib,                                                                                               │
   │49                  xf86vmode: xf86vmode,                                                                                     │
   │50                  xcursor: xcursor,                                                                                         │
   │51                  xinput2: xinput2,                                                                                         │
   │52                  xlib_xcb: xlib_xcb,                                                                                       │
   │53                  display: display,                                                                                         │
   │54                  latest_error: Mutex::new(None),                                                                           │
   │55              })                                                                                                            │
  >│56          }                                                                                                                 │
   │57              
@arianvp
Copy link
Author

arianvp commented Jan 9, 2018

After doing some googlling. the unreachable instruction is emitted by the rust compiler in certain scenarios:
rust-lang/rfcs#1454

@arianvp
Copy link
Author

arianvp commented Jan 9, 2018

I'm not sure why it is even reaching the X11 code in the first place. As I'm using Wayland.

@elinorbgr
Copy link
Contributor

Do you see the grey very basic borders draw by wayland-window? (with 3 rectangle green/yellow/red buttons ?)

If not, your winit is probably not finding your wayland compositor and falling back to x11 via Xwayland.

Regarding the actual issue, could this be the same as #376 ? If so cargo update should fix it.

@arianvp
Copy link
Author

arianvp commented Jan 24, 2018

It works now again. It was something with XWayland and my setup

@arianvp arianvp closed this as completed Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants