Skip to content

virtio/console: Fixed libkrun panic caused by console resizing during VM startup#611

Open
ihexon wants to merge 4 commits intocontainers:mainfrom
ihexon:main
Open

virtio/console: Fixed libkrun panic caused by console resizing during VM startup#611
ihexon wants to merge 4 commits intocontainers:mainfrom
ihexon:main

Conversation

@ihexon
Copy link
Copy Markdown
Contributor

@ihexon ihexon commented Mar 31, 2026

when vm booting, and console resize happened, libkrun crash immediately:

thread '<unnamed>' (2610281) panicked at src/devices/src/virtio/console/event_handler.rs:115:44:index out of bounds: the len is 0 but the index is 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Before this fix, process() read self.queue_events[CONTROL_RXQ_INDEX] and self.queue_events[CONTROL_TXQ_INDEX] before checking self.is_activated().

If a spurious pre-activation event arrived(says console resize), queue_events was still empty and the handler could panic with an out-of-bounds index.

@ihexon ihexon changed the title virtio/console: fix index panic when process() is called before activate() virtio/console: Fixed libkrun panic caused by console resizing during VM startup Mar 31, 2026
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.

1 participant