No description
Find a file
Ryan C. Gordon d8c36bac77 Date: Mon, 17 Oct 2005 20:09:03 -0400
From: Mark Schreiber <mark7@alumni.cmu.edu>
To: ryan@clutteredmind.org
Subject: [PATCH]SDL mprotect() crash fix

(I'm going to throw this patch your way at the suggestion of #SDL --
for some reason, I had some difficulty sending it to the main list
last time, and I go bonkers subscribing to send each email or
patch...)

Currently, when I run SDL applications as non-root using
SDL_VIDEODRIVER=dga, the fbdev fallback mprotect()s read/write the
proper size of mmapped /dev/fb0 (7.5MB), but on framebuffer release
mprotect()s read-only the range by the entire size of my video memory
(128MB), which causes a segfault:

#0  0x002a9a27 in ?? () from /lib/libc.so.6
#1  0x04a63eb6 in SDL_XDGAUnmapFramebuffer (screen=3D0) at XF86DGA2.c:978
#2  0x04a63efc in SDL_XDGACloseFramebuffer (dpy=3D0x9d3f008, screen=3D0)
    at XF86DGA2.c:268
#3  0x04a68b57 in DGA_Available () at SDL_dgavideo.c:98
#4  0x04a53677 in SDL_VideoInit (driver_name=3D0xbfb0bfc7 "dga", flags=3D0)
    at SDL_video.c:180
#5  0x04a2613f in SDL_InitSubSystem (flags=3D32) at SDL.c:74
#6  0x04a2617c in SDL_Init (flags=3D32) at SDL.c:166
#7  0x08049722 in main (argc=3D1, argv=3D0x0) at testwin.c:32

This is SDL 1.2.8 on Fedora Core 4, radeon driver for a Radeon 9250,
xorg-x11-6.8.2-37.

I've attached a one-line patch against SDL CVS that updates the size
of the framebuffer at framebuffer map time so that the mprotect() on
unmap will be the same size.  I'm not sure if this is the best
approach (i.e. one might want to retain the original value), but it
does make my SDL applications work without segfaulting.

