0

I'm testing smokeping's DNS probes with the echoping program as per the documentation, but for me this is causing a segmentation fault when the command is executed by smokeping. I grabbed the command that smokeping is trying to run from systemctl status smokeping.service and tried to run it myself as my normal user and root:

echoping -w 1 -p 6 -t 1 -6 -m /usr/lib/echoping/dns.so -n 20 facebook.com -t AAAA --tcp facebook.com

It exits due to a: Segmentation fault (core dumped)

strace output is here.

The distribution of my test box is Arch Linux 4.20 kernel. I've tested this on LTS kernel 4.19 too which is also unsuccessful.

Any ideas?

EDIT:

Actual command smokeping is trying to run:

echoping -w 1 -P 0xa0 -p 6 -t 1 -6 -m /usr/lib/echoping/dns.so -n 20 facebook.com -t AAAA --tcp facebook.com

(I missed the -P 0xa0 because I tried omitting the flag before posting but should have copied the command prior to the most recent that I ran...)

UPDATE:

backtrace from the core dump:

$ gdb /usr/bin/echoping core.27236 
GNU gdb (GDB) 8.2.1
...
Reading symbols from /usr/bin/echoping...(no debugging symbols found)...done.
[New LWP 27236]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `echoping -w 1 -P 0xa0 -p 6 -t 1 -6 -m /usr/lib/echoping/dns.so -n 20 facebook.c'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f73c938246a in init () from /usr/lib/echoping/dns.so

(gdb) backtrace full
#0  0x00007f73c938246a in init () from /usr/lib/echoping/dns.so
No symbol table info available.
#1  0x0000564855557d58 in main ()
No symbol table info available.
  • What does the backtrace in the coredump say? It's unlikely that the SEGV is from a system call. – Chris Down Apr 22 at 21:11
  • @ChrisDown as it happens I'm not seeing a core dump in the cwd. Is the dump placed elsewhere? – unkle_junky Apr 22 at 21:17
  • @ChrisDown just reading this: stackoverflow.com/questions/2065912/… so I'll update when I figure out where the core dump goes. – unkle_junky Apr 22 at 21:27
  • @ChrisDown I've updated the question with the backtrace. – unkle_junky Apr 22 at 22:07
1

That's simply a bug in echoping(1), and you should go report it (after checking if they hadn't already fixed it in the last version).


In the util.c file from its source code, they have this little c-x-er:

char           *
to_upper(char *input)
{
        int             c;
        char           *result;
        result = (char *) malloc(strlen(input));
        for (c = 0; c < strlen(input); c++)
                result[c] = toupper((int)input[c]);
        result[strlen(input)] = '\0';
        return result;
}

Notice how result[strlen(input)] will write 1 byte beyond the length of the buffer allocated with malloc().

But that's not all; instead of declaring the correct prototype of to_upper() (which returns a 64 bit pointer on x86-64), they let the compiler assume that it returns a 32 bit int and force cast its return value to (char*) in plugins/dns/dns.c:

char           *
init(const int argc, const char **argv)
{
   ...
                upper_type_name = (char *) to_upper(type_name);

This latter really kills it, and I don't think that has ever run on x86-64; your only hope is to configure your system as multiarch and install echoping as a 32bit binary; example (not tested) for debian:

apt-get remove echoping
dpkg --add-architecture i386
apt-get update
apt-get install echoping:i386

[I've used the sources of echoping-6.0.2, that I've got with apt-get source echoping in debian 9.]

  • I wouldn't know how to contact the developer as echoping isn't on GitHub and I can't find it at Sourceforge. This is a terrific answer though. – unkle_junky Apr 23 at 2:02
  • It looks like it's not developed anymore. The multiarch + i386 binary approach seems to work, but that command will die with "IPv6 name servers not supported on this platform, may be you should use the -4 option". – mosvy Apr 23 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.