Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Compiling mosquitto with Sanitizers like ASAN MSAN

Please find my diff. This is just a simple hack as of now. Let me know what you think.
https://github.com/basavesh/mosquitto/commit/20c3f9a06e0e626bb7bcb4c9af9361ca9aff653e 

I did find some leaks in mosquitto broker which are not very troublesome. So I assume it is kind of working.

Ex: starting a mosquitto server with a config file and then killing right after (CTRL + C). This leak has been verified through Valgrind too.
"basavesh@Carbon:~/<path>/mosquitto$ ./src/mosquitto -c ~/mosquitto.conf
^C
=================================================================
==17179==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 18 byte(s) in 1 object(s) allocated from:
    #0 0x7f5317f06538 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x77538)
    #1 0x5600aa49dbde in mosquitto__strdup ../lib/memory_mosq.c:147
    #2 0x5600aa46a651 in conf__parse_string /home/<path>/mosquitto/src/conf.c:2378
    #3 0x5600aa473cba in config__read_file_core /home/<path>/mosquitto/src/conf.c:1531
    #4 0x5600aa479914 in config__read_file /home/<path>/mosquitto/src/conf.c:2227
    #5 0x5600aa479cfa in config__read /home/<path>/src/conf.c:643
    #6 0x5600aa47c634 in config__parse_args /home/<path>/src/conf.c:406
    #7 0x5600aa462867 in main /home/<path>/src/mosquitto.c:248
    #8 0x7f5316dc5b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: AddressSanitizer: 18 byte(s) leaked in 1 allocation(s).
"


On Sun, Dec 1, 2019 at 7:38 PM Greg Troxel <gdt@xxxxxxxxxx> wrote:
Basavesh Shivakumar <basavesh.shivakumar@xxxxxxxxx> writes:

> I think I have "successfully" compiled C programs before :)

Sorry, I was not clear.  I meant: Have you built a simple C program, On
the same system you are using, with the same compiler you are using for
mosquitto, with sanitizer options?  Sounds like yes.

> I just wanted to know if people have tested(fuzz?) mosquitto with
> sanitizers enabled. I do understand that I didn't give enough information.
> Anyway, I think I got it. I was not passing "-fsanitize=address" in all the
> required stages.

Please do post a description of what you did, after you are sure you
have it all right.  (I certainly understand that there are a lot of
pieces and easy to miss something.)

Back to the top