Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 23 Jul 2015 09:19:13 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix atexit when it is called from an atexit
 handler

Am Donnerstag, den 23.07.2015, 07:54 +0200 schrieb Jens Gustedt:
> I'd think this could be done even simpler by running the handlers in
> batches. ...

I checked, the strict ordering constraints for the handlers don't
allow for such a strategy, so forget it.

Looking at the code, I am a bit uncomfortable with the idea of a
potentially unlimited number of calloc calls during exit. I think it
would be good if we could restrict the maximal number of successful
calls to atexit during exit to 32. A calloc-free strategy could be to
save head to a tmp a the beginning of processing and to provide a
`struct fl` table on the stack of __funcs_on_exit.

> A similar improvement could be done for at_quick_exit. There I think
> it makes not much sense accepting new handlers during processing. So
> the strategy could just be
> 
>   (i) Take the lock and save count in a tmp
>   (ii) set count to 32
>   (iii) unlock
>   (iv) do the processing
> 
> But looking at it, I think that one can even be more improved. We
> could just use count as atomic, and so we wouldn't need a lock.
> I can prepare a patch for that, if you like.

Since this is fairly simple, I just did it. Please find a new version
attached. (too much changes, a patch makes no sense.)  This compiles,
but I have no code to test this.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::




View attachment "at_quick_exit.c" of type "text/x-csrc" (679 bytes)

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.