[Olsr-dev] OLSRd SegFault

Gabriel (spam-protected)
Wed Apr 20 22:25:31 CEST 2016


On 20/04/2016 21:49, Ferry Huberts wrote:
> Please give me more info so that I can try to reproduce it.
> 
> How did you compile?
I compiled it locally on the machine, i've tryied a couple of times.
These are the commands i use:

git clone https://github.com/OLSR/olsrd.git
cd olsrd
make
make libs
make install
make install_libs


> How did you run?

/usr/local/sbin/olsrd -f /etc/olsrd/olsrd.conf.netjson


> What do your interface look like (ifconfig)?
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 fdc0:ffee::10:150:25:1/128 scope global
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
master br0 state DOWN
    link/ether 04:18:d6:31:37:9f brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN
    link/ether 04:18:d6:31:37:a1 brd ff:ff:ff:ff:ff:ff
    inet 150.***.***.***/24 brd 150.***.***.255 scope global eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::618:d6ff:fe31:37a1/64 scope link
       valid_lft forever preferred_lft forever
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 04:18:d6:31:37:9f brd ff:ff:ff:ff:ff:ff
    inet 10.150.25.1/24 brd 10.150.25.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::9850:fcff:febf:9894/64 scope link
       valid_lft forever preferred_lft forever
6: (spam-protected): <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet 172.19.189.3/16 brd 172.19.255.255 scope global eth1.4
       valid_lft forever preferred_lft forever
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever
7: (spam-protected): <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet 172.19.189.2/16 brd 172.19.255.255 scope global eth1.3
       valid_lft forever preferred_lft forever
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever
8: (spam-protected): <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
master br0 state UP
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever
9: (spam-protected): <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet 172.19.189.1/16 brd 172.19.255.255 scope global eth1.2
       valid_lft forever preferred_lft forever
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever
10: (spam-protected): <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP
    link/ether 04:18:d6:31:37:a0 brd ff:ff:ff:ff:ff:ff
    inet 172.19.189.4/16 brd 172.19.255.255 scope global eth1.5
       valid_lft forever preferred_lft forever
    inet6 fe80::618:d6ff:fe31:37a0/64 scope link
       valid_lft forever preferred_lft forever



> 
> When does it crash? During startup?

It crashes immediatly, but looking at the stdout it looks like it
crashes after he interact with some peer.

I've made a test only with br0 as interface and it doesn't crashes.



> 
> It works fine for me.

I think the key point is the MIPS architecture.

2 years ago I found a bug on this architecture.
https://github.com/OLSR/olsrd/commit/f1db5724d04dc92866afe60858c344cc29b0b18e

It was causing a SegFault only on MIPS machines.



> 
> Try to run with a debug version (DEBUG=1) and with -nofork.
> If it crashes then repeat it using strace.


This is the output of gdb backtrace

IP addr (2-hop)  IP addr (1-hop)  Total cost
Received MID from NON SYM neighbor 172.19.64.1
Received MID from NON SYM neighbor 172.19.64.1
Received HNA from NON SYM neighbor 172.19.64.1
Received MID from NON SYM neighbor 172.19.64.1
Received HNA from NON SYM neighbor 172.19.64.1
Received HNA from NON SYM neighbor 172.19.64.1
Adding 172.19.189.4=>172.19.64.1 to link set

Program received signal SIGSEGV, Segmentation fault.
0x00425844 in set_loss_link_multiplier (entry=0x4a4d08) at
src/link_set.c:361
361	  OLSR_PRINTF(1, "Set linkloss multiplier for %s on %s to %d\n",
(gdb) bt
#0  0x00425844 in set_loss_link_multiplier (entry=0x4a4d08) at
src/link_set.c:361
#1  0x004265a0 in add_link_entry (local=0x4a3474, remote=0x7fdff194,
remote_main=0x7fdff050, vtime=20000, htime=2000, local_if=0x4a3408) at
src/link_set.c:602
#2  0x00426ce4 in update_link_entry (local=0x4a3474, remote=0x7fdff194,
message=0x7fdff048, in_if=0x4a3408) at src/link_set.c:702
#3  0x00440ee4 in olsr_hello_tap (message=0x7fdff048, in_if=0x4a3408,
from_addr=0x7fdff194) at src/process_package.c:417
#4  0x00440d70 in olsr_input_hello (ser=0x493a40, inif=0x4a3408,
from=0x7fdff194) at src/process_package.c:385
#5  0x0043d484 in parse_packet (olsr=0x4939b4, size=196, in_if=0x4a3408,
from_addr=0x7fdff194) at src/parser.c:397
#6  0x0043da90 in olsr_input (fd=11, data=0x0, flags=1) at src/parser.c:511
#7  0x004460a0 in poll_sockets () at src/scheduler.c:382
#8  0x00446b3c in olsr_scheduler () at src/scheduler.c:540
#9  0x00430ab4 in main (argc=6, argv=0x7fdff934) at src/main.c:738
(gdb)





This is strace, i cutted out just the interesting part:


