Accepting request 1225115 from X11:XOrg

- U_Fix-segfault-on-dock-suspend-unplug-resume.patch,
  U_Free-output_ids.patch
  * Fix random segfaults when for example suspending.
    glfo#xorg/driver/xf86-video-amdgpu#70 glfo#drm/amd#2375

OBS-URL: https://build.opensuse.org/request/show/1225115
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xf86-video-amdgpu?expand=0&rev=36
This commit is contained in:
Ana Guerrero 2024-11-20 15:58:54 +00:00 committed by Git OBS Bridge
commit 16472bc1de
4 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 2897e1769c5d14a74bccbacb483667933807ead8 Mon Sep 17 00:00:00 2001
From: Chris Bainbridge <chris.bainbridge@gmail.com>
Date: Tue, 4 Jul 2023 22:34:27 +0100
Subject: [PATCH] Fix segfault on dock suspend, unplug, resume
`drmmode_set_mode` can segfault if a USB-C dock with external monitors
is disconnected during suspend. It appears that some data structures are
not updated, but the associated `drmModeConnectorPtr` associated with
those structures is NULL. Dereferencing that pointer results in Xorg
crashing.
Backtrace:
(crtc=crtc@entry=0x55a0c7610390, fb=fb@entry=0x55a0c86d7410, mode=mode@entry=0x55a0c76103a8, x=x@entry=0, y=y@entry=0) at drmmode_display.c:1267
(crtc=0x55a0c7610390, mode=0x55a0c76103a8, rotation=<optimized out>, x=<optimized out>, y=<optimized out>) at drmmode_display.c:1371
(main=main@entry=0x55a0c63f4b40, argc=argc@entry=10, argv=argv@entry=0x7fffb7cefbf8)
at ../sysdeps/nptl/libc_start_call_main.h:58
(main=0x55a0c63f4b40, argc=10, argv=0x7fffb7cefbf8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffb7cefbe8) at ../csu/libc-start.c:381
Fix this by checking the pointer before dereferencing it.
Fixes: https://gitlab.freedesktop.org/drm/amd/-/issues/2375
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
---
src/drmmode_display.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 5b73fce..32e7f21 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1264,6 +1264,9 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode,
if (output->crtc != crtc)
continue;
+ if (!drmmode_output->mode_output)
+ return FALSE;
+
output_ids[output_count] = drmmode_output->mode_output->connector_id;
output_count++;
}
--
2.43.0

37
U_Free-output_ids.patch Normal file
View File

@ -0,0 +1,37 @@
From ae22d12d420efbd8847f9b64b37e7a4cadde2600 Mon Sep 17 00:00:00 2001
From: Chris Bainbridge <chris.bainbridge@gmail.com>
Date: Wed, 12 Jul 2023 21:15:35 +0100
Subject: [PATCH] Free output_ids
---
src/drmmode_display.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 32e7f21..00247ac 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1264,8 +1264,10 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode,
if (output->crtc != crtc)
continue;
- if (!drmmode_output->mode_output)
- return FALSE;
+ if (!drmmode_output->mode_output) {
+ ret = FALSE;
+ goto out;
+ }
output_ids[output_count] = drmmode_output->mode_output->connector_id;
output_count++;
@@ -1285,6 +1287,7 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode,
"failed to set mode: %s\n", strerror(errno));
}
+out:
free(output_ids);
return ret;
}
--
2.43.0

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Nov 15 15:49:37 UTC 2024 - Björn Bidar <bjorn.bidar@thaodan.de>
- U_Fix-segfault-on-dock-suspend-unplug-resume.patch,
U_Free-output_ids.patch
* Fix random segfaults when for example suspending.
glfo#xorg/driver/xf86-video-amdgpu#70 glfo#drm/amd#2375
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 26 12:10:30 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org> Mon Feb 26 12:10:30 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -1,7 +1,7 @@
# #
# spec file for package xf86-video-amdgpu # spec file for package xf86-video-amdgpu
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -31,7 +31,11 @@ Source: https://xorg.freedesktop.org/releases/individual/driver/%{name}-
Source1: https://xorg.freedesktop.org/releases/individual/driver/%{name}-%{version}.tar.xz.sig Source1: https://xorg.freedesktop.org/releases/individual/driver/%{name}-%{version}.tar.xz.sig
Source2: %{name}.keyring Source2: %{name}.keyring
Source3: amdgpu.ids Source3: amdgpu.ids
# PATCH-FIX-OPENSUSE Workaround to fix crashes when an external monitor is connected bsc#1169222
Patch1: N_amdgpu-present-Check-tiling-for-newer-versions-too.patch Patch1: N_amdgpu-present-Check-tiling-for-newer-versions-too.patch
# PATCH-FIX-UPSTREAM Fix segfaults when e.g. suspending glfo/xorg/driver/xf86-video-amdgpu#70
Patch2: U_Fix-segfault-on-dock-suspend-unplug-resume.patch
Patch3: U_Free-output_ids.patch
BuildRequires: autoconf >= 2.6.0 BuildRequires: autoconf >= 2.6.0
BuildRequires: automake BuildRequires: automake
BuildRequires: libtool BuildRequires: libtool