Bug#391840: ztcfg segfaults because of -O4

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Oct 9 04:05:50 UTC 2006


On Sun, Oct 08, 2006 at 09:37:51PM +0200, Robert Millan wrote:
> Package: zaptel
> Version: 1:1.2.9.1.dfsg-1
> Severity: important
> 
> When compiled with -finline-functions (implied by -O4), ztcfg segfaults:

What is -O4? Should it be -O2? 

> 
> $ sudo gdb --args ztcfg -vvv
> [...]
> (gdb) r
> Starting program: /usr/sbin/ztcfg -vvv
> Notice: Configuration file is /etc/zaptel.conf
> line 221: Cannot get number of tones for channel 1
> line 221: Cannot init tones for channel 1
> line 221: Cannot set rxtone on channel 1
> [...]
> line 221: Cannot set txtone on channel 2
> line 221: Cannot set txtone on channel 2


Could you please provide the zaptel.conf you tested this with? Did you
need to have some actual zaptel channels, or would you get the same
results if all zaptel modules (except zaptel itself) were unloaded?

> 
> Program received signal SIGSEGV, Segmentation fault.
> rad_chanconfig (keyword=<value optimized out>, args=<value optimized out>) at ztcfg.c:937
> 937                                     if (rxtones[i])
> (gdb) p i
> $1 = 33992
> (gdb) bt
> #0  rad_chanconfig (keyword=<value optimized out>, args=<value optimized out>) at ztcfg.c:937
> #1  0x0000000000401430 in main (argc=<value optimized out>, argv=<value optimized out>) at ztcfg.c:1213
> (gdb) quit
> 
> (I guess the segfault condition only happens when you get the rxtone errors
> shown above, so it's possible you can't reproduce this)

Could you please give more information on those errors?

One nice this about those errors is that ztcfg is kind enough to let us
know that an error has occoured, but it keeps on working as if its data
is not trash. It seems ztcfg should have aborted in the call to error()
. Or try to handle the error in some way.

> 
> You might want to add -fno-inline-functions to CFLAGS as a workaround (tested
> and known to work).  Besides, I'm not sure if this also qualifies as a gcc bug
> and should be reported separately.  Could someone enlighten me? :-)
> 
> Ah, there's also this check I added to ensure 'i' will never be bigger than
> the array size.  Not that it was any useful because gcc was screwing our
> stack, but you might like to apply it as well.
> 
> diff -ur zaptel-1.2.9.1.dfsg.old/ztcfg.c zaptel-1.2.9.1.dfsg/ztcfg.c
> --- zaptel-1.2.9.1.dfsg.old/ztcfg.c     2006-02-01 03:33:54.000000000 +0100
> +++ zaptel-1.2.9.1.dfsg/ztcfg.c 2006-10-08 21:22:27.000000000 +0200
> @@ -929,6 +929,8 @@
>                         if (ind_ioctl(x,fd,ZT_RADIO_GETPARAM,&p) == -1)
>                                 error("Cannot get number of tones for channel %d\n",x);
>                         n = p.data;
> +                       if (n > NUM_TONES)
> +                               error("Too many tones for channel %d: %d\n",x,n);
>                         p.radpar = ZT_RADPAR_INITTONE;
>                         if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
>                                 error("Cannot init tones for channel %d\n",x);
> 
> -- System Information:
> Debian Release: testing/unstable
>   APT prefers testing
>   APT policy: (500, 'testing')
> Architecture: amd64 (x86_64)
> Shell:  /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.17-2-amd64
> Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to ca_AD.UTF-8)
> 
> Versions of packages zaptel depends on:
> ii  fxload                    0.0.20020411-1 Firmware download to EZ-USB device
> ii  libc6                     2.3.6.ds1-4    GNU C Library: Shared libraries
> ii  libnewt0.52               0.52.2-7       Not Erik's Windowing Toolkit - tex
> ii  libusb-0.1-4              2:0.1.12-2     userspace USB programming library
> ii  procps                    1:3.2.7-3      /proc file system utilities
> 
> Versions of packages zaptel recommends:
> ii  zaptel-modules-2.6. 1:1.2.9.1.dfsg-1+rmh zaptel modules for Linux (kernel 2
> 
> -- no debconf information
> 
> 
> _______________________________________________
> Pkg-voip-maintainers mailing list
> Pkg-voip-maintainers at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-voip-maintainers
> 

-- 
Tzafrir Cohen         sip:tzafrir at local.xorcom.com
icq#16849755          iax:tzafrir at local.xorcom.com
+972-50-7952406          jabber:tzafrir at jabber.org
tzafrir.cohen at xorcom.com     http://www.xorcom.com




More information about the Pkg-voip-maintainers mailing list