Re: Plugin-in Guide for 1.4.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 31 Aug 2020, at 19:27, Jan Tomasek <jan@xxxxxxxxxx> wrote:
> 
> Hi Mark,
> 
> On 8/28/20 2:51 PM, Mark Reynolds wrote:
>> Sorry the plugin guide has not been maintained in a long time. There was a discussion to just remove it.  Can you provide the stack trace from the crash?  I'm sure we help get it straightened out...
> 
> you are very kind. My C knowledge is kinda outdated, it's about 20years I last time created something bigger in C.
> 
> I'm fighting with gdb how to be able trace debug 389 ds with plugin loaded:
> 
> root@ldap33:~# gdb /usr/sbin/ns-slapd
> 
>> (gdb) run -d 65536  -D /etc/dirsrv/slapd-ldap33 -i /var/run/dirsrv/slapd-ldap33.pid
>> Starting program: /usr/sbin/ns-slapd -d 65536  -D /etc/dirsrv/slapd-ldap33 -i /var/run/dirsrv/slapd-ldap33.pid
>> [Thread debugging using libthread_db enabled]
>> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>> [31/Aug/2020:11:14:36.396980567 +0200] - DEBUG - syntax-plugin - => bin_init
>> ...
>> [31/Aug/2020:11:15:11.443569660 +0200] - ERR - altpass-plugin - do_pre_bind: 1
>> [31/Aug/2020:11:15:11.445011559 +0200] - ERR - altpass-plugin - do_pre_bind: 2
>> [31/Aug/2020:11:15:11.446302153 +0200] - ERR - altpass-plugin - do_pre_bind: 3
>> [31/Aug/2020:11:15:11.447546080 +0200] - ERR - altpass-plugin - do_pre_bind: 4
>> [31/Aug/2020:11:15:11.448848356 +0200] - ERR - altpass-plugin - do_pre_bind: 5
>> [31/Aug/2020:11:15:11.450387903 +0200] - ERR - altpass-plugin - do_pre_bind: 6
>> [31/Aug/2020:11:15:11.451510488 +0200] - ERR - altpass-plugin - do_pre_bind: 7
>> [31/Aug/2020:11:15:11.453559193 +0200] - ERR - altpass-plugin - do_pre_bind: 8
>> [31/Aug/2020:11:15:11.454709087 +0200] - ERR - altpass-plugin - do_pre_bind: 9
>> [31/Aug/2020:11:15:11.455636136 +0200] - ERR - altpass-plugin - do_pre_bind: 9a
>> [31/Aug/2020:11:15:11.456657442 +0200] - ERR - altpass-plugin - do_pre_bind: 9a: filter=(memberNisNetgroup=2001:718:1:6::134:138)
>> Thread 17 "ns-slapd" received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0x7fffd0ff9700 (LWP 28079)]
>> 0x00007ffff4318b52 in do_pre_bind () from /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
>> (gdb) bt
>> #0  0x00007ffff4318b52 in do_pre_bind () at /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
>> #1  0x00007ffff4318f3b in pre_bind () at /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
>> #2  0x00007ffff7f0c409 in None () at /usr/lib/x86_64-linux-gnu/dirsrv/libslapd.so.0
>> #3  0x00007ffff7f0c654 in plugin_call_plugins () at /usr/lib/x86_64-linux-gnu/dirsrv/libslapd.so.0
>> #4  0x000055555556907e in None ()
>> #5  0x000055555557045a in None ()
>> #6  0x00007ffff7c13ec7 in None () at /usr/lib/x86_64-linux-gnu/libnspr4.so
>> #7  0x00007ffff7bb3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
>> #8  0x00007ffff77ed4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
> 
> When I set breakpoint at start of do_pre_bind():

Reading this trace, it looks like you are missing debug symbols or devel information. Honestly, I'm not sure how to get this on debian, maybe "pkgname-dbgsym" aka 389-ds-dbgsym or similar needs to be installed? 

> 
>> (gdb) b do_pre_bind
>> Breakpoint 1 at 0x7ffff431879a
>> (gdb) r
>> The program being debugged has been started already.
>> Start it from the beginning? (y or n) y
>> [Switching to Thread 0x7fffd0ff9700 (LWP 28116)]
>> Thread 17 "ns-slapd" hit Breakpoint 1, 0x00007ffff431879a in do_pre_bind () from /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
>> (gdb) (gdb) l
>> 1	../sysdeps/x86_64/crti.S: No such file or directory.
>> (gdb) 
> 
> Tips how to properly set debug environment would be very welcome. I was unable to locate crti.S anywhere in debian packages https://packages.debian.org/search?searchon=contents&keywords=x86_64%2Fcrti.S&mode=path&suite=stable&arch=any
> 
> Source code around SIGSEGV place:

Well, you need to also compile your plugin with debug symbols too in order to see what's going on in there ... I think you can add -g3 to your gcc invocation to do this. There isn't really a penalty to having debug symbols around even for production, so feel free to leave -g3 in your compiler calls. 

> 
>>    slapi_entry_free(user_entry);
>>    user_entry = NULL;
>>    log_fatal("do_pre_bind: 9\n");
>>    // Find corresponding service(s)
>>    char filter[200];
>>    snprintf(filter, sizeof(filter), "(memberNisNetgroup=%s)", clientIP);
>>    log_fatal("do_pre_bind: 9a\n");
>>    log_fatal("do_pre_bind: 9a: filter=%s\n", filter);
>>    find_entries(conf->group_suffix, filter, attributes, &matching_services);
> 
> function find_entries() is never entered.

If there is a segfault around here, then it would likely be in the snprintf call. clientIP may be NULL, which could cause this. You could check this with "if (!clientIP) { ... }" and then log a message.

Hope that helps, 

> 
> Thanks
> -- 
> -----------------------
> Jan Tomasek aka Semik
> http://www.tomasek.cz/
> 
> _______________________________________________
> 389-users mailing list -- 389-users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to 389-users-leave@xxxxxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxxxxxxxx

—
Sincerely,

William Brown

Senior Software Engineer, 389 Directory Server
SUSE Labs
_______________________________________________
389-users mailing list -- 389-users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora User Discussion]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora News]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora QA]     [Fedora Triage]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Yosemite Photos]     [Linux Apps]     [Maemo Users]     [Gnome Users]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]     [Maemo Users]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Fedora ARM]

  Powered by Linux