Smithay / drm-rs

A low-level abstraction of the Direct Rendering Manager API
MIT License
79 stars 53 forks source link

Fix unaligned memory access when reading DRM events #191

Closed tronical closed 7 months ago

tronical commented 7 months ago

Running with debug assertions enabled on armv7 (an stm32mp157) panics due to unaligned memory reads:

thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0xbec90b44', .../drm-0.9.0/src/control/mod.rs:906:34

Fix this by using the corresponding functions from core to safely copy the data (in C we'd do a memcpy).

Drakulix commented 7 months ago

Could you rebase this one as well please? :)

tronical commented 7 months ago

Done. Sorry, took a while :). The #[allow(unknown_lints)] #[allow(invalid_reference_casting)] is still there, as I'm not sure if they can be removed. How can I test?

Drakulix commented 7 months ago

Done. Sorry, took a while :). The #[allow(unknown_lints)] #[allow(invalid_reference_casting)] is still there, as I'm not sure if they can be removed. How can I test?

Just remove them and see if CI fails. If it does we need to add them again. (I think the error comes from different type-aliases on different platforms, so this is difficult to test outside of CI.)

Drakulix commented 7 months ago

Thanks!