Skip to content

Fix stack overwrite in evdev mouse capability query - #16

Merged
alejandroqh merged 1 commit into
alejandroqh:mainfrom
atlury:fix/evdev-capability-buffer
Sep 28, 2026
Merged

alejandroqh merged 1 commit into
alejandroqh:mainfrom
atlury:fix/evdev-capability-buffer

Conversation

@atlury

@atlury atlury commented Sep 16, 2026

Copy link
Copy Markdown

Mouse discovery passes a two-byte buffer to EVIOCGBIT_REL (0x80084522), which encodes an eight-byte output size. On x86_64 Linux the ioctl can overwrite adjacent stack memory; starting framebuffer mode in a QEMU VM reproduced a segmentation fault. Allocate the full requested eight bytes.

Validation: all 51 upstream tests passed with cargo test --locked --no-default-features --features framebuffer-backend. The same correction was backported to a packaged 1.5.2 build and tested on x86_64 Linux 6.19.9: framebuffer startup and keyboard input inside a terminal window both passed.

EVIOCGBIT_REL requests eight output bytes. Reserve all eight so the kernel cannot overwrite adjacent stack memory during mouse discovery.
@alejandroqh
alejandroqh merged commit 39ca806 into alejandroqh:main Sep 28, 2026
@alejandroqh

Copy link
Copy Markdown
Owner

@atlury Thanks for the contribution this will be in the next release soon.

@atlury

atlury commented Sep 28, 2026

Copy link
Copy Markdown
Author

You are welcome, i was just testing it during a routine linux os work with yserver (xserver in rust)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants