[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8013) SIGSEGV in test_filter()



This is a multi-part message in MIME format.
--------------070304060303090304060107
Content-Type: text/plain; charset=windows-1251; format=flowed
Content-Transfer-Encoding: 7bit

Please review attached patch and merge.

Leonid.

---

The attached files is derived from OpenLDAP Software. All of the 
modifications
to OpenLDAP Software represented in the following patch(es) were 
developed by
Peter-Service LLC, Moscow, Russia. Peter-Service LLC has not assigned 
rights
and/or interest in this work to any party. I, Leonid Yuriev am 
authorized by
Peter-Service LLC, my employer, to release this work under the following 
terms.

Peter-Service LLC hereby places the following modifications to OpenLDAP 
Software
(and only these modifications) into the public domain. Hence, these
modifications may be freely used and/or redistributed for any purpose
with or without attribution and/or other notice.

--------------070304060303090304060107
Content-Type: text/x-patch;
 name="its8013.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="its8013.patch"

commit 51051e4142a43e37bc622775e4f816d38d2e269c
Author: Leo Yuriev <leo@yuriev.ru>
Date:   2015-01-01 16:44:50 +0300

    ITS#8013 fix rare SIGSEGV in test_filter().
    
    Clear PS_FIX_FILTER while alter the filter in syncprov_matchops().

diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index 2eeda4c..53432b0 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -1308,7 +1308,9 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
 				/* Skip the AND/GE clause that we stuck on in front. We
 				   would lose deletes/mods that happen during the refresh
 				   phase otherwise (ITS#6555) */
-				op2.ors_filter = ss->s_op->ors_filter->f_and->f_next;
+				assert(ss->s_op->ors_filter->f_choice == LDAP_FILTER_AND);
+				op2.ors_filter = op2.ors_filter->f_and->f_next;
+				ss->s_flags ^= PS_FIX_FILTER;
 			}
 			ldap_pvt_thread_mutex_unlock( &ss->s_mutex );
 			rc = test_filter( &op2, e, op2.ors_filter );
@@ -2241,6 +2243,7 @@ syncprov_detach_op( Operation *op, syncops *so, slap_overinst *on )
 
 	/* Skip the AND/GE clause that we stuck on in front */
 	if ( so->s_flags & PS_FIX_FILTER ) {
+		assert(op2->ors_filter->f_choice == LDAP_FILTER_AND);
 		op2->ors_filter = op->ors_filter->f_and->f_next;
 		so->s_flags ^= PS_FIX_FILTER;
 	} else {
@@ -2394,7 +2397,6 @@ syncprov_search_response( Operation *op, SlapReply *rs )
 				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 				/* syncprov_ab_cleanup will free this syncop */
 				return SLAPD_ABANDON;
-
 			} else {
 				ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
 				/* Turn off the refreshing flag */

--------------070304060303090304060107--