Hi again,

I've just been attempting to package Naviserver for Debian Wheezy.

Using tip (and I think also with v4.99.5 tag), I get a stack overflow when
I try to load the nsperm module.

To reproduce, I built on Wheezy (7.1) with:
./autogen.sh --with-tcl=/usr/lib/tcl8.5 --enable-symbols
make
make install

Where Tcl8.5-dev is 8.5.11-2.
Then I just add nsperm.so to the module list to load in the default
nsd-config.tcl and start:
/usr/local/ns/bin/nsd -c -u nsadmin -t /usr/local/ns/conf/nsd-config.tcl

(Error at end of email)
I ran a gdb backtrace which seems to point to something in Ns_ModuleInit:

#5  0x00007ffff2887fd0 in Ns_ModuleInit (server=0x6589e0 "default",
module=<optimized out>) at nsperm.c:194

This doesn't happen when I build on squeeze.
I think this may be because of the stricter hardening defaults in Wheezy:
http://lists.debian.org/debian-devel-announce/2012/02/msg00016.html

In wheezy, tcl8.5-dev's TCL_EXTRA_CFLAGS in tclConfig.sh default to:
TCL_EXTRA_CFLAGS='-g -O2 -fstack-protector --param=ssp-buffer-size=4
-Wformat -Werror=format-security -fno-unit-at-a-time -pipe
-D_FORTIFY_SOURCE=2'
Looks like they then end up in Naviserver's include/MakeFile.global

In Squeeze with tcl8.5-dev at 8.5.8-2 they were:
TCL_EXTRA_CFLAGS='-g -O2 -fno-unit-at-a-time -pipe '

The full error output is included at the end (with the gdb backtrace at the
very end)

Can anyone suggest how to narrow down the root cause here? Is there further
debugging that would be useful?

Thanks yet again..

Regards,
-- 
David


root@naviserverwheezy:~/naviserver# gdb /usr/local/ns/bin/nsd
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/ns/bin/nsd...done.
(gdb) run -c -u nsadmin -t /usr/local/ns/conf/nsd-config.tcl
Starting program: /usr/local/ns/bin/nsd -c -u nsadmin -t
/usr/local/ns/conf/nsd-config.tcl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff637b700 (LWP 25105)]
[New Thread 0x7ffff5b7a700 (LWP 25106)]
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: binder: started
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nsmain: enable
progess statistics for uploads >= 1048576 bytes
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nsmain:
NaviServer/4.99.6 starting
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nsmain: security
info: uid=1001, euid=1001, gid=1001, egid=1001
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nsmain: Tcl
version: 8.5.11
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nsmain: max
files: FD_SETSIZE = 1024, rl_cur = 4096, rl_max = 4096
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Warning: nsmain: rl_cur
> FD_SETSIZE
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Error: pidfile: failed
to open pid file 'nsd.pid': 'Permission denied'
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: queueLength 0
low water 0 high water 0
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice:
nsd/init.tcl[default]: booting virtual server:  tcl system encoding: "utf-8"
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nscp.so
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nscp: listening
on 127.0.0.1:4080
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nscp: added
user:
[New Thread 0x7ffff35a2700 (LWP 25109)]
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nssock.so
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nssock: enable 0
spooler thread(s)
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nssock: enable 0
writer thread(s)
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nslog.so
[New Thread 0x7ffff311a700 (LWP 25110)]
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: nslog: opened
'/usr/local/ns/logs/access.log'
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nscgi.so
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Warning: nscgi: no such
interps section: ns/interps/interps
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Error: nscgi: invalid
directory: /cgi-bin
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Error: nscgi: invalid
directory: /cgi-bin
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nsdb.so
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: modload: loading
nsperm.so
[02/Oct/2013:15:09:32][25102.7ffff7fef700][-main-] Notice: random:
generating 1 seed
[New Thread 0x7ffff2885700 (LWP 25111)]
*** stack smashing detected ***: /usr/local/ns/bin/nsd terminated
[Thread 0x7ffff2885700 (LWP 25111) exited]
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffff6a972a7]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x0)[0x7ffff6a97270]
/usr/local/ns/bin/nsperm.so(+0x1fd0)[0x7ffff2887fd0]
/usr/local/ns/lib/libnsd.so(Ns_ModuleLoad+0x130)[0x7ffff7b865a0]
/usr/local/ns/lib/libnsd.so(NsTclModuleLoadObjCmd+0x1ca)[0x7ffff7b868fa]
/usr/lib/libtcl8.5.so.0(+0x33dbe)[0x7ffff71fddbe]
/usr/lib/libtcl8.5.so.0(+0x764be)[0x7ffff72404be]
/usr/lib/libtcl8.5.so.0(TclObjInterpProcCore+0x2fb)[0x7ffff728227b]
/usr/lib/libtcl8.5.so.0(+0x33dbe)[0x7ffff71fddbe]
/usr/lib/libtcl8.5.so.0(+0x349f5)[0x7ffff71fe9f5]
/usr/lib/libtcl8.5.so.0(Tcl_EvalEx+0x16)[0x7ffff71fe546]
/usr/lib/libtcl8.5.so.0(Tcl_FSEvalFileEx+0x227)[0x7ffff7264077]
/usr/lib/libtcl8.5.so.0(Tcl_EvalFile+0x2f)[0x7ffff7262b6f]
/usr/local/ns/lib/libnsd.so(NsTclInitServer+0x38)[0x7ffff7b9c8b8]
/usr/local/ns/lib/libnsd.so(NsInitServer+0x27d)[0x7ffff7b917cd]
/usr/local/ns/lib/libnsd.so(Ns_Main+0x7e9)[0x7ffff7b87599]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7ffff69c6ead]
/usr/local/ns/bin/nsd[0x400795]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 22241
/usr/local/ns/bin/nsd
00600000-00601000 rw-p 00000000 08:01 22241
/usr/local/ns/bin/nsd
00601000-01797000 rw-p 00000000 00:00 0
[heap]
7ffff2805000-7ffff2806000 ---p 00000000 00:00 0
7ffff2806000-7ffff2886000 rw-p 00000000 00:00 0
7ffff2886000-7ffff288b000 r-xp 00000000 08:01 22246
/usr/local/ns/bin/nsperm.so
7ffff288b000-7ffff2a8a000 ---p 00005000 08:01 22246
/usr/local/ns/bin/nsperm.so
7ffff2a8a000-7ffff2a8b000 rw-p 00004000 08:01 22246
/usr/local/ns/bin/nsperm.so
7ffff2a8b000-7ffff2a94000 r-xp 00000000 08:01 22259
/usr/local/ns/lib/libnsdb.so
7ffff2a94000-7ffff2c93000 ---p 00009000 08:01 22259
/usr/local/ns/lib/libnsdb.so
7ffff2c93000-7ffff2c94000 rw-p 00008000 08:01 22259
/usr/local/ns/lib/libnsdb.so
7ffff2c94000-7ffff2c95000 r-xp 00000000 08:01 22257
/usr/local/ns/bin/nsdb.so
7ffff2c95000-7ffff2e94000 ---p 00001000 08:01 22257
/usr/local/ns/bin/nsdb.so
7ffff2e94000-7ffff2e95000 rw-p 00000000 08:01 22257
/usr/local/ns/bin/nsdb.so
7ffff2e95000-7ffff2e9a000 r-xp 00000000 08:01 22243
/usr/local/ns/bin/nscgi.so
7ffff2e9a000-7ffff3099000 ---p 00005000 08:01 22243
/usr/local/ns/bin/nscgi.so
7ffff3099000-7ffff309a000 rw-p 00004000 08:01 22243
/usr/local/ns/bin/nscgi.so
7ffff309a000-7ffff309b000 ---p 00000000 00:00 0
7ffff309b000-7ffff311b000 rw-p 00000000 00:00 0
7ffff311b000-7ffff3120000 r-xp 00000000 08:01 22245
/usr/local/ns/bin/nslog.so
7ffff3120000-7ffff331f000 ---p 00005000 08:01 22245
/usr/local/ns/bin/nslog.so
7ffff331f000-7ffff3320000 rw-p 00004000 08:01 22245
/usr/local/ns/bin/nslog.so
7ffff3320000-7ffff3322000 r-xp 00000000 08:01 22242
/usr/local/ns/bin/nssock.so
7ffff3322000-7ffff3521000 ---p 00002000 08:01 22242
/usr/local/ns/bin/nssock.so
7ffff3521000-7ffff3522000 rw-p 00001000 08:01 22242
/usr/local/ns/bin/nssock.so
7ffff3522000-7ffff3523000 ---p 00000000 00:00 0
7ffff3523000-7ffff35a3000 rw-p 00000000 00:00 0
7ffff35a3000-7ffff35a6000 r-xp 00000000 08:01 22244
/usr/local/ns/bin/nscp.so
7ffff35a6000-7ffff37a6000 ---p 00003000 08:01 22244
/usr/local/ns/bin/nscp.so
7ffff37a6000-7ffff37a7000 rw-p 00003000 08:01 22244
/usr/local/ns/bin/nscp.so
7ffff37a7000-7ffff4d4f000 rw-p 00000000 00:00 0
7ffff4d4f000-7ffff4d59000 r-xp 00000000 08:01 262831
/lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffff4d59000-7ffff4f58000 ---p 0000a000 08:01 262831
/lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffff4f58000-7ffff4f59000 r--p 00009000 08:01 262831
/lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffff4f59000-7ffff4f5a000 rw-p 0000a000 08:01 262831
/lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffff4f5a000-7ffff4f6f000 r-xp 00000000 08:01 262829
/lib/x86_64-linux-gnu/libnsl-2.13.so
7ffff4f6f000-7ffff516e000 ---p 00015000 08:01 262829
/lib/x86_64-linux-gnu/libnsl-2.13.so
7ffff516e000-7ffff516f000 r--p 00014000 08:01 262829
/lib/x86_64-linux-gnu/libnsl-2.13.so
7ffff516f000-7ffff5170000 rw-p 00015000 08:01 262829
/lib/x86_64-linux-gnu/libnsl-2.13.so
7ffff5170000-7ffff5172000 rw-p 00000000 00:00 0
7ffff5172000-7ffff5179000 r-xp 00000000 08:01 262821
/lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffff5179000-7ffff5378000 ---p 00007000 08:01 262821
/lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffff5378000-7ffff5379000 r--p 00006000 08:01 262821
/lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffff5379000-7ffff537a000 rw-p 00007000 08:01 262821
/lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffff537a000-7ffff537b000 ---p 00000000 00:00 0
7ffff537b000-7ffff5b7b000 rw-p 00000000 00:00 0
7ffff5b7b000-7ffff5b7c000 ---p 00000000 00:00 0
7ffff5b7c000-7ffff637c000 rw-p 00000000 00:00 0
7ffff637c000-7ffff6387000 r-xp 00000000 08:01 262819
/lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffff6387000-7ffff6586000 ---p 0000b000 08:01 262819
/lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffff6586000-7ffff6587000 r--p 0000a000 08:01 262819
/lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffff6587000-7ffff6588000 rw-p 0000b000 08:01 262819
/lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffff6588000-7ffff659f000 r-xp 00000000 08:01 262811
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ffff659f000-7ffff679e000 ---p 00017000 08:01 262811
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ffff679e000-7ffff679f000 r--p 00016000 08:01 262811
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ffff679f000-7ffff67a0000 rw-p 00017000 08:01 262811
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ffff67a0000-7ffff67a4000 rw-p 00000000 00:00 0
7ffff67a4000-7ffff67a6000 r-xp 00000000 08:01 262817
/lib/x86_64-linux-gnu/libdl-2.13.so
7ffff67a6000-7ffff69a6000 ---p 00002000 08:01 262817
/lib/x86_64-linux-gnu/libdl-2.13.so
7ffff69a6000-7ffff69a7000 r--p 00002000 08:01 262817
/lib/x86_64-linux-gnu/libdl-2.13.so
Program received signal SIGABRT, Aborted.
0x00007ffff69da475 in *__GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64    ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

(gdb) backtrace

#0  0x00007ffff69da475 in *__GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff69dd6f0 in *__GI_abort () at abort.c:92
#2  0x00007ffff6a1552b in __libc_message (do_abort=<optimized out>,
fmt=<optimized out>) at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
#3  0x00007ffff6a972a7 in *__GI___fortify_fail (msg=0x7ffff6af50b4 "stack
smashing detected") at fortify_fail.c:32
#4  0x00007ffff6a97270 in __stack_chk_fail () at stack_chk_fail.c:29
#5  0x00007ffff2887fd0 in Ns_ModuleInit (server=0x6589e0 "default",
module=<optimized out>) at nsperm.c:194
#6  0x00007ffff7b865a0 in Ns_ModuleLoad (interp=interp@entry=0x630f20,
server=0x6589e0 "default", module=0x1725200 "nsperm",
    file=0x7fffffffe180 "/usr/local/ns/bin/nsperm.so", init=0x7ffff7bb9656
"Ns_ModuleInit") at modload.c:163
#7  0x00007ffff7b868fa in NsTclModuleLoadObjCmd (arg=0x1718d70,
interp=0x630f20, objc=<optimized out>, objv=<optimized out>) at
modload.c:224
#8  0x00007ffff71fddbe in ?? () from /usr/lib/libtcl8.5.so.0
#9  0x00007ffff72404be in ?? () from /usr/lib/libtcl8.5.so.0
#10 0x00007ffff728227b in TclObjInterpProcCore () from
/usr/lib/libtcl8.5.so.0
#11 0x00007ffff71fddbe in ?? () from /usr/lib/libtcl8.5.so.0
#12 0x00007ffff71fe9f5 in ?? () from /usr/lib/libtcl8.5.so.0
#13 0x00007ffff71fe546 in Tcl_EvalEx () from /usr/lib/libtcl8.5.so.0
#14 0x00007ffff7264077 in Tcl_FSEvalFileEx () from /usr/lib/libtcl8.5.so.0
#15 0x00007ffff7262b6f in Tcl_EvalFile () from /usr/lib/libtcl8.5.so.0
#16 0x00007ffff7b9c8b8 in NsTclInitServer (server=<optimized out>) at
tclinit.c:1214
#17 0x00007ffff7b917cd in NsInitServer (server=server@entry=0x6589e0
"default", staticInitProc=staticInitProc@entry=0x400870 <ServerInit>) at
server.c:295
#18 0x00007ffff7b87599 in Ns_Main (argc=<optimized out>, argv=<optimized
out>, initProc=0x400870 <ServerInit>) at nsmain.c:626
#19 0x00007ffff69c6ead in __libc_start_main (main=<optimized out>,
argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>,
fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fffffffec98) at libc-start.c:228
#20 0x0000000000400795 in _start ()
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to