On Tue, Oct 07, 2025 at 11:30:52AM +0100, Kevin Chadwick wrote:
> >Synopsis:    Xenodm Xorg segfault after 10s of minutes
> >Category:    amd64
> >Environment:
>       System      : OpenBSD 7.8
>       Details     : OpenBSD 7.8 (GENERIC) #51: Sun Oct  5 23:43:03 MDT 2025
>                        
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
> 
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:
>       Xenodm restarts due to a segfault in Xorg every 10 or 20 minutes
>       even when not used and even when trying a default fvwm session.
>       Has been happening for more than a few weeks, apparently.
>       
>       Two gdb backtraces follow of two separate Xorg.core files
> 
> Reading symbols from Xorg...
> [New process 286428]
> [New process 528228]
> Core was generated by `Xorg'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00000431d7e72f6d in pci_device_vgaarb_set_target (dev=0x432096cc160)
>     at /usr/xenocara/lib/libpciaccess/mk/../src/openbsd_pci.c:834
> [Current thread is 1 (process 286428)]

try the patch below

there are multiple reports about this upstream
https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/issues

Index: lib/libpciaccess/src/openbsd_pci.c
===================================================================
RCS file: /cvs/xenocara/lib/libpciaccess/src/openbsd_pci.c,v
diff -u -p -r1.30 openbsd_pci.c
--- lib/libpciaccess/src/openbsd_pci.c  9 Nov 2022 18:33:42 -0000       1.30
+++ lib/libpciaccess/src/openbsd_pci.c  7 Oct 2025 11:21:53 -0000
@@ -831,6 +831,8 @@ pci_device_vgaarb_fini(void)
 int
 pci_device_vgaarb_set_target(struct pci_device *dev)
 {
+       if (pci_sys == NULL)
+               return -1;
        pci_sys->vga_target = dev;
        return (0);
 }
@@ -838,9 +840,14 @@ pci_device_vgaarb_set_target(struct pci_
 int
 pci_device_vgaarb_lock(void)
 {
-       struct pci_device *dev = pci_sys->vga_target;
+       struct pci_device *dev;
        struct pci_vga pv;
 
+       if (pci_sys == NULL)
+               return -1;
+
+       dev = pci_sys->vga_target;
+
        if (dev == NULL)
                return -1;
 
@@ -857,9 +864,14 @@ pci_device_vgaarb_lock(void)
 int
 pci_device_vgaarb_unlock(void)
 {
-       struct pci_device *dev = pci_sys->vga_target;
+       struct pci_device *dev;
        struct pci_vga pv;
 
+       if (pci_sys == NULL)
+               return -1;
+
+       dev = pci_sys->vga_target;
+
        if (dev == NULL)
                return -1;
 
@@ -877,6 +889,9 @@ int
 pci_device_vgaarb_get_info(struct pci_device *dev, int *vga_count,
     int *rsrc_decodes)
 {
+       if (pci_sys == NULL)
+               return -1;
+
        *vga_count = pci_sys->vga_count;
 
        if (dev)
@@ -888,7 +903,12 @@ pci_device_vgaarb_get_info(struct pci_de
 int
 pci_device_vgaarb_decodes(int rsrc_decodes)
 {
-       struct pci_device *dev = pci_sys->vga_target;
+       struct pci_device *dev;
+
+       if (pci_sys == NULL)
+               return -1;
+
+       dev = pci_sys->vga_target;
 
        if (dev == NULL)
                return -1;

Reply via email to