Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Nov 2009 08:29:18 +0300
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        Eitan Adler <eitanadlerlist@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: trouble porting dash shell (make errors)
Message-ID:  <20091108052918.GE54527@hades.panopticon>
In-Reply-To: <a0777e080911071338k5d728c2ex637d3b9c62a05414@mail.gmail.com>
References:  <a0777e080911071338k5d728c2ex637d3b9c62a05414@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Eitan Adler (eitanadlerlist@gmail.com) wrote:

> I tried the dash mailing list with no reply.
> mksignames.c is attached.
> 
> Here is the output from ./configure && gmake

You should've use gdb to get a line where it dies:

--
% gdb ./mksignames                 
...
(gdb) run
Starting program: /tmp/dash/dash-0.5.5.1/src/mksignames 
Assertion failed: (arena->magic == ARENA_MAGIC), function arena_malloc, file /usr/src/lib/libc/stdlib/malloc.c, line 3348.

Program received signal SIGABRT, Aborted.
0x2816f7e7 in kill () from /lib/libc.so.7
(gdb) bt
#0  0x2816f7e7 in kill () from /lib/libc.so.7
#1  0x2816f746 in raise () from /lib/libc.so.7
#2  0x2816e4d4 in abort () from /lib/libc.so.7
#3  0x281553f6 in __assert () from /lib/libc.so.7
#4  0x280f512e in malloc_usable_size () from /lib/libc.so.7
#5  0x280f8b26 in malloc () from /lib/libc.so.7
#6  0x0804861d in initialize_signames () at mksignames.c:112
#7  0x08048a98 in main (argc=1, argv=0xbfbfea24) at mksignames.c:414
(gdb) frame 6
#6  0x0804861d in initialize_signames () at mksignames.c:112
112		  signal_names[rtmax-i] = (char *)malloc(RTLEN);
(gdb) print sizeof(signal_names)/sizeof(signal_names[0])
$1 = 67
(gdb) print rtmax-i
$2 = 124
--

Obviously the array is accessed out of bounds.

Size of signal_names is 2*NSIG+3, and given that NSIG (sys/signal.h)
is 32, that is really not enough for signals up to SIGRTMAX (126).

The easiest way to fix it is to add -DUNUSABLE_RT_SIGNALS to compiler
flags. This way it'll ignore realtime signals and only list standart
32 ones.

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091108052918.GE54527>