#50698 ns-slapd dbverify fails with segfault
Closed: wontfix 4 years ago by mreynolds. Opened 4 years ago by sgmt.

Issue Description

ns-slapd dbverify fails with segfault.

The backtrace is as follows.

Core was generated by `/opt/dirsrv/sbin/ns-slapd dbverify -D /etc/dirsrv/slapd-localhost4/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fac05f9f26c in ldbm_back_dbverify (pb=0x9f3520) at ldap/servers/slapd/back-ldbm/dbverify.c:25
25      return priv->dblayer_verify_fn(pb);;
(gdb) bt
#0  0x00007fac05f9f26c in ldbm_back_dbverify (pb=0x9f3520) at ldap/servers/slapd/back-ldbm/dbverify.c:25
#1  0x000000000040f26c in slapd_exemode_dbverify (mcfg=<optimized out>) at ldap/servers/slapd/main.c:2629
#2  main (argc=4, argv=<optimized out>) at ldap/servers/slapd/main.c:865
(gdb) p priv
$1 = (dblayer_private *) 0x0

I suspect that ns-slapd forgets to initialize dblayer_private of ldbm database plugin before using it.
I'm not sure it is appropriate but the followings patch seems to work.

diff --git a/ldap/servers/slapd/back-ldbm/init.c b/ldap/servers/slapd/back-ldbm/init.c
index 893776699..5b651595b 100644
--- a/ldap/servers/slapd/back-ldbm/init.c
+++ b/ldap/servers/slapd/back-ldbm/init.c
@@ -70,6 +70,17 @@ ldbm_back_init(Slapi_PBlock *pb)
     /* Initialize the set of instances. */
     li->li_instance_set = objset_new(&ldbm_back_instance_set_destructor);

+    /* initialize dblayer  */
+    if (dblayer_init(li)) {
+        slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_init", "dblayer_init failed\n");
+        goto fail;
+    }
+
+    if (bdb_init(li, NULL)) {
+        slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_init", "bdb_init failed\n");
+        goto fail;
+    }
+
     /* ask the factory to give us space in the Connection object
          * (only bulk import uses this)
          */

Package Version and Platform

21f2a06
Fedora 31

Steps to reproduce

ns-slapd dbverify -D configdir

Actual results

ns-slapd dbverify fails with segfault.

Expected results

ns-slapd dbverify exits normally.


I see nothing obviously wrong with the patch, what do you think @mreynolds

Metadata Update from @firstyear:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None

4 years ago

It is correct that the init is missing, but dblayer_init is called in dblayer_setup, which then also decides if to call bdb_init or the init for another backend implementation.

I have fixed the crash in dbverify along with others in PR#50671 which is waiting for review quite a while

Reviewing now, I think maybe I missed a review email on 389-devel then as I try to stay on top of these :)

Duplicate of #50659 (which is now fixed)

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

4 years ago

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/3753

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: duplicate)

3 years ago

Login to comment on this ticket.

Metadata