[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#698199: freebsd-utils: kdump incorrectly prints delivery of signals >= 32



Package: freebsd-utils
Version: 9.0+ds1-9
Severity: normal
Tags: patch


Dear Maintainer,
While yak shaving, I noticed that kdumping the progress of a pthreads program
printed things like 
     25935 a.out    PSIG  SIG(null) caught
when the signal number was 32 or 33.  The attached patch fixes the immediate
problem, though it might be preferable to show the names of these signals.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-2-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages freebsd-utils depends on:
ii  libbsd0     0.4.2-1
ii  libc0.1     2.13-37
ii  libcam6     9.0+ds1-4
ii  libgeom1    9.0+ds1-4
ii  libjail1    9.0+ds1-4
ii  libkiconv4  9.0+ds1-4
ii  libkvm0     9.0+ds1-4
ii  libsbuf6    9.0+ds1-4
ii  libtirpc1   0.2.2-5
ii  lsb-base    4.1+Debian8
ii  zlib1g      1:1.2.7.dfsg-13

freebsd-utils recommends no packages.

Versions of packages freebsd-utils suggests:
pn  freebsd-hackedutils  <none>
ii  kbdcontrol           9.0+ds1-9
ii  vidcontrol           9.0+ds1-9

-- no debconf information
diff -Nru freebsd-utils-9.0+ds1/debian/changelog freebsd-utils-9.0+ds1/debian/changelog
--- freebsd-utils-9.0+ds1/debian/changelog	2012-12-29 18:08:30.000000000 -0600
+++ freebsd-utils-9.0+ds1/debian/changelog	2013-01-14 20:45:07.000000000 -0600
@@ -1,3 +1,10 @@
+freebsd-utils (9.0+ds1-9.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Improve reporting of signals >= 32
+
+ -- Jeff Epler <jepler@localhost>  Mon, 14 Jan 2013 20:44:54 -0600
+
 freebsd-utils (9.0+ds1-9) unstable; urgency=low
 
   [ Steven Chamberlain ]
diff -Nru freebsd-utils-9.0+ds1/debian/patches/series freebsd-utils-9.0+ds1/debian/patches/series
--- freebsd-utils-9.0+ds1/debian/patches/series	2012-12-29 18:10:18.000000000 -0600
+++ freebsd-utils-9.0+ds1/debian/patches/series	2013-01-14 20:34:34.000000000 -0600
@@ -49,3 +49,4 @@
 045_implicit-declaration.diff
 devd_link_c++_statically.diff
 stablerestart-fhs-compliance.diff
+signames.diff
diff -Nru freebsd-utils-9.0+ds1/debian/patches/signames.diff freebsd-utils-9.0+ds1/debian/patches/signames.diff
--- freebsd-utils-9.0+ds1/debian/patches/signames.diff	1969-12-31 18:00:00.000000000 -0600
+++ freebsd-utils-9.0+ds1/debian/patches/signames.diff	2013-01-14 20:40:55.000000000 -0600
@@ -0,0 +1,26 @@
+When tracing pthreads programs, kdump prints messages like
+ 25935 a.out    PSIG  SIG(null) caught ...
+this is actually signal 32, which is used internally by the "LinuxThreads"
+implementation.  Signal 33 is also used, which is beyond the signames[]
+array's limit.  Instead of relying on a relationship between NSIG and
+signames[], use the size of the signames array as the limit.
+
+--- a/usr.bin/kdump/kdump.c
++++ b/usr.bin/kdump/kdump.c
+@@ -1128,13 +1128,14 @@
+ 	"PIPE", "ALRM",  "TERM", "URG", "STOP", "TSTP",		/* 13 - 18 */
+ 	"CONT", "CHLD", "TTIN", "TTOU", "IO", "XCPU",		/* 19 - 24 */
+ 	"XFSZ", "VTALRM", "PROF", "WINCH", "29", "USR1",	/* 25 - 30 */
+-	"USR2", NULL,						/* 31 - 32 */
++	"USR2",							/* 31      */
+ };
++#define NSIGNAMES (sizeof(signames) / sizeof(signames[0]))
+ 
+ void
+ ktrpsig(struct ktr_psig *psig)
+ {
+-	if (psig->signo > 0 && psig->signo < NSIG)
++	if (psig->signo > 0 && psig->signo < NSIGNAMES)
+ 		(void)printf("SIG%s ", signames[psig->signo]);
+ 	else
+ 		(void)printf("SIG %d ", psig->signo);

Reply to: