lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <490A5698.4080302@shaw.ca>
Date:	Thu, 30 Oct 2008 18:51:36 -0600
From:	Robert Hancock <hancockr@...w.ca>
To:	James Renton <jrenton@...tel.com>
CC:	linux-kernel@...r.kernel.org, Joe Maldonado <jmaldonado@...tel.com>
Subject: Re: sigqueue() losing signals

James Renton wrote:
> I needed to kick off a bunch of background threads and receive
> notification if one failed due to fatal error.  I was hoping waitpid()
> would work; but found out quickly that although each thread has a pid_t;
> threads and processes were not interchangeable.  Without a timed
> pthread_join() over multiple threads (like WIN32
> WaitForMultipleObjects), I formulated a seemingly dead simple
> implementation using signals.  I hacked out a quick prototype to ensure
> I could get the signals to work as desired.  
> 
> When I ran the prototype, I experienced behavior looking very bug-like;
> but I wanted to post it here in case I am misunderstanding unix signals
> and just doing something silly.  I am requesting for comments or
> [hopefully clever] suggestions... Code follows:

For normal signals, you're not guaranteed that the signal handler will 
be called once for every time the signal is raised. You may get only one 
signal handler call for multiple events if they happen in rapid 
succession. Maybe if you use realtime signals it will work. But this 
seems like a bizarre way to accomplish the task.. better to just set 
some pthread condition in your threads when they exit and do a 
pthread_cond_timedwait on that condition in the main thread.

IMHO, in general, when signals are the answer, chances are the question 
is wrong..

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