xserver: Branch 'master' - 12 commits

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 22 17:47:34 PST 2010


Hi Rami,

On Mon, Feb 22, 2010 at 01:39:33PM -0800, Keith Packard wrote:
> commit 5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd
> Author: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
> Date:   Thu Jan 28 11:08:34 2010 +0200
> 
>     os: Prevent core dump from being truncated.
>     
>     The problem fixed by this patch can be reproduced on Linux with the
>     following steps.
>     - Access NULL pointer intentionally in ProcessOtherEvent on key press.
>     - Instead of saving core dump to a file, write it into a pipe.
>       echo "|/usr/sbin/my-core-dumper" > /proc/sys/kernel/core_pattern
>     - Dump the core by pressing a key.
>     
>     While the core is being dumped into the pipe, the smart schedule timer
>     will cause a pending SIGALRM. Linux kernel stops writing data to the
>     pipe when there are pending signals. This causes the core dump to be
>     truncated. On my system I'm expecting a 6 MB dump but the size will be
>     60 kB instead. The problem is solved if we block the SIGALRM caused by
>     expired smart schedule timer.
>     
>     I haven't been able to reproduce this problem in the following cases.
>     - Save core dump to a file instead of a pipe.
>     - kill -SEGV `pidof Xorg`
>     - Press a key to dump core while gdb is attached to Xorg.
>     - Give option -dumbSched to Xorg.
>     
>     Also note that the fix works only when NoTrapSignals has the default
>     value FALSE. The problem can still be reproduced if error signals
>     aren't trapped. In addition to pending SIGALRM, there is a similar
>     problem with pending SIGIO from the keyboard driver during core dump.
>     
>     Signed-off-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
>     Reviewed-by: Keith Packard <keithp at keithp.com>
>     Signed-off-by: Keith Packard <keithp at keithp.com>
> 
> diff --git a/composite/compwindow.c b/composite/compwindow.c
> index c10cb9e..f2f6ea3 100644
> --- a/composite/compwindow.c
> +++ b/composite/compwindow.c
> @@ -205,7 +205,7 @@ compPositionWindow (WindowPtr pWin, int x, int y)
>  #ifdef COMPOSITE_DEBUG
>      if ((pWin->redirectDraw != RedirectDrawNone) !=
>  	(pWin->viewable && (GetCompWindow(pWin) != NULL)))
> -	abort ();
> +	OsAbort ();
>  #endif
>      if (pWin->redirectDraw != RedirectDrawNone)
>      {
> diff --git a/glx/glthread.c b/glx/glthread.c
> index 4caaea1..8b9f618 100644
> --- a/glx/glthread.c
> +++ b/glx/glthread.c
> @@ -129,7 +129,7 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
>  _X_EXPORT unsigned long
>  _glthread_GetID(void)
>  {
> -   abort();   /* XXX not implemented yet */
> +   OsAbort();   /* XXX not implemented yet */
>     return (unsigned long) 0;
>  }
>  
> diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c
> index 74353a9..7421be3 100644
> --- a/hw/dmx/examples/xinput.c
> +++ b/hw/dmx/examples/xinput.c
> @@ -233,7 +233,7 @@ int main(int argc, char **argv)
>          int         total = 0;
>  
>  #define ADD(type)                                     \
> -        if (cnt >= MAX_EVENTS) abort();               \
> +        if (cnt >= MAX_EVENTS) OsAbort();             \


This leads to a build error on my box here, looks like there's some changes
to the linking order needed as well.

xinput-xinput.o: In function `main':
/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:243: undefined reference to
`OsAbort'
/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:244: undefined reference to
`OsAbort'
/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:245: undefined reference to
`OsAbort'
/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:246: undefined reference to
`OsAbort'
/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:247: undefined reference to
`OsAbort'
xinput-xinput.o:/home/whot/xorg/xserver/hw/dmx/examples/xinput.c:248: more
undefined references to `OsAbort' follow
collect2: ld returned 1 exit status


Cheers,
  Peter





>          names[cnt] = #type;                           \
>          type(dev, event_type[cnt], event_list[cnt]);  \
>          if (event_type[cnt]) ++cnt
> diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
> index 7675c1e..1902ab8 100644
> --- a/hw/kdrive/src/kdrive.c
> +++ b/hw/kdrive/src/kdrive.c
> @@ -335,7 +335,7 @@ AbortDDX(void)
>      }
>  
>      if (kdCaughtSignal)
> -        abort();
> +        OsAbort();
>  }
>  
>  void
> diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
> index 2c206ff..72241a7 100644
> --- a/hw/xfree86/common/xf86Init.c
> +++ b/hw/xfree86/common/xf86Init.c
> @@ -1235,7 +1235,7 @@ ddxGiveUp(void)
>  
>      /* If an unexpected signal was caught, dump a core for debugging */
>      if (xf86Info.caughtSignal)
> -	abort();
> +	OsAbort();
>  }
>  
>  
> diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c
> index 4306404..5f1f870 100644
> --- a/hw/xquartz/GL/capabilities.c
> +++ b/hw/xquartz/GL/capabilities.c
> @@ -522,7 +522,7 @@ bool getGlCapabilities(struct glCapabilities *cap) {
>  	    conf = malloc(sizeof(*conf));
>  	    if(NULL == conf) {
>              perror("malloc");
> -            abort();
> +            OsAbort();
>  	    }
>  
>  	    /* Copy the struct. */
> diff --git a/miext/damage/damage.c b/miext/damage/damage.c
> index b7ec92a..2851aed 100644
> --- a/miext/damage/damage.c
> +++ b/miext/damage/damage.c
> @@ -1705,7 +1705,7 @@ damageRemoveDamage (DamagePtr *pPrev, DamagePtr pDamage)
>      }
>  #if DAMAGE_VALIDATE_ENABLE
>      ErrorF ("Damage not on list\n");
> -    abort ();
> +    OsAbort ();
>  #endif
>  }
>  
> @@ -1718,7 +1718,7 @@ damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage)
>      for (pOld = *pPrev; pOld; pOld = pOld->pNext)
>  	if (pOld == pDamage) {
>  	    ErrorF ("Damage already on list\n");
> -	    abort ();
> +	    OsAbort ();
>  	}
>  #endif
>      pDamage->pNext = *pPrev;
> @@ -1971,7 +1971,7 @@ DamageRegister (DrawablePtr pDrawable,
>      if (pDrawable->pScreen != pDamage->pScreen)
>      {
>  	ErrorF ("DamageRegister called with mismatched screens\n");
> -	abort ();
> +	OsAbort ();
>      }
>  #endif
>  
> @@ -1986,7 +1986,7 @@ DamageRegister (DrawablePtr pDrawable,
>  	for (pOld = *pPrev; pOld; pOld = pOld->pNextWin)
>  	    if (pOld == pDamage) {
>  		ErrorF ("Damage already on window list\n");
> -		abort ();
> +		OsAbort ();
>  	    }
>  #endif
>  	pDamage->pNextWin = *pPrev;
> @@ -2040,7 +2040,7 @@ DamageUnregister (DrawablePtr	    pDrawable,
>  #if DAMAGE_VALIDATE_ENABLE
>  	if (!found) {
>  	    ErrorF ("Damage not on window list\n");
> -	    abort ();
> +	    OsAbort ();
>  	}
>  #endif
>      }
> diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
> index 5320956..e78e2c8 100644
> --- a/miext/rootless/rootlessWindow.c
> +++ b/miext/rootless/rootlessWindow.c
> @@ -978,7 +978,7 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
>                  copy_rect.y2 = oldY2;
>              }
>              else
> -                abort();
> +                OsAbort();
>  
>              Bpp = winRec->win->drawable.bitsPerPixel / 8;
>              copy_rect_width = copy_rect.x2 - copy_rect.x1;
> diff --git a/os/log.c b/os/log.c
> index 03dc11f..0002e59 100644
> --- a/os/log.c
> +++ b/os/log.c
> @@ -413,7 +413,7 @@ AbortServer(void)
>      AbortDDX();
>      fflush(stderr);
>      if (CoreDump)
> -	abort();
> +	OsAbort();
>      exit (1);
>  }
>  
> @@ -537,7 +537,7 @@ FatalError(const char *f, ...)
>  	beenhere = TRUE;
>  	AbortServer();
>      } else
> -	abort();
> +	OsAbort();
>      /*NOTREACHED*/
>  }
>  
> commit ca364ca82a760d8e5347a6f9f79636c9a5e4e03f
> Author: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
> Date:   Thu Jan 28 11:08:33 2010 +0200
> 
>     os: Introduce OsAbort for proper core dumps.
>     
>     Signed-off-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
>     Reviewed-by: Keith Packard <keithp at keithp.com>
>     Signed-off-by: Keith Packard <keithp at keithp.com>
> 
> diff --git a/include/os.h b/include/os.h
> index dad1af7..453ab82 100644
> --- a/include/os.h
> +++ b/include/os.h
> @@ -262,6 +262,8 @@ extern _X_EXPORT void OsBlockSignals (void);
>  
>  extern _X_EXPORT void OsReleaseSignals (void);
>  
> +extern _X_EXPORT void OsAbort (void);
> +
>  #if !defined(WIN32)
>  extern _X_EXPORT int System(char *);
>  extern _X_EXPORT pointer Popen(char *, char *);
> diff --git a/os/utils.c b/os/utils.c
> index 79399fa..21e25e0 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -1310,6 +1310,18 @@ OsReleaseSignals (void)
>  #endif
>  }
>  
> +/*
> + * Pending signals may interfere with core dumping. Provide a
> + * mechanism to block signals when aborting.
> + */
> +
> +void
> +OsAbort (void)
> +{
> +    OsBlockSignals();
> +    abort();
> +}
> +
>  #if !defined(WIN32)
>  /*
>   * "safer" versions of system(3), popen(3) and pclose(3) which give up



More information about the xorg-devel mailing list