mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: 兔子猪 <3264430019@qq.com>
Cc: musl <musl@lists.openwall.com>
Subject: Re: [musl][PATCH]fix tsd's issue
Date: Tue, 14 Feb 2023 07:05:15 -0500	[thread overview]
Message-ID: <20230214120515.GT4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <tencent_EA207C332C3F691FF207DFE6DB8F7B9DD807@qq.com>

On Tue, Feb 14, 2023 at 03:25:23PM +0800, 兔子猪 wrote:
> Currently, I am trying to port jemalloc to musl, I have found a issue "the return value of pthread_getspecific is not correct". The reasons are as follows:
> 1, Jemalloc uses pthread_key_t to implement cache feature, if codes call malloc, pthread_create_key will called and tsd will be initizlized.
> 2, Musl calls malloc before updating TLS size in dl stage 3.
> 3, New created initial_tls doesn't carry builtin_tls's tsd.
> 
> 
> The attached patch could fix this issue, please review it, thanks.

An interposed malloc being reachable before the crt1 entry point is a
bug that needs to be fixed. This is a context where it's not valid to
call any application-provided code. Where does the call happen from?
dynlink.c itself uses the internal malloc but I guess there's
somewhere the interposable malloc is getting called indirectly from.

Rich

  reply	other threads:[~2023-02-14 12:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  7:25 =?gb18030?B?zcPX09bt?=
2023-02-14 12:05 ` Rich Felker [this message]
2023-02-14 13:44   ` Rich Felker
2023-02-15  1:45     ` [musl] =?gb18030?B?u9i4tKO6IFttdXNsXVtQQVRDSF1maXggdHNkJ3MgaXNzdWU=?= =?gb18030?B?zcPX09bt?=

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230214120515.GT4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=3264430019@qq.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).