xserver/hw/xfree86/common
Maarten Lankhorst deb08658e2 xfree86: Strip dangling pointers from desiredMode
Based on the original patch by Chris Wilson, which was a better fix than mine.

We stash a copy of the desiredMode on the crtc so that we can restore it
after a vt switch. This copy is a simple memcpy and so also stashes a
references to the pointers contained within the desiredMode. Those
pointers are freed the next time the outputs are probed and mode list
rebuilt, resulting in us chasing those dangling pointers on the next
mode switch.

==22787== Invalid read of size 1
==22787==    at 0x40293C2: __GI_strlen (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22787==    by 0x668F875: strdup (strdup.c:42)
==22787==    by 0x5DBA00: XNFstrdup (utils.c:1124)
==22787==    by 0x4D72ED: xf86DuplicateMode (xf86Modes.c:209)
==22787==    by 0x4CA848: xf86CrtcSetModeTransform (xf86Crtc.c:276)
==22787==    by 0x4D05B4: xf86SetDesiredModes (xf86Crtc.c:2677)
==22787==    by 0xA7479D0: sna_create_screen_resources
(sna_driver.c:220)
==22787==    by 0x4CB914: xf86CrtcCreateScreenResources (xf86Crtc.c:725)
==22787==    by 0x425498: main (main.c:216)
==22787==  Address 0x72c60e0 is 0 bytes inside a block of size 9 free'd
==22787==    at 0x4027AAE: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22787==    by 0x4A547E: xf86DeleteMode (xf86Mode.c:1984)
==22787==    by 0x4CD84F: xf86ProbeOutputModes (xf86Crtc.c:1578)
==22787==    by 0x4DC405: xf86RandR12GetInfo12 (xf86RandR12.c:1537)
==22787==    by 0x518119: RRGetInfo (rrinfo.c:202)
==22787==    by 0x51D997: rrGetScreenResources (rrscreen.c:335)
==22787==    by 0x51E0D0: ProcRRGetScreenResources (rrscreen.c:475)
==22787==    by 0x513852: ProcRRDispatch (randr.c:493)
==22787==    by 0x4346DB: Dispatch (dispatch.c:439)
==22787==    by 0x4256E4: main (main.c:287)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36108
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-11 15:55:22 -07:00
..
.gitignore .gitignore: use common defaults with custom section #24239 2009-11-11 21:40:20 -08:00
Makefile.am Remove XAA 2012-07-10 00:41:57 -07:00
compiler.h Provide prototypes for Mmio functions for Solaris Studio on SPARC 2012-06-05 16:28:54 -07:00
dgaproc.h DGA: Remove excessive module-induced indirection 2012-07-09 23:40:55 -07:00
extramodes Remove some default modes that really shouldn't be in the default set. 2008-06-24 10:40:36 -04:00
fourcc.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
modeline2c.awk Remove some OS/2 leftovers. 2009-04-06 10:58:47 -04:00
vesamodes Fix standard VESA modes. 2006-11-03 14:06:32 -08:00
vidmodeproc.h Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xaarop.h Remove XAA 2012-07-10 00:41:57 -07:00
xf86.h xfree86: Strip dangling pointers from desiredMode 2012-07-11 15:55:22 -07:00
xf86AutoConfig.c xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86Build.h.in Print the build time as well as the date if we can. 2007-06-04 02:03:44 -04:00
xf86Bus.c xfree86: add DDX gpu screen support. (v3) 2012-07-06 10:35:19 +01:00
xf86Bus.h xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86Config.c Move DRI2 from external module to built-in 2012-07-10 00:31:01 -07:00
xf86Config.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Configure.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Cursor.c xfree86: drop ddx-specific SIGIO blocking 2012-07-03 15:56:35 +10:00
xf86DGA.c DGA: Remove excessive module-induced indirection 2012-07-09 23:40:55 -07:00
xf86DPMS.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86Events.c xfree86: drop ddx-specific SIGIO blocking 2012-07-03 15:56:35 +10:00
xf86Extensions.c Remove unused setupFunc from extensions 2012-07-10 00:31:02 -07:00
xf86Extensions.h Move DRI2 from external module to built-in 2012-07-10 00:31:01 -07:00
xf86Globals.c xfree86: add autoAddGPU option (v2) 2012-07-06 10:35:20 +01:00
xf86Helper.c xfree86: add DDX gpu screen support. (v3) 2012-07-06 10:35:19 +01:00
xf86InPriv.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Init.c Merge branch 'local-fixes' 2012-07-10 00:52:11 -07:00
xf86Mode.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86Module.h Move the remnants of loadext.c to miinitext.c 2012-07-10 00:31:02 -07:00
xf86Opt.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Option.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Optionstr.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86PM.c xfree86: drop ddx-specific SIGIO blocking 2012-07-03 15:56:35 +10:00
xf86PciInfo.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Priv.h xfree86: add DDX gpu screen support. (v3) 2012-07-06 10:35:19 +01:00
xf86Privstr.h xfree86: add autoAddGPU option (v2) 2012-07-06 10:35:20 +01:00
xf86RandR.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VGAarbiter.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VGAarbiter.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86VGAarbiterPriv.h api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VidMode.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86Xinput.c xfree86: fix mouse wheel support for DGA clients 2012-05-23 16:06:27 +10:00
xf86Xinput.h xfree86: constify InputDriverPtr->driverName and default_options 2012-07-02 22:34:33 -07:00
xf86cmap.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86cmap.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86fbBus.c xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86fbman.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86fbman.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86noBus.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86pciBus.c xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86pciBus.h xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86platformBus.c randr: add provider object and provider property support (v6) 2012-07-06 22:16:02 +01:00
xf86platformBus.h xfree86: add platform bus hotplug support (v3) 2012-07-06 10:35:20 +01:00
xf86sbusBus.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86sbusBus.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86str.h xfree86: add framework for provider support in ddx. (v4) 2012-07-06 22:16:08 +01:00
xf86vmode.c Move XFree86-VidMode from extmod to built-in 2012-07-10 00:00:58 -07:00
xf86xv.c Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xv.h Move Xv and XvMC from extmod to built-in 2012-07-09 23:28:37 -07:00
xf86xvmc.c Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xvmc.h Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xvpriv.h xfree86: fix new warnings introduced in rebase. 2012-06-05 10:33:23 -07:00
xisb.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xisb.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xorgHelper.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xorgVersion.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00