This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Async signal safe TLS accesses
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Andrew Hunter <ahh at google dot com>
- Cc: libc-alpha at sourceware dot org, allan at archlinux dot org, carlos at redhat dot com
- Date: Thu, 2 Jan 2014 18:48:30 -0800
- Subject: Re: [PATCH] Async signal safe TLS accesses
- Authentication-results: sourceware.org; auth=none
- References: <52C4DC54 dot 4000109 at redhat dot com> <1388689454-1854-1-git-send-email-ahh at google dot com>
On Thu, Jan 2, 2014 at 11:04 AM, Andrew Hunter <ahh@google.com> wrote:
> This is version 6 of the patch, containing:
There were still some new build warnings generated, which I fixed ...
> @@ -114,8 +143,17 @@ void
> internal_function __attribute_noinline__
> _dl_allocate_static_tls (struct link_map *map)
> {
> - if (map->l_tls_offset == FORCED_DYNAMIC_TLS_OFFSET
> - || _dl_try_allocate_static_tls (map))
> + /* We wrap this in a signal mask because it has to iterate all threads
> + (including this one) and update this map's TLS entry. A signal handler
> + accessing TLS would try to do the same update and break. */
> + sigset_t old;
> + _dl_mask_all_signals (&old);
> + int err = -1;
> + if (map->l_tls_offset != FORCED_DYNAMIC_TLS_OFFSET)
> + err = _dl_try_allocate_static_tls (map);
> +
> + _dl_unmask_signals (&old);
> + if (err != 0)
> {
> _dl_signal_error (0, map->l_name, NULL, N_("\
> cannot allocate memory in static TLS block"));
This one looks like a possible bug to me:
it will always error if map->l_tls_offset == FORCED_DYNAMIC_TLS_OFFSET.
Shouldn't it be 'int err = 0;' ?
Thanks,
--
Paul Pluzhnikov