-- Best of luck, Mark Schreiber

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401179
2005-11-19 18:57:00 +00:00
docs *** empty log message *** 2004-12-16 06:39:54 +00:00
include Patch from Martin Lange (mala-sdl at hotmail.com) to unregister SDL's win32 2005-09-27 09:00:42 +00:00
src Date: Mon, 17 Oct 2005 20:09:03 -0400 2005-11-19 18:57:00 +00:00
test Fixed compiler warnings in Watcom C. 2005-10-03 08:12:32 +00:00
.cvsignore *** empty log message *** 2004-12-16 05:29:55 +00:00
acinclude.m4 Don't fail if we don't have ALSA available 2004-08-24 06:32:50 +00:00
autogen.sh Date: Fri, 2 Sep 2005 21:56:50 -0400 2005-09-11 04:15:44 +00:00
Borland.html *** empty log message *** 2003-07-01 01:18:27 +00:00
Borland.zip *** empty log message *** 2003-07-01 01:18:27 +00:00
BUGS *** empty log message *** 2004-08-20 19:42:44 +00:00
config.guess Updated libtool support so Mingw32 builds work. 2003-10-06 07:13:16 +00:00
config.sub Date: Sat, 24 Apr 2004 15:13:32 +0300 2004-05-06 15:55:06 +00:00
configure.in Fixed Altivec support on Mac OS X. 2005-11-17 03:43:42 +00:00
COPYING Initial revision 2001-04-26 16:45:43 +00:00
CREDITS Lots of people have contributed cash. :) 2004-02-15 22:04:46 +00:00
CWprojects.sea.bin Updated version number 2005-08-24 05:49:57 +00:00
docs.html *** empty log message *** 2005-08-21 08:02:23 +00:00
EpocBuildFiles.zip Added support for building SDL for EPOC/SymbianOS 6.0 (thanks Hannu!) 2001-12-14 12:37:34 +00:00
INSTALL Date: Tue, 2 Mar 2004 11:34:54 +0100 2004-03-02 13:01:02 +00:00
ltmain.sh Updated libtool support for libtool 1.5.8 2004-08-21 20:35:50 +00:00
Makefile.am Merged the Visual C++ 6 and 7 projects so all Visual C++ users unpack the same set of projects to get started. 2005-08-24 21:57:48 +00:00
Makefile.dc Added initial support for Dreamcast (thanks HERO!) 2002-10-05 16:50:56 +00:00
MPWmake.sea.bin Updated projects with cpuinfo API 2004-02-10 17:34:38 +00:00
PBProjects.tar.gz The tenth time is the charm... 2004-05-20 10:05:59 +00:00
README QNX is now officially supported! Thanks to Mike Gorchak! 2003-08-30 17:09:59 +00:00
README-SDL.txt Initial revision 2001-04-26 16:45:43 +00:00
README.AmigaOS Updated the Amiga OS port of SDL (thanks Gabriele) 2001-05-10 20:13:29 +00:00
README.CVS *** empty log message *** 2004-05-16 22:37:59 +00:00
README.DC Added initial support for Dreamcast (thanks HERO!) 2002-10-05 16:50:56 +00:00
README.Epoc Added support for building SDL for EPOC/SymbianOS 6.0 (thanks Hannu!) 2001-12-14 12:37:34 +00:00
README.MacOS Date: Sat, 8 Sep 2001 04:42:23 +0200 2001-09-11 19:00:18 +00:00
README.MacOSX Updated SDL for MacOS X Xcode support 2004-12-06 04:17:56 +00:00
README.MiNT Document recent audio updates 2005-08-10 14:30:53 +00:00
README.NanoX Date: Sat, 24 Aug 2002 22:20:01 -0600 2002-08-25 06:21:49 +00:00
README.PicoGUI Added initial support for PicoGUI (thanks Micah!) 2002-08-01 23:24:13 +00:00
README.QNX Date: Sat, 24 Apr 2004 15:13:32 +0300 2004-05-06 15:55:06 +00:00
README.Qtopia Added a README for Qtopia 2002-06-01 18:43:51 +00:00
README.RISCOS Date: Wed, 26 Jan 2005 13:37:09 GMT 2005-02-12 18:01:31 +00:00
README.WinCE Updated for embedded Visual C++ 4.0 2002-08-20 00:20:06 +00:00
sdl-config.in Fixed static linking on MacOS X (thanks Max!) 2004-02-11 07:09:11 +00:00
sdl.m4 Date: Wed, 17 Aug 2005 11:23:40 -0400 2005-08-18 06:06:02 +00:00
SDL.qpg.in Date: Tue, 2 Mar 2004 08:52:20 +0200 2004-03-02 12:38:27 +00:00
SDL.spec.in The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails: 2005-09-08 06:16:14 +00:00
strip_fPIC.sh Fixed to work on Solaris x86 2001-05-10 20:19:50 +00:00
TODO *** empty log message *** 2001-08-18 10:33:55 +00:00
VisualC.html Merged the Visual C++ 6 and 7 projects so all Visual C++ users unpack the same set of projects to get started. 2005-08-24 21:57:48 +00:00
VisualC.zip Merged the Visual C++ 6 and 7 projects so all Visual C++ users unpack the same set of projects to get started. 2005-08-24 21:57:48 +00:00
VisualCE.zip Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at 2005-09-29 09:43:00 +00:00
WhatsNew *** empty log message *** 2004-01-08 16:01:07 +00:00

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 1.2

---
http://www.libsdl.org/

This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.

SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Java, Lua, ML,
Objective C, Perl, PHP, Pike, Python, and Ruby.

The current version supports Linux, Windows, BeOS, MacOS, MacOS X,
FreeBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.  The code contains
support for Windows CE, AmigaOS, Dreamcast, Atari, NetBSD, AIX, OSF/Tru64,
RISC OS, and SymbianOS, but these are not officially supported.

This library is distributed under GNU LGPL version 2, which can be
found in the file  "COPYING".  This license allows you to use SDL
freely in commercial programs as long as you link with the dynamic
library.

The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation is available in HTML format in "./docs/index.html"

The test programs in the "test" subdirectory are in the public domain.

Frequently asked questions are answered online:
	http://www.libsdl.org/faq.php

If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
	http://www.libsdl.org/mailing-list.php

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)