recvfrom(11,
"\3\230\220d\312,\0000\254\23\2613\1\1\221w^\364\377\377\254\23?\00022\0\0\254\23\261\0"...,
1504, 0, {sa_family=AF_INET, sin_port=htons(698),
sin_addr=inet_addr("172.19.191.3")}, [16]) = 920
write(1, "Adding 172.19.189.1=>172.19.191."..., 46Adding
172.19.189.1=>172.19.191.3 to link set
) = 46
open("/dev/urandom", O_RDONLY)          = 18
read(18, ")\221gS", 4)                  = 4
close(18)                               = 0
open("/dev/urandom", O_RDONLY)          = 18
read(18, "\21\245k\241", 4)             = 4
close(18)                               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
open("/usr/local/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 18
fstat64(18, {st_mode=S_IFREG|0644, st_size=18896, ...}) = 0
old_mmap(NULL, 18896, PROT_READ, MAP_PRIVATE, 18, 0) = 0x77e32000
close(18)                               = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
directory)
open("/lib/mips-linux-gnu/libgcc_s.so.1", O_RDONLY) = 18
read(18,
"\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0\311\320\0\0\0004"...,
512) = 512
fstat64(18, {st_mode=S_IFREG|0644, st_size=220288, ...}) = 0
old_mmap(NULL, 242752, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
18, 0) = 0x77baa000
mprotect(0x77bd5000, 65536, PROT_NONE)  = 0
old_mmap(0x77be5000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 18, 0x2b000) = 0x77be5000
close(18)                               = 0
munmap(0x77e32000, 18896)               = 0
time(NULL)                              = 1461183802
send(6, "<27>Apr 20 20:23:22 olsrd[17615]"..., 39, MSG_NOSIGNAL) = 39
time(NULL)                              = 1461183803
send(6, "<27>Apr 20 20:23:23 olsrd[17615]"..., 68, MSG_NOSIGNAL) = 68
write(1, "Received signal Segmentation fau"..., 51Received signal
Segmentation fault - shutting down
) = 51



Thanks, Gabriel
> 
> 
> 
> On 20/04/16 21:37, Gabriel wrote:
>>
>>
>> On 20/04/2016 21:34, Ferry Huberts wrote:
>>>
>>>
>>> On 20/04/16 21:29, Gabriel wrote:
>>>> Hi, apparently this is the the segmentation fault's day.
>>>>
>>>> On the same router of the previous email (Edgerouter MIPS) I was trying
>>>> to update olsrd to use the netjson plugin.
>>>>
>>>> I fetched the latest version from github and compiled it, but when i
>>>> try
>>>> to run it (without loading netjson plugin) it dies with a Segmentation
>>>> Fault.
>>>>
>>>> The olsrd version is pre-0.9.1-git_564e1b1
>>>>
>>>> and this is the last lines it prints:
>>>>
>>>> IP addr (2-hop)  IP addr (1-hop)  Total cost
>>>> Adding 172.19.189.1=>172.19.191.3 to link set
>>>> Received signal Segmentation fault - shutting down
>>>> Deleting all routes...
>>>> RIB: del prefix 10.150.25.1/32 from 10.150.25.1
>>>> Closing sockets...
>>>> Closing plugins...
>>>> Restoring network state
>>>> Free all memory...
>>>>
>>>>
>>>> The olsrd version from apt (0.6.2) is working fine.
>>>>
>>>>
>>>> Any hints? is this version (0.9.1) backward compatible ?
>>>
>>>
>>> Always update olsrd AND all its plugins at the same time
>>
>> Yes of course. I use the absolute path.
>>
>>
>> This is what i found in /var/log/messages:
>>
>> Apr 20 19:21:53 ubnt olsrd[15029]: crash
>> Apr 20 19:21:53 ubnt olsrd[15029]: /usr/local/sbin/olsrd() [0x42eb64]
>> Apr 20 19:22:30 ubnt olsrd[15032]: olsrd exit: main
>>
>>
>> This is my conf:
>>
>> (spam-protected):~# cat /etc/olsrd/olsrd.conf.netjson
>> AllowNoInt yes
>> RtTable 111
>> RtTableDefault 112
>> FIBMetric "flat"
>> LinkQualityLevel 2
>> LinkQualityAlgorithm "etx_ff"
>> OlsrPort 698
>> Willingness 3
>> NatThreshold 1.0
>> MainIp 10.150.25.1
>> IpVersion 4
>>
>> Hna4
>> {
>>         10.150.25.0 255.255.255.0
>> }
>>     
>>        
>>                
>> LoadPlugin "/usr/local/lib/olsrd_arprefresh.so.0.1"
>> {
>> }
>>                
>> LoadPlugin "/usr/local/lib/olsrd_nameservice.so.0.3"
>> {
>>     PlParam "name" "santaMarta"
>>     PlParam "suffix" ".nnx"
>> }
>>                        
>> LoadPlugin "/usr/local/lib/olsrd_txtinfo.so.0.1"
>> {
>>     PlParam "accept" "0.0.0.0"
>> }
>>                        
>> LoadPlugin "/usr/local/lib/olsrd_mdns.so.1.0.1"
>> {
>>     PlParam "NonOlsrIf" "br-lan"
>>     PlParam "TTL-Check" "1"
>>     PlParam "Network-ID" "1"
>> }
>>                                        
>> LoadPlugin "/usr/local/lib/olsrd_jsoninfo.so.0.0"
>> {
>>     PlParam "accept" "0.0.0.0"
>>       PlParam "port" "2007"
>> }
>>
>> #LoadPlugin "/usr/local/lib/olsrd_netjson.so.1.0"
>> #{
>> #    PlParam "accept" "0.0.0.0"
>> #    PlParam "port" "2005"
>> #}
>>                                            
>> InterfaceDefaults
>> {
>>     Mode "mesh"
>> }
>>                                                
>> Interface "eth1.3"
>> {
>> }
>>                                                
>> Interface "eth1.2"
>> {
>> }                                           
>>                                                        
>> Interface "eth1.4"   
>> {
>> }
>>
>> Interface "eth1.5"
>> {
>> }   
>>
>>
>> Thanks, Gabriel
>>
> 





More information about the Olsr-dev mailing list