[PATCH] os: Prevent core dump from being truncated.

Daniel Stone daniel at fooishbar.org
Tue Jan 12 03:32:24 PST 2010

On Tue, Jan 12, 2010 at 11:47:47AM +0200, Rami Ylimaki wrote:
> 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 prevent the smart schedule
> timer from expiring before aborting.
> 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>

How about OsBlockSignals(), which will also block SIGIO?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20100112/0d4388ec/attachment-0001.pgp 

More information about the xorg-devel mailing list