Monday, September 21, 2020

[389-users] Re: A plugin to record modification timestamp and modifiers DN for specific attribute

> On 22 Sep 2020, at 00:48, Jan Tomasek <jan@tomasek.cz> wrote:
>
> Hi William,
>
>> An interesting idea that could bring you a lot assurance, would be to
>> integrate and test with Address Sanitiser. This would help you find
>> and detect potential memory safety issues in the plugin. If you want
>> some advice on how to do this, I'm happy to help.
>
> Using Address Sanitiser is completely new topic to me. But I would like
> to give it try, if you would by so nice to provide me with pointers how
> to start.

Sure, you'll probably need to build the 389-ds rpms with the correct options or at least a local build from our development page since ns-slapd also needs ASAN enabled to work in this case. You should *not* run ASAN in production (due to elevated risk of crashing on a fault, and there is a potential root priv esc iirc from it). So this is for testing only :)

https://www.port389.org/docs/389ds/contributing.html#building-the-project

If I recall, you can do:

ASAN_ON=1 make -f rpm.mk rpms


Then in your own makefile, you need to define these extra CFLAGS:

-fsanitize=address -fno-omit-frame-pointer -lasan


Build your plugin as normal, and to check that it is build correctly you can see if asan required by the plugin:

$ ldd /opt/dirsrv/lib/dirsrv/plugins/libautomember-plugin.so | grep -i asan
libasan.so.6 => /usr/lib64/libasan.so.6 (0x00007fa3a92ea000)

If you see that, you're good to go and do your tests. You'll want to run ns-slapd in the foreground to get the output.

ns-slapd -d 0 -D /etc/dirsrv/slapd-instance


If asan finds a fault it will crash and put a trace in to the console that gives details about where the memory fault occured.


Hope that this (quick/rough) guide helps :)


>
> Thanks
> --
> -----------------------
> Jan Tomasek aka Semik
> http://www.tomasek.cz/
>


Sincerely,

William Brown

Senior Software Engineer, 389 Directory Server
SUSE Labs, Australia
_______________________________________________
389-users mailing list -- 389-users@lists.fedoraproject.org
To unsubscribe send an email to 389-users-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-users@lists.fedoraproject.org

No comments:

Post a Comment