trouble porting dash shell (make errors)

Dmitry Marakasov amdmi3 at amdmi3.ru
Sun Nov 8 05:29:20 UTC 2009


* Eitan Adler (eitanadlerlist at 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 at amdmi3.ru  ..:  jabber: amdmi3 at jabber.ru    http://www.amdmi3.ru


More information about the freebsd-ports mailing list