Skip to contentSkip to conversation

recipes-graphics/xorg-xserver: Add patch to fix segfault when probe

PATCH Superseded Anibal Limon 2 participants 2 messages Sep 8, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 recipes-graphics/xorg-xserver: Add patch to fix segfault when probe

Fix segfault on probing a non-PCI platform device on a system with PCI.

...

    at ../../xorg-server-1.20.9/os/log.c:1017
    at ../../xorg-server-1.20.9/os/osinit.c:156
    at ../../xorg-server-1.20.9/os/osinit.c:110
    at ../../../../xorg-server-1.20.9/hw/xfree86/common/xf86platformBus.c:292
    argv=argv@entry=0xffffca43c7c8) at ../../../../xorg-server-1.20.9/hw/xfree86/common/xf86Init.c:388
    at ../../xorg-server-1.20.9/dix/main.c:193
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>)
    at ../csu/libc-start.c:314

...

From upstream rev e50c85f4e.

---
 ...probing-a-non-PCI-platform-device-on.patch | 31 +++++++++++++++++++
 .../xorg-xserver/xserver-xorg_1.20.9.bb       |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch
meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch new file +31 -0
new file mode 100644
index 0000000000..d66059d116
@@ -0,0 +1,31 @@
+From e50c85f4ebf559a3bac4817b41074c43d4691779 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Fri, 26 Oct 2018 17:47:30 -0700
+Subject: [PATCH] Fix segfault on probing a non-PCI platform device on a system
+ with PCI.
+
+Some Broadcom set-top-box boards have PCI busses, but the GPU is still
+probed through DT.  We would dereference a null busid here in that
+case.
+
+Signed-off-by: Eric Anholt <[email protected]>
+---
+ hw/xfree86/common/xf86platformBus.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
+index cef47da03..dadbac6c8 100644
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -289,7 +289,7 @@ xf86platformProbe(void)
+     for (i = 0; i < xf86_num_platform_devices; i++) {
+         char *busid = xf86_platform_odev_attributes(i)->busid;
+ 
+-        if (pci && (strncmp(busid, "pci:", 4) == 0)) {
++        if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) {
+             platform_find_pci_info(&xf86_platform_devices[i], busid);
+         }
+ 
+-- 
+2.28.0
+
meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.9.bb +1 -0
index 86d432a7c4..c83e43ed99 100644
@@ -6,6 +6,7 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
            file://sdksyms-no-build-path.patch \
            file://0001-drmmode_display.c-add-missing-mi.h-include.patch \
            file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \
+           file://0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch \
            "
 SRC_URI[sha256sum] = "e219f2e0dfe455467939149d7cd2ee53b79b512cc1d2094ae4f5c9ed9ccd3571"
 
Signature · 1 line
2.28.0
#1 lore raw

Missing Upstream-Status and Signed-off-by in the patch.

Ross

Quoted 76 lines · Anibal Limon

Fix segfault on probing a non-PCI platform device on a system with PCI.

...

    at ../../xorg-server-1.20.9/os/log.c:1017
    at ../../xorg-server-1.20.9/os/osinit.c:156
    at ../../xorg-server-1.20.9/os/osinit.c:110
    at ../../../../xorg-server-1.20.9/hw/xfree86/common/xf86platformBus.c:292
    argv=argv@entry=0xffffca43c7c8) at ../../../../xorg-server-1.20.9/hw/xfree86/common/xf86Init.c:388
    at ../../xorg-server-1.20.9/dix/main.c:193
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>)
    at ../csu/libc-start.c:314

...

From upstream rev e50c85f4e.

---
 ...probing-a-non-PCI-platform-device-on.patch | 31 +++++++++++++++++++
 .../xorg-xserver/xserver-xorg_1.20.9.bb       |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch
meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch new file +31 -0
new file mode 100644
index 0000000000..d66059d116
@@ -0,0 +1,31 @@
+From e50c85f4ebf559a3bac4817b41074c43d4691779 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Fri, 26 Oct 2018 17:47:30 -0700
+Subject: [PATCH] Fix segfault on probing a non-PCI platform device on a system
+ with PCI.
+
+Some Broadcom set-top-box boards have PCI busses, but the GPU is still
+probed through DT.  We would dereference a null busid here in that
+case.
+
+Signed-off-by: Eric Anholt <[email protected]>
+---
+ hw/xfree86/common/xf86platformBus.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
+index cef47da03..dadbac6c8 100644
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -289,7 +289,7 @@ xf86platformProbe(void)
+     for (i = 0; i < xf86_num_platform_devices; i++) {
+         char *busid = xf86_platform_odev_attributes(i)->busid;
+
+-        if (pci && (strncmp(busid, "pci:", 4) == 0)) {
++        if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) {
+             platform_find_pci_info(&xf86_platform_devices[i], busid);
+         }
+
+--
+2.28.0
+
meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.9.bb +1 -1
index 86d432a7c4..c83e43ed99 100644
@@ -6,6 +6,7 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
            file://sdksyms-no-build-path.patch \
            file://0001-drmmode_display.c-add-missing-mi.h-include.patch \
            file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \
+           file://0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch \
            "
 SRC_URI[sha256sum] = "e219f2e0dfe455467939149d7cd2ee53b79b512cc1d2094ae4f5c9ed9ccd3571"
 
--

2.28.0