Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170704222214.GU1627@brightrain.aerifal.cx>
Date: Tue, 4 Jul 2017 18:22:14 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] missing volatile in __get_locale

On Sat, Jun 24, 2017 at 11:54:25AM +0200, Jens Gustedt wrote:
> All int that are used with atomic operations, should be volatile.
> 
> The calls to __lock & Co hid this bug because they implicitly add the
> qualifier to the target. But intelligent lto could have bitten us one
> day.
> ---
>  src/locale/locale_map.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c
> index c3e59174..188fcf39 100644
> --- a/src/locale/locale_map.c
> +++ b/src/locale/locale_map.c
> @@ -26,7 +26,7 @@ static const char envvars[][12] = {
>  
>  const struct __locale_map *__get_locale(int cat, const char *val)
>  {
> -	static int lock[2];
> +	static volatile int lock[2];
>  	static void *volatile loc_head;
>  	const struct __locale_map *p;
>  	struct __locale_map *new = 0;
> -- 
> 2.11.0

Thanks, applying.

Rich

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.