exynos4210_uart.c: SIGSEGV when loadvm
Host environment
- Operating system: macOS 11.6
- OS/kernel version: (For POSIX hosts, use
uname -a
) Darwin hostname 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64 - Architecture: (x86, ARM, s390x, etc.): ARM64
- QEMU flavor: (qemu-system-x86_64, qemu-aarch64, qemu-img, etc.): qemu-system-aarch64
- QEMU version: (e.g.
qemu-system-x86_64 --version
): v6.1.0 - QEMU command line:
Emulated/Virtualized environment
- Operating system: (Windows 10 21H1, Fedora 34, etc.)
- OS/kernel version: (For POSIX guests, use
uname -a
.) - Architecture: (x86, ARM, s390x, etc.) ARM64
Description of problem
Line 619 of hw/char/exynos4210_uart.c cast the object incorrectly.
The function will be called with Exynos4210UartFIFO as opaque because it is set as vmstate_exynos4210_uart_fifo.post_load
Patch suggestion
Line 619 should be changed to
Exynos4210UartState *s = container_of(opaque, Exynos4210UartState, rx);
or set vmstate_exynos4210_uart.post_load
to exynos4210_uart_post_load
instead of setting vmstate_exynos4210_uart_fifo.post_load
Steps to reproduce
- Create a VM with exynos4210_uart
- savevm
- loadvm
Additional information
Edited by TrungNguyen1909