miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

miniupnpd 20090214 segfaults
Goto page 1, 2  Next
 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs
View previous topic :: View next topic  
Author Message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Sun Apr 19, 2009 9:00 pm    Post subject: miniupnpd 20090214 segfaults Reply with quote

When I start miniupnpd, it segfaults.

Here is the output of an strace:

Code:

execve("/usr/sbin/miniupnpd", ["miniupnpd", "-d", "-f", "/etc/miniupnpd/miniupnpd.conf"], [/* 32 vars */]) = 0
brk(0)                                  = 0x876e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=22825, ...}) = 0
mmap2(NULL, 22825, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f5f000
close(3)                                = 0
open("/usr/lib/libiptc.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\32\0\0004\0\0\0004"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=54556, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f5e000
mmap2(NULL, 57488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f4f000
mmap2(0xb7f5c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc) = 0xb7f5c000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0ph\1\0004\0\0\0\244"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1351964, ...}) = 0
mmap2(NULL, 1357424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e03000
mmap2(0xb7f49000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x146) = 0xb7f49000
mmap2(0xb7f4c000, 9840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f4c000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e02000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e026c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7f49000, 8192, PROT_READ)   = 0
mprotect(0xb7f5c000, 4096, PROT_READ)   = 0
mprotect(0x8054000, 4096, PROT_READ)    = 0
mprotect(0xb7f83000, 4096, PROT_READ)   = 0
munmap(0xb7f5f000, 22825)               = 0
brk(0)                                  = 0x876e000
brk(0x878f000)                          = 0x878f000
open("/etc/miniupnpd/miniupnpd.conf", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2889, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f64000
read(3, "# WAN network interface\n#ext_ifna"..., 4096) = 2889
read(3, ""..., 4096)                    = 0
close(3)                                = 0
munmap(0xb7f64000, 4096)                = 0
getpid()                                = 30200
open("/var/run/miniupnpd.pid", O_RDONLY) = -1 ENOENT (No such file or directory)
time(NULL)                              = 1240174554
open("/proc/uptime", O_RDONLY)          = 3
read(3, "81355.54 0.00\n"..., 63)       = 14
time(NULL)                              = 1240174554
open("/etc/localtime", O_RDONLY)        = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f64000
read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0\0"..., 4096) = 118
_llseek(4, -6, [112], SEEK_CUR)         = 0
read(4, "\nGMT0\n"..., 4096)            = 6
close(4)                                = 0
munmap(0xb7f64000, 4096)                = 0
writev(2, [{"miniupnpd[30200]: system uptime i"..., 48}, {"\n"..., 1}], 2miniupnpd[30200]: system uptime is 81355 seconds
) = 49
socket(PF_FILE, 0x80002 /* SOCK_??? */, 0) = 4
connect(4, {sa_family=AF_FILE, path="/dev/log"...}, 110) = -1 EPROTOTYPE (Protocol wrong type for socket)
close(4)                                = 0
socket(PF_FILE, 0x80001 /* SOCK_??? */, 0) = 4
connect(4, {sa_family=AF_FILE, path="/dev/log"...}, 110) = 0
send(4, "<30>Apr 19 20:55:54 miniupnpd[302"..., 69, MSG_NOSIGNAL) = 69
close(3)                                = 0
rt_sigaction(SIGTERM, {0x80497fd, [], 0}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x80497fd, [], 0}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0
open("/var/run/miniupnpd.pid", O_WRONLY|O_CREAT|O_EXCL, 0666) = 3
write(3, "30200\n"..., 6)               = 6
close(3)                                = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(3, 6)                            = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(44069), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
time(NULL)                              = 1240174554
writev(2, [{"miniupnpd[30200]: HTTP listening "..., 46}, {"\n"..., 1}], 2miniupnpd[30200]: HTTP listening on port 44069
) = 47
send(4, "<29>Apr 19 20:55:54 miniupnpd[302"..., 67, MSG_NOSIGNAL) = 67
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
bind(5, {sa_family=AF_INET, sin_port=htons(1900), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
setsockopt(5, SOL_IP, IP_ADD_MEMBERSHIP, "\357\377\377\372\300\250\1\1"..., 8) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 6
setsockopt(6, SOL_IP, IP_MULTICAST_LOOP, "\0"..., 1) = 0
setsockopt(6, SOL_IP, IP_MULTICAST_IF, [16885952], 4) = 0
setsockopt(6, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
bind(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("192.168.1.1")}, 16) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
bind(7, {sa_family=AF_INET, sin_port=htons(5351), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
time(NULL)                              = 1240174554
writev(2, [{"miniupnpd[30200]: Listening for N"..., 60}, {"\n"..., 1}], 2miniupnpd[30200]: Listening for NAT-PMP traffic on port 5351
) = 61
send(4, "<29>Apr 19 20:55:54 miniupnpd[302"..., 81, MSG_NOSIGNAL) = 81
socket(PF_INET, SOCK_RAW, IPPROTO_RAW)  = 8
getsockopt(8, SOL_IP, 0x40 /* IP_??? */, "nat\0\223\232\257\21\24gG\300\360\247\0\0\5\0\0\0\5\0\0\0\270fG\300!\216\21\300\31"..., [84]) = 0
getsockopt(8, SOL_IP, 0x41 /* IP_??? */, "nat\0p\301\364\267\270\347v\10\270\347v\10\270\347v\10\10\350v\10\270\7w\10\0\0\0\0\230"..., [2748]) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


any ideas of what is wrong?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Mon Apr 20, 2009 10:10 pm    Post subject: Reply with quote

please recompile with -g flag and run withing gdb :
Code:
gdb ./miniupnpd
run -d -f /etc/miniupnpd/miniupnpd.conf

once it crashed, use "bt" to print the stackframes.
It will help me localize the problem.
By the way, what is your exact configuration ?
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Tue Apr 21, 2009 9:01 am    Post subject: Reply with quote

Here is the output from gdb:

Code:

GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-linux-gnu"...
(gdb) run -d -f /etc/miniupnpd/miniupnpd.conf
Starting program: /usr/sbin/miniupnpd -d -f /etc/miniupnpd/miniupnpd.conf
miniupnpd[7428]: system uptime is 211159 seconds
miniupnpd[7428]: Unable to open pidfile for writing /var/run/miniupnpd.pid: File exists
miniupnpd[7428]: HTTP listening on port 33390
miniupnpd[7428]: Listening for NAT-PMP traffic on port 5351

Program received signal SIGSEGV, Segmentation fault.
0xb7f9e7f0 in iptc_first_rule () from /usr/lib/libiptc.so.0
(gdb) bt
#0  0xb7f9e7f0 in iptc_first_rule () from /usr/lib/libiptc.so.0
#1  0x00000001 in ?? ()
#2  0xb7f98b1c in ?? () from /usr/lib/libiptc.so.0
#3  0x00000000 in ?? ()


And here is my miniupnpd.conf :

Code:

# WAN network interface
#ext_ifname=eth0
ext_ifname=wan
# if the WAN interface has several IP addresses, you
# can specify the one to use below
#ext_ip=

# LAN network interfaces IPs / networks
# there can be multiple listening ips for SSDP traffic.
# should be under the form nnn.nnn.nnn.nnn/nn
# HTTP is available on all interfaces
#listening_ip=192.168.0.1/24
listening_ip=192.168.1.1/24
#listening_ip=
# port for HTTP (descriptions and SOAP) traffic. set 0 for autoselect.
port=0

# path to the unix socket used to communicate with MiniSSDPd
# If running, MiniSSDPd will manage M-SEARCH answering.
# default is /var/run/minissdpd.sock
#minissdpdsocket=/var/run/minissdpd.sock

# enable NAT-PMP support (default is no)
enable_natpmp=yes

# enable UPNP support (default is yes)
enable_upnp=yes

# chain names for netfilter (not used for pf or ipf).
# default is MINIUPNPD for both
#upnp_forward_chain=forwardUPnP
#upnp_nat_chain=UPnP

# lease file location
#lease_file=/var/lib/miniupnpd/upnp.leases

# bitrates reported by daemon in bits per second
bitrate_up=1000000
bitrate_down=10000000

# "secure" mode : when enabled, UPnP client are allowed to add mappings only
# to their IP.
secure_mode=yes
#secure_mode=no

# default presentation url is http address on port 80
#presentation_url=http://www.mylan/index.php

# report system uptime instead of daemon uptime
system_uptime=yes

# notify interval in seconds. default is 30 seconds.
#notify_interval=240
notify_interval=60

# unused rules cleaning.
# never remove any rule before this threshold for the number
# of redirections is exceeded. default to 20
#clean_ruleset_threshold=10
# clean process work interval in seconds. default to 0 (disabled).
# a 600 seconds (10 minutes) interval makes sense
clean_ruleset_interval=600

# log packets in pf
#packet_log=no

# ALTQ queue in pf
# filter rules must be used for this to be used.
# compile with PF_ENABLE_FILTER_RULES (see config.h file)
#queue=queue_name1

# tag name in pf
#tag=tag_name1

# make filter rules in pf quick or not. default is yes
# active when compiled with PF_ENABLE_FILTER_RULES (see config.h file)
#quickrules=no

# uuid : generate your own with "make genuuid"
uuid=8701bc85-5eda-4353-aa9d-76224e51f940

# serial and model number the daemon will report to clients
# in its XML description
serial=12345678
model_number=1

# UPnP permission rules
# (allow|deny) (external port range) ip/mask (internal port range)
# A port range is <min port>-<max port> or <port> if there is only
# one port in the range.
# ip/mask format must be nn.nn.nn.nn/nn
# it is advised to only allow redirection of port above 1024
# and to finish the rule set with "deny 0-65535 0.0.0.0/0 0-65535"
#allow 1024-65535 192.168.0.0/24 1024-65535
allow 1024-65535 192.168.1.0/24 1024-65535
#allow 1024-65535 192.168.0.0/23 22
#allow 12345 192.168.7.113/32 54321
deny 0-65535 0.0.0.0/0 0-65535


Anything else you need? Smile
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Wed Apr 22, 2009 10:34 am    Post subject: Reply with quote

It crashes in libiptc... I guess I have to do some debuging for the version of iptables you compiled with.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Wed Apr 22, 2009 11:00 am    Post subject: Reply with quote

I'll try and compile iptables with debug symbols, and debug it again, and post a new stacktrace.

Would that be of any help? Smile
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Wed Apr 22, 2009 11:44 am    Post subject: Reply with quote

I dont know.
Have you checked that the iptable version is matching netfilter code in kernel ?
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Wed Apr 22, 2009 11:53 am    Post subject: Reply with quote

It should, the kernel is 2.6.29.1 and iptables is 1.4.3.2
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Wed Apr 22, 2009 11:58 am    Post subject: Reply with quote

one more question : are you sure /usr/sbin/miniupnpd is not the striped executable ?
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Wed Apr 22, 2009 12:08 pm    Post subject: Reply with quote

Well, I edited the makefile and removed the strip part, and added the -g flag to the cflags, and rebuilt it.

So it shouldn't have been stripped.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Wed Apr 22, 2009 1:50 pm    Post subject: Reply with quote

GurliGebis wrote:
Well, I edited the makefile and removed the strip part, and added the -g flag to the cflags, and rebuilt it.

So it shouldn't have been stripped.

I was just wondering why the backtrace of stack frames was full of ??
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Thu Apr 23, 2009 10:48 am    Post subject: Reply with quote

I tried compiling both iptables and miniupnpd with -g3 -ggdb , and that seems to give a more usefull stacktrace:

Code:

GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-linux-gnu"...
(gdb) run -d -f /etc/miniupnpd/miniupnpd.conf
Starting program: /usr/sbin/miniupnpd -d -f /etc/miniupnpd/miniupnpd.conf
miniupnpd[23482]: system uptime is 65413 seconds
miniupnpd[23482]: Unable to open pidfile for writing /var/run/miniupnpd.pid: File exists
miniupnpd[23482]: HTTP listening on port 38756
miniupnpd[23482]: Listening for NAT-PMP traffic on port 5351

Program received signal SIGSEGV, Segmentation fault.
iptc_first_rule (chain=0x8050ad3 "MINIUPNPD", handle=0xbf8e0508) at libiptc/libiptc.c:733
733     libiptc/libiptc.c: No such file or directory.
        in libiptc/libiptc.c
(gdb) bt
#0  iptc_first_rule (chain=0x8050ad3 "MINIUPNPD", handle=0xbf8e0508) at libiptc/libiptc.c:733
#1  0x0804f684 in get_redirect_rule_by_index (index=0, ifname=0x0, eport=0xbf8e05a8, iaddr=0x0, iaddrlen=0, iport=0xbf8e05aa, proto=0xbf8e05a4, desc=0xbf8e0560 "��\\\t<", desclen=64, packets=0x0, bytes=0x0)
    at netfilter/iptcrdr.c:250
#2  0x0804e2e5 in ScanNATPMPforExpiration () at natpmp.c:261
#3  0x0804a440 in main (argc=4, argv=0xbf8e0884) at miniupnpd.c:877


Is this better? Smile
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Thu Apr 23, 2009 11:46 am    Post subject: Reply with quote

better, I'll have a look
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Thu Apr 23, 2009 12:17 pm    Post subject: Reply with quote

I got 1.3 installing (had to mess with the Makefile, so it defines IPTABLES_143 without IPTABLESPATH being defined.

It should be fine to define IPTABLES_143 when I know that the user has iptables 1.4.3 or newer installed?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Sat Apr 25, 2009 10:45 pm    Post subject: Reply with quote

GurliGebis wrote:
I got 1.3 installing (had to mess with the Makefile, so it defines IPTABLES_143 without IPTABLESPATH being defined.

It should be fine to define IPTABLES_143 when I know that the user has iptables 1.4.3 or newer installed?

yep. it is for adapting to libiptc API changes in this version
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1442

PostPosted: Sat Apr 25, 2009 10:51 pm    Post subject: Reply with quote

GurliGebis wrote:

Code:

[...]
(gdb) run -d -f /etc/miniupnpd/miniupnpd.conf
Starting program: /usr/sbin/miniupnpd -d -f /etc/miniupnpd/miniupnpd.conf
miniupnpd[23482]: system uptime is 65413 seconds
miniupnpd[23482]: Unable to open pidfile for writing /var/run/miniupnpd.pid: File exists
miniupnpd[23482]: HTTP listening on port 38756
miniupnpd[23482]: Listening for NAT-PMP traffic on port 5351

Program received signal SIGSEGV, Segmentation fault.
iptc_first_rule (chain=0x8050ad3 "MINIUPNPD", handle=0xbf8e0508) at libiptc/libiptc.c:733
733     libiptc/libiptc.c: No such file or directory.
        in libiptc/libiptc.c
(gdb) bt
#0  iptc_first_rule (chain=0x8050ad3 "MINIUPNPD", handle=0xbf8e0508) at libiptc/libiptc.c:733
#1  0x0804f684 in get_redirect_rule_by_index (index=0, ifname=0x0, eport=0xbf8e05a8, iaddr=0x0, iaddrlen=0, iport=0xbf8e05aa, proto=0xbf8e05a4, desc=0xbf8e0560 ""��\\\t<", desclen=64, packets=0x0, bytes=0x0)
    at netfilter/iptcrdr.c:250
#2  0x0804e2e5 in ScanNATPMPforExpiration () at natpmp.c:261
#3  0x0804a440 in main (argc=4, argv=0xbf8e0884) at miniupnpd.c:877

That is strange, netfilter/iptcrdr.c:250 is the call to iptc_init("nat");, iptc_first_rule() is called next.
libiptc/libiptc.c:733 points to iptcc_find_label()
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.