Bug 430 - nsd segfault when MAX_INTERFACES set to more than 65K
nsd segfault when MAX_INTERFACES set to more than 65K
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
3.2.x
i386 Linux
: P5 normal
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-19 23:40 CET by Sergey V. Beduev
Modified: 2012-01-20 12:12 CET (History)
1 user (show)

See Also:


Attachments
patch for memory allocating bug for hints struct (583 bytes, application/octet-stream)
2012-01-19 23:40 CET, Sergey V. Beduev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey V. Beduev 2012-01-19 23:40:09 CET
Created attachment 193 [details]
patch for memory allocating bug for hints struct

When I compile nsd with --with-max-ips=1000000 nsd segfault in randomly place of code. 
I propose declare set struct hints as static.  

How to repeat:

1. Compile with options --with-max-ips=1000000
2. Add more than 65K ip addresses 
3. Set option "ip-address: " to listen all these IP in nsd.conf
Comment 1 Wouter Wijngaards 2012-01-20 09:51:26 CET
Hi Sergey,

In svn there is now the struct hints as static.  Also the nodes array is static.  Does this fix things for you?  The stack should now no longer overflow because of the large array (which when static goes into bss).

Best regards,
   Wouter
Comment 2 Sergey V. Beduev 2012-01-20 12:12:47 CET
Yes I have everything working with this patch.

Here are some statistics:
[root@shamanbook shaman]# netstat -naup | grep nsd | wc -l
87857
[root@shamanbook shaman]# ip ad ls dev eth0 | wc -l
87863
[root@shamanbook shaman]#
[shaman@shamanbook ~]$ ps axo pid,user,pri,nice,vsz,rsz,size,s,pcpu,pmem,time,cmd | grep nsd
11748 nsd       19   0  70816 67364 66936 S 62.2  3.2 00:14:57 ./nsd -c /etc/nsd/nsd.conf -d
11771 nsd       19   0  78868 68200 74988 S  0.0  3.3 00:00:00 ./nsd -c /etc/nsd/nsd.conf -d
11772 nsd       19   0  78076 73740 74196 S  0.0  3.5 00:00:00 ./nsd -c /etc/nsd/nsd.conf -d
11799 shaman    19   0   4580   792   296 S  0.0  0.0 00:00:00 grep --color=auto nsd
[shaman@shamanbook ~]$

Thank you