Bug 10934

Summary: segfault in SavageDoAdjustFrame()
Product: xorg Reporter: Julien Cristau <jcristau>
Component: Driver/savageAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: alexdeucher, bugzi11.fdo.tormod
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://bugs.debian.org/423485
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg log
none
backtrace
none
gdb session
none
set currentMode after switching, before adjusting frame none

Description Julien Cristau 2007-05-12 15:11:07 UTC
This was reported by Tormod Volden <debian.tormod@gmail.com> to the debian BTS.

"Trying to start an old q3demo, the X server crashed."

Tormod had the following comment:

"Playing around with gdb, I see that pScrn-currentMode has been set to
NULL by xf86VidMode. If I manually set it to pScrn->modes:
(gdb) set pScrn->currentMode = pScrn->modes
the program will start and seems to run normally.

AFAICS the problem is that xf86VidMode sets it intentionally to NULL
before calling xf86SwitchMode, and that it's then used as a
pointer by SavageDoAdjustFrame inside the xf86SwitchMode call."

I'll attach the backtrace and gdb session he provided.
Comment 1 Julien Cristau 2007-05-12 15:11:47 UTC
Created attachment 9950 [details]
Xorg log
Comment 2 Julien Cristau 2007-05-12 15:12:24 UTC
Created attachment 9951 [details]
backtrace
Comment 3 Julien Cristau 2007-05-12 15:12:48 UTC
Created attachment 9952 [details]
gdb session
Comment 4 Tormod Volden 2007-05-13 01:28:28 UTC
Created attachment 9953 [details] [review]
set currentMode after switching, before adjusting frame

(From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=423485)

The attached patch fixes (or works around) the problem by setting currentMode to the new mode as soon as the mode switching has occured, and before SavageAdjustFrame is called.

There are probably better ways to fix this. It seems like the pScrn->frameX? adjustment is done in xf86SwitchMode as well, so maybe it could be taken out from SavageDoAdjustFrame which then would not need the currentMode.
Comment 5 Alex Deucher 2007-07-11 18:10:02 UTC
fixed:
90692b3a123861ca02100f86b4c80f070fd4196d

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.