[Date Prev][Date Next]
(ITS#5370) race condition in slap_op_time()
Full_Name: Hallvard B Furuseth
Version: HEAD, RE23, RE24
Submission from: (NULL) (22.214.171.124)
Submitted by: hallvard
slapd/operation.c:slap_op_time() can decrease last_time:
thread 1: *t = slap_get_time();
<clock: increment time()>
thread 2: *t = slap_get_time();
thread 2: with mutex lock: increment last_time, set last_incr = 0;
thread 1: with mutex lock: decrement last_time, set last_incr = 0;
The simplest fix is to move the slap_get_time() call inside the
(global) slap_op_mutex lock.
However as far as I can tell, only the accesslog overlay uses
op->o_tincr, the value which needs the mutex. And accesslog
calls slap_op_time() itself when it needs that value.
So maybe we should remove the op->o_tincr field. Other calls
to slap_op_time() can be replaced with slap_get_time().