[RFC][BZ #16549] Add sanity check for condvar alignment.

Ondřej Bílka neleai@seznam.cz
Fri Apr 11 21:30:00 GMT 2014


On Fri, Apr 11, 2014 at 10:26:23PM +0200, Torvald Riegel wrote:
> On Tue, 2014-02-11 at 17:07 +0100, Florian Weimer wrote:
> > On 02/11/2014 01:43 PM, Ondřej Bílka wrote:
> > 
> > > A more conservative solution is add assert in initialization to check
> > > alignment. Following patch does that, should be same check added for
> > > mutex/semaphores?
> > 
> > I think the real issue here is our lack of error checking for the futex 
> > system call.  strace on the test case shows this:
> > 
> > [pid 12278] futex(0x6010cd, FUTEX_WAIT_PRIVATE, 1, NULL) = -1 EINVAL 
> > (Invalid argument)
> 
> I do not think this is helpful.  There's lots of undefined behavior in
> the languages and in lots of other places, and there's a reason for
> that.  I agree that this may seem less "forgiving" in face of programmer
> errors, but an assert or returning an error code is unlikely to be
> really a solution.  A buggy program will, I guess, often also not check
> error codes.  Especially for things like synchronization constructs
> where typically, there's no real recovery / alternative solution in a
> program anyway -- if you need mutual exclusion to go on, what do you do
> if you can't get it?  Just stop doing anything?
> 
Torvald, failed assert does terminate a program. Could you explain what
do you mean with error recovery?



More information about the Libc-alpha mailing list