Commit Graph

38 Commits

Author SHA1 Message Date
Keith Packard
41da295eb5 Trap SIGBUS to handle truncated shared memory segments
If a client passes a section of memory via file descriptor and then
subsequently truncates that file, the underlying pages will be freed
and the addresses invalidated. Subsequent accesses to the page will
fail with a SIGBUS error.

Trap that SIGBUS, figure out which segment was causing the error and
then allocate new pages to fill in for that region. Mark the offending
shared segment as invalid and free the resource ID so that the client
will be able to tell when subsequently attempting to use the segment.

Signed-off-by: Keith Packard <keithp@keithp.com>

v2: Use MAP_FIXED to simplify the recovery logic (Mark Kettenis)
v3: Also catch errors in ShmCreateSegment

Conflicts:
	include/dix-config.h.in
	include/xorg-config.h.in
2013-11-11 15:16:07 -08:00
Marcin Slusarz
e21e183059 os: use libunwind to generate backtraces
Libunwind generates backtraces much more reliably than glibc's "backtrace".

Before:
0: /opt/xserver/bin/X (0x400000+0x18ce36) [0x58ce36]
1: /opt/xserver/bin/X (xorg_backtrace+0x9) [0x58d119]
2: /opt/xserver/bin/X (0x400000+0x190d69) [0x590d69]
3: /lib64/libpthread.so.0 (0x7fb904268000+0x10a90) [0x7fb904278a90]
4: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
5: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
6: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
7: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
8: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (0x7fb90220e000+0x76f3) [0x7fb9022156f3]
9: /opt/xserver/lib/xorg/modules/libexa.so (0x7fb9019c7000+0xbae0) [0x7fb9019d2ae0]
10: /opt/xserver/bin/X (0x400000+0x17d2b3) [0x57d2b3]
11: /opt/xserver/bin/X (0x400000+0xc9930) [0x4c9930]
12: /opt/xserver/bin/X (0x400000+0x3a81a) [0x43a81a]
13: /opt/xserver/bin/X (0x400000+0x3d6a1) [0x43d6a1]
14: /opt/xserver/bin/X (0x400000+0x2c2ca) [0x42c2ca]
15: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
16: /opt/xserver/bin/X (0x400000+0x2c60d) [0x42c60d]
17: ?? [0x0]

After:
0: /opt/xserver/bin/X (OsSigHandler+0x39) [0x590d69]
1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x7fb904278a8f]
2: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
3: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
4: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
5: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
6: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (nouveau_exa_download_from_screen+0x1a3) [0x7fb9022156f3]
7: /opt/xserver/lib/xorg/modules/libexa.so (exaGetImage+0x1f0) [0x7fb9019d2ae0]
8: /opt/xserver/bin/X (miSpriteGetImage+0x173) [0x57d2b3]
9: /opt/xserver/bin/X (compGetImage+0xb0) [0x4c9930]
10: /opt/xserver/bin/X (ProcGetImage+0x55a) [0x43a81a]
11: /opt/xserver/bin/X (Dispatch+0x341) [0x43d6a1]
12: /opt/xserver/bin/X (main+0x3ba) [0x42c2ca]
13: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
14: /opt/xserver/bin/X (_start+0x29) [0x42c60d]
15: ? (?+0x29) [0x29]

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Knut Petersen <knut.petersen@t-online.de>
2013-02-26 07:59:53 +10:00
Alan Coopersmith
d829a7c5cb Move to autoconf standard function name checks & defines
Replace multiple methods of checking for functions with AC_CHECK_FUNCS
Replace multiple methods of selecting fallback funcs with AC_REPLACE_FUNCS
Replace HAS_* and NEED_* #defines with autogenerated HAVE_*

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2011-12-05 14:32:45 -08:00
Alan Coopersmith
acde97a39d Add fallback implementation of strndup()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Linux test code fixed by: Keith Packard <keithp@keithp.com>
2011-11-23 12:15:05 -08:00
Dan Nicholson
7d5c8a12cb Don't use empty source files
When an empty _SOURCES variable is declared, automake will recognize that
only linking is needed.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Tested-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-06-23 05:28:31 -07:00
Rami Ylimäki
1e933665be os: Add facilities for client ID tracking.
An interface is provided for figuring out the PID and process name of
a client. Make some existing functionality from SELinux and IA
extensions available for general use.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-12-23 13:53:18 +02:00
Rami Ylimäki
2b364bf970 Revert "os: Prevent backtrace from being stopped in noreturn functions."
This reverts commit 579715f830.

The patch is not needed anymore. I haven't encountered backtrace
problems with GCC 4.3.3. Even if the problems still persisted, this
commit should be removed and instead the definition of _X_NORETURN
should be modified to be empty if GCC/ARM is used. However, currently
it seems that ARM backtraces are OK even if _X_NORETURN is used and
-mapcs-frame is not defined in CFLAGS.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-12-23 11:20:42 +02:00
Rami Ylimaki
579715f830 os: Prevent backtrace from being stopped in noreturn functions.
There are two noreturn functions in the X server: FatalError and
AbortServer. Having any of those two functions in the middle of a call
stack will prevent unwinding the program properly and stops the
backtrace at those functions in gdb.

The file containing FatalError and AbortServer, os/log.c, has to be
compiled with the -mapcs-frame option on ARM to get proper
backtraces. Automake imposes its own restrictions on compiling
individual source files with different options. The recommended way to
do this is to put os/log.c into a convenience library and add this
library inside os/libos.la. See the documentation of GNU Automake
manual, version 1.11.1, section 27.8 Per-Object Flags Emulation, for
details.

Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-25 06:03:43 +01:00
Mikhail Gusarov
d306373399 Supply all code using dl*() with DLOPEN_LIBS
Previously DLOPEN_LIBS was managed in top-level configure.ac.
Instead bundle it with the code using dl*() functions to
avoid breakages in uncommon configurations.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-29 14:15:02 -07:00
Julien Cristau
5551609494 Move SHA1 computation from render/glyph.c to os/
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
2009-10-15 01:17:44 +02:00
Alan Coopersmith
315aaef557 Use $(AM_V_GEN) to silence more commands when AM_SILENT_RULES is active
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-06 19:40:20 -07:00
Alan Coopersmith
4b0911565d Add platform tests for Dtrace linker magic
Replaces special handling for Xquartz DDX and scales better to handling
the multiple platforms that now have some level of Dtrace support available.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2009-10-06 19:40:19 -07:00
Ben Byer
efacd7bfd0 Add (ok, fix) support for DTrace under OS X
(cherry picked from commit 8428a57184)
2009-09-27 23:32:19 -07:00
Adam Jackson
94ed0ba1b5 Move xorg_backtrace() up to the OS level so we can call it from DIX. 2008-10-10 16:28:10 -04:00
Matthieu Herrb
6e33e6f355 Move string comparaison functions to from dix/ to os/. 2008-08-09 23:51:39 +02:00
Daniel Stone
e6f35f28fb OS/KDrive/XFree86: Sanitise colour initialisation
OsInitColors always just returned TRUE, so just remove calls to it and
insane special-case logic.  Remove unused kcolor.c implementation, and
merge oscolor.h into oscolor.c since it was the only user.  Remove
open-coded strncasecmp in oscolor.c.

Since we no longer need to call OsInitColors after reading the config
file, just call PostConfigInit() from one place, and move PM handling to
one place so we can install the signal handlers earlier.
2008-07-16 01:38:22 +03:00
Eamon Walsh
c8feb73f58 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/EVI.c
	Xext/bigreq.c
	Xext/cup.c
	Xext/dpms.c
	Xext/fontcache.c
	Xext/mitmisc.c
	Xext/xcmisc.c
	Xext/xf86bigfont.c
	Xext/xtest.c
	configure.ac
	dbe/dbe.c
	hw/darwin/darwin.h
	hw/darwin/darwinEvents.c
	hw/darwin/iokit/xfIOKit.h
	hw/darwin/iokit/xfIOKitCursor.c
	hw/darwin/quartz/fullscreen/fullscreen.c
	hw/darwin/quartz/fullscreen/quartzCursor.c
	hw/darwin/quartz/quartz.c
	hw/darwin/quartz/quartzCommon.h
	hw/darwin/quartz/quartzCursor.c
	hw/darwin/quartz/xpr/dri.c
	hw/darwin/quartz/xpr/dristruct.h
	hw/darwin/quartz/xpr/xprCursor.c
	hw/darwin/quartz/xpr/xprFrame.c
	hw/xfree86/modes/xf86RandR12.c
	include/cursor.h
	miext/rootless/rootlessCommon.h
	miext/rootless/rootlessScreen.c
	miext/rootless/rootlessWindow.c
	render/picturestr.h

Trying to pick up the pieces from the darwin churn here...
2007-12-13 18:38:25 -05:00
Adam Jackson
1faba797cb Death to libcwrapper.
This has been deprecated since 1.1.  Since we're breaking ABI again anyway,
remove it entirely.
2007-12-03 14:12:58 -05:00
Eamon Walsh
2d17f47cc7 Merge branch 'master' into XACE-SELINUX
Conflicts:

	hw/xnest/Pixmap.c
	include/dix.h
2007-11-19 18:10:46 -05:00
Adam Jackson
01cfba7522 Nuke the debugging allocator.
This has never been hooked up in the modular build, and can not possibly
have built since before 6.7.  Clearly no one's using it.
2007-11-15 14:27:03 -05:00
Eamon Walsh
8554707326 Merge branch 'master' into XACE-SELINUX
Conflicts:

	include/miscstruct.h
	mi/mibstore.c
	mi/midispcur.c
	os/Makefile.am
2007-08-28 07:25:21 -04:00
Alan Coopersmith
23fbd5292d Actually build Secure RPC authentication support (missed in modularization) 2007-08-17 15:29:47 -07:00
Eamon Walsh
375864cb74 security: drop support for XC-QUERY-SECURITY authorization method. 2007-08-03 13:23:34 -04:00
Daniel Stone
1ace9770fe Build system: Non-dtrace distcheck hacks
automake 1.10 really wants foo.c for foo.O, so give it some dummy files to
deal with if it really needs them.
2007-08-01 08:10:38 +03:00
Adam Jackson
dfbe32b5b8 Remove the old Kerberos 5 authentication code.
Before you complain, this code hasn't seen material change since at least
X11R6.  It certainly does not build with any modern version of Kerberos.
Anybody wanting krb5 auth to their X server should probably be using
GSSAPI instead of internal krb5 API anyway.
2007-06-04 18:07:00 -04:00
Alan Coopersmith
8956f63a94 Tell automake to STFU about the *.O files
automake will not stop whining about the *.O files not being in normal library
name format, so just tell automake they are PROGRAMS so it builds them without
bitching.
2006-11-30 19:53:29 -08:00
Bernhard Rosenkraenzer
8deaaa312a automake: avoid use of reserved _SOURCES keyword (bug #8866)
Avoid using _SOURCES unless we're directly referencing a program or
library to be built; use _SRCS instead.  Shuts automake 1.10 up.
2006-11-04 19:08:28 +02:00
Alan Coopersmith
49a26681b2 Add DTrace probe points for X server <-> client communications
See http://people.freedesktop.org/~alanc/dtrace/ for more details
2006-11-03 12:54:43 -08:00
Daniel Stone
84683f19b4 get rid of XFree86LOADER, XFree86Server, XFree86Module, and IN_MODULE
Get rid of almost all uses of these definitions.  They're still defined for
delinquent out-of-tree drivers, and also for the Mesa build.  As well as
for miinitext.c.  But largely gone.
2006-07-18 18:17:38 -04:00
Daniel Stone
a9ed5a8790 Kill LBX, too. 2006-06-01 22:06:41 +00:00
Kristian Høgsberg
966d93ef6d Make the server distcheck and tag 1.0.99.1 snapshot.
Bump CVS version to 1.0.99.1.
Distcheck fixes.
2006-03-21 22:54:38 +00:00
Alan Coopersmith
9439297b7b Bugzilla #5219 <https://bugs.freedesktop.org/show_bug.cgi?id=5219> Make
sure all optional sources are included in EXTRA_DIST, even if they
    aren't used on the platform the distballs are made on.
2005-12-06 15:50:35 +00:00
Kevin E Martin
7c00afd0ec Define XFree86Server only where it is required. 2005-12-02 06:02:45 +00:00
Kevin E Martin
da5d66f2ff Fix usage of XFree86LOADER/XFree86Module/IN_MODULE and update loadable
module builds to reflect this change.
2005-11-29 16:39:33 +00:00
Kevin E Martin
1859c62607 include/dix-config.h.in Add support for more extensions
Add missing files to EXTRA_DIST
2005-10-17 07:18:59 +00:00
Kristian Høgsberg
21e7339c1e Hook up lbx. 2005-10-14 22:44:56 +00:00
Daniel Stone
826a6f029f Continuing Makefile cleanup; add DIX_CFLAGS and XORG_CFLAGS everywhere. 2005-07-02 18:59:44 +00:00
Daniel Stone
ded56b1a74 Adding initial build system. 2005-07-01 20:29:53 +00:00