mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] atexit: Unlock after executing exit functions
@ 2020-04-02  3:56 wangjianjian (C)
  2020-04-02 15:08 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: wangjianjian (C) @ 2020-04-02  3:56 UTC (permalink / raw)
  To: musl; +Cc: Songyunlong (Euler)

From 0bf59dbec10f1267419696ee5b3aa9ace1379ee2 Mon Sep 17 00:00:00 2001
From: Wang Jianjian <wangjianjian3@huawei.com>
Date: Thu, 2 Apr 2020 11:51:13 +0800
Subject: [PATCH] atexit: Unlock after executing exit functions

Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
---
 src/exit/atexit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/exit/atexit.c b/src/exit/atexit.c
index 160d277a..d30db5df 100644
--- a/src/exit/atexit.c
+++ b/src/exit/atexit.c
@@ -27,6 +27,7 @@ void __funcs_on_exit()
 		func(arg);
 		LOCK(lock);
 	}
+	UNLOCK(lock);
 }
 
 void __cxa_finalize(void *dso)
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] [PATCH] atexit: Unlock after executing exit functions
  2020-04-02  3:56 [musl] [PATCH] atexit: Unlock after executing exit functions wangjianjian (C)
@ 2020-04-02 15:08 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2020-04-02 15:08 UTC (permalink / raw)
  To: musl

On Thu, Apr 02, 2020 at 03:56:58AM +0000, wangjianjian (C) wrote:
> >From 0bf59dbec10f1267419696ee5b3aa9ace1379ee2 Mon Sep 17 00:00:00 2001
> From: Wang Jianjian <wangjianjian3@huawei.com>
> Date: Thu, 2 Apr 2020 11:51:13 +0800
> Subject: [PATCH] atexit: Unlock after executing exit functions
> 
> Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
> ---
>  src/exit/atexit.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/exit/atexit.c b/src/exit/atexit.c
> index 160d277a..d30db5df 100644
> --- a/src/exit/atexit.c
> +++ b/src/exit/atexit.c
> @@ -27,6 +27,7 @@ void __funcs_on_exit()
>  		func(arg);
>  		LOCK(lock);
>  	}
> +	UNLOCK(lock);
>  }
>  
>  void __cxa_finalize(void *dso)
> -- 
> 2.17.1

This patch is not correct and not fixing any bug; rather it introduces
a race condition whereby it's possible for atexit() to return success
adding a new handler, but the handler never runs.

On a higher level, a patch like this needs a commit message (or email
body text intended to be reworded into one) explaining what behavior
you believe is being fixed by the patch. As submitted the title
doesn't give any hint at a reason why it should be done.

Rich

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-02 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02  3:56 [musl] [PATCH] atexit: Unlock after executing exit functions wangjianjian (C)
2020-04-02 15:08 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).