From 3fd2b30c378ba8624363869d28ce357aa2c14e87 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Sat, 9 Aug 2025 20:22:56 +0900 Subject: [PATCH] Fix mach64 driver crash Due to lack of iopl(3), mach64 driver crashes when ior(BUS_CNTL) is called. Since BUS_CNTL is out of the range 0x0000-0x03ff, ioperm(0, 1024, 1) is not sufficient and the ior() causes access violation. This patch reintroduce iopl(3) call in the function hwEnableIO(). Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1110521 Fixes: a0f738a67327 ("Fixed ioperm calls in hwEnableIO") Signed-off-by: Takashi Yano Part-of: (cherry picked from commit 3b39aebf984bf2d5a32fd2372d658dd1abef05d2) --- hw/xfree86/os-support/linux/lnx_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 8ff0f0bc5..6591d7000 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -123,8 +123,8 @@ hwEnableIO(void) char *buf=NULL, target[5]; FILE *fp; - if (ioperm(0, 1024, 1)) { - ErrorF("xf86EnableIO: failed to enable I/O ports 0000-03ff (%s)\n", + if (ioperm(0, 1024, 1) || iopl(3)) { + ErrorF("xf86EnableIO: failed to enable I/O ports access (%s)\n", strerror(errno)); return FALSE; }