On 2012/12/17 14:19, mar...@katamail.com wrote:
> Ettercap crashes on OpenBSD 5.2 i386.
> 
> Steps to reproduce:
> 
> # ettercap -C
> 
> Select "Sniffing"
> 
> Select "Unified sniffing..."
> 
> Confirm the network interface
> 
> After these steps ettercap quits without printing any error message.
> 
> Tested on two machines and I get the same result. Ettercap worked fine on 5.1 
> i386.

I don't know how to fix it but the way ettercap is doing mutex locking
in ec_thread_new() triggers strict mutex checking code in rthreads.

#0  0x00001b5ca5729d4a in kill () at <stdin>:2
#1  0x00001b5ca57904aa in abort () at /usr/src/lib/libc/stdlib/abort.c:70
#2  0x00001b5ca6118505 in _rthread_mutex_lock (mutexp=0x1b5a9ad99320, 
trywait=0, abstime=0x0)
    at /usr/src/lib/librthread/rthread_sync.c:127
#3  0x00001b5a9ab3a4ce in ec_thread_new (name=0x1b5a9ac8502e "top_half", 
    desc=0x1b5a9ac8501b "dispatching module", function=0x1b5a9ab1d73c 
<top_half>, args=0x0) at ec_threads.c:210
#4  0x00001b5a9ab27455 in main (argc=2, argv=0x7f7ffffd5fe0) at ec_main.c:169

ettercap ec_threads.c:

185  * creates a new thread on the given function
186  */
187 
188 pthread_t ec_thread_new(char *name, char *desc, void *(*function)(void *), 
v    oid *args)
189 {
190    pthread_t id;
191 
192    DEBUG_MSG("ec_thread_new -- %s", name);
193 
194    /* 
195     * lock the mutex to syncronize with the new thread.
196     * the newly created thread will perform INIT_UNLOCK
197     * so at the end of this function we are sure that the 
198     * thread had be initialized
199     */
200    INIT_LOCK; 
201 
202    if (pthread_create(&id, NULL, function, args) != 0)
203       ERROR_MSG("not enough resources to create a new thread in this 
process    ");
204 
205    ec_thread_register(id, name, desc);
206 
207    DEBUG_MSG("ec_thread_new -- %lu created ", PTHREAD_ID(id));
208 
209    /* the new thread will unlock this */
210    INIT_LOCK; 
211    INIT_UNLOCK;
212    
213    return id;
214 }

and this is the check which is triggered.

124                         /* self-deadlock is disallowed by strict */
125                         if (mutex->type == PTHREAD_MUTEX_STRICT_NP &&
126                             abstime == NULL)
127                                 abort();

Reply via email to