kdump crashes on illegal signal argument to sigaction

Michiel Boland michiel at boland.org
Tue Jul 11 19:02:47 UTC 2006


Hi. Consider the following

#include <signal.h>

int main(void)
{
         sigaction(33, 0, 0);
         return 0;
}

If you compile the above, and then do

  ktrace -tnc ./a.out
  kdump

kdump crashes in signame() because signames[33] points to garbage.

A fix would be something like this:-

--- mksubr.orig	Sat May 20 16:27:22 2006
+++ mksubr	Tue Jul 11 20:57:29 2006
@@ -151,7 +151,10 @@
  void
  signame (int sig)
  {
-	(void)printf("SIG%s",signames[sig]);
+	if (sig >= 0 && sig < NSIG)
+		(void)printf("SIG%s",signames[sig]);
+	else
+		(void)printf("SIG %d", sig);
  }

  /* MANUAL */

Cheers
Michiel


More information about the freebsd-current mailing list