#1110521 xserver-xorg-video-mach64: Xorg crashes with Segmentation fault at address 0x0

Package:
xserver-xorg-video-mach64
Source:
xserver-xorg-video-mach64
Description:
X.Org X server -- ATI Mach64 display driver
Submitter:
Takashi Yano
Date:
2025-08-09 11:55:02 UTC
Severity:
normal
#1110521#5
Date:
2025-08-07 15:11:08 UTC
From:
To:
Dear Maintainer,

When X is started with startx command on my old server (DELL PowerEdge 1500SC),
it immediately crashes with segmentation fault. If I reverted the related packages:
  * xserver-xorg-core
  * xserever-xorg-video-mach64
  * xserver-xorg-input-libinput
  * libinput10
  * libinput-bin
  * libwacom2
  * libwacom-bin
  * libwacom-common
to bullseye's ones, the problem disappears.

I think this is a problem of mach64_drv.so.6 but, this might be due
to ABI version change from 24 to 25.

#1110521#10
Date:
2025-08-08 14:12:09 UTC
From:
To:
I found the cause of the issue.

The problem is not in the xserver-xorg-video-mach64 package.
It is in xserver-xorg-core package. The following patch against
xserver-xorg-core package solves the issue.

The mach64 driver accesses to the io port BUS_CNTL(=0x4ca0).
So ioperm(0, 1024, 1) is not sufficient. iopl(3) is also
required as before (bullseye's version).

diff --git a/hw.orig/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index fd83022..2cc97cf 100644
--- a/hw.orig/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -122,7 +122,7 @@ hwEnableIO(void)
     char *buf=NULL, target[5];
     FILE *fp;

-    if (ioperm(0, 1024, 1)) {
+    if (ioperm(0, 1024, 1) || iopl(3)) {
         ErrorF("xf86EnableIO: failed to enable I/O ports 0000-03ff (%s)\n",
                strerror(errno));
         return FALSE;

#1110521#15
Date:
2025-08-09 11:53:45 UTC
From:
To:
I created a merge request for the upstream:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2052