#49243 SEGV in memberOf fixup
Closed: wontfix Opened by firstyear.

Issue Description

ASAN:DEADLYSIGNAL
=================================================================
==3747==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000002c (pc 0x7f0df454e7ac bp 0x7f0dea755ea8 sp 0x7f0dad66a7f0 T59)
==3747==The signal is caused by a READ memory access.
==3747==Hint: address points to the zero page.
    #0 0x7f0df454e7ab in ?? ../../src/txn/txn.c:468:0
    #1 0x7f0df454e7ab in __txn_begin ../../src/txn/txn.c:251:0
    #2 0x7f0df454eec5 in __txn_begin_pp ../../src/txn/txn.c:139:0
    #3 0x7f0df14a1090 in dblayer_txn_begin_ext /home/william/development/389ds/ds/ldap/servers/slapd/back-ldbm/dblayer.c:3369:0
    #4 0x7f0df14a1552 in dblayer_txn_begin /home/william/development/389ds/ds/ldap/servers/slapd/back-ldbm/dblayer.c:3429:0
    #5 0x7f0df14a9f22 in dblayer_plugin_begin /home/william/development/389ds/ds/ldap/servers/slapd/back-ldbm/dblayer.c:4858:0
    #6 0x7f0dfee5113d in slapi_back_transaction_begin /home/william/development/389ds/ds/ldap/servers/slapd/backend.c:667:0
    #7 0x7f0df09ac38b in memberof_fixup_task_thread /home/william/development/389ds/ds/ldap/servers/plugins/memberof/memberof.c:3054:0
    #8 0x7f0dfcdc4e8a in _pt_root /usr/src/debug/nspr-4.13.1/pr/src/pthreads/../../../nspr/pr/src/pthreads/ptthread.c:216:0
    #9 0x7f0dfcb8436c in start_thread /usr/src/debug/glibc-2.25-80-ga10e9c4/nptl/pthread_create.c:456:0
    #10 0x7f0dfc45d5be in __GI___clone /usr/src/debug////////glibc-2.25-80-ga10e9c4/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97:0
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libdb-5.3.so+0x1647ab)
Thread T59 created by T37 here:
    #0 0x7f0dff7c2a5f in pthread_create _asan_rtl_:0
    #1 0x7f0dfcdc4b69 in _PR_CreateThread /usr/src/debug/nspr-4.13.1/pr/src/pthreads/../../../nspr/pr/src/pthreads/ptthread.c:457:0
Thread T37 created by T0 here:
    #0 0x7f0dff7c2a5f in pthread_create _asan_rtl_:0
    #1 0x7f0dfcdc4b69 in _PR_CreateThread /usr/src/debug/nspr-4.13.1/pr/src/pthreads/../../../nspr/pr/src/pthreads/ptthread.c:457:0
==3747==ABORTING

This appears to be related to

/* Begin transaction */
int dblayer_plugin_begin(Slapi_PBlock *pb)
{
    int return_value = -1;
    back_txnid    parent;
    back_txn    current;
    Slapi_Backend *be;
    slapi_pblock_get(pb, SLAPI_BACKEND, &be);
    slapi_pblock_get( pb, SLAPI_PARENT_TXN, (void**)&parent );
    if (NULL == be) {
        Slapi_DN *sdn;
        slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
        if (NULL == sdn) {

It appears that PARENT_TXN is never set in our code, most code uses SLAPI_TXN. I wonder if this needs to be SLAPI_TXN instead? Alternately, does this need to just be removed?

I0> grep -r -n -e 'PARENT_TXN' .   
./ldap/servers/slapd/back-ldbm/dblayer.c:4843:    slapi_pblock_get( pb, SLAPI_PARENT_TXN, (void**)&parent );
./ldap/servers/slapd/pblock.c:1966:    case SLAPI_PARENT_TXN:
./ldap/servers/slapd/pblock.c:3704:    case SLAPI_PARENT_TXN:
./ldap/servers/slapd/slapi-plugin.h:7343:#define SLAPI_PARENT_TXN           190

So this can never be satisfied. For now, I think that a work around could be to NULL this from the pblock, and to remove this statement because it's not possible to satisfy.

@tbordaz @lkrispen ?


0001-Ticket-49243-segv-in-memberof-fixup.patch

Test with dirsrvtests/tests/tickets/ticket47560_test.py

Metadata Update from @firstyear:
- Custom field reviewstatus adjusted to review
- Custom field type adjusted to defect

Metadata Update from @firstyear:
- Issue assigned to firstyear

Metadata Update from @mreynolds:
- Custom field reviewstatus adjusted to ack (was: review)

commit f2c1416d2cd23c381f923d3313ccf6106b1b6084
To ssh://git@pagure.io/389-ds-base.git
0804c43..620d037 master -> master

Metadata Update from @firstyear:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/2302

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: fixed)

Metadata