kdump crashes on illegal signal argument to sigaction

From: Michiel Boland <michiel_at_boland.org>
Date: Tue, 11 Jul 2006 21:02:45 +0200 (MEST)
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
_at__at_ -151,7 +151,10 _at__at_
  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
Received on Tue Jul 11 2006 - 17:02:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC