mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Do we have any requirements for the notify method which is registered into the timer_create of Musl, such as not using tsd
@ 2024-09-22 11:19 JinCheng Li
  0 siblings, 0 replies; only message in thread
From: JinCheng Li @ 2024-09-22 11:19 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Hi

I found when using timer_create in hwasan, after call 'notify' function once, musl will call cleanup_fromsig and run __pthread_tsd_run_dtors. Then the hwasan tsd destructor will be done and cleared. After then we step into notify the second time,  and becauese the hwasan tsd has been cleared,  when the hwasan check has been triggered, sigv will happened.  Why MUSL need do pthread_cleanup_push ,pthread_cleanup_pop and clear all tsd after notify? Does this mean that timed callbacks involving tsd may have issues executing in the timer_create of musl, for example the tsd in hwasan.


static void cleanup_fromsig(void *p)
{
    pthread_t self = __pthread_self();
    __pthread_tsd_run_dtors();
    self->cancel = 0;
    self->cancelbuf = 0;
    self->canceldisable = 0;
    self->cancelasync = 0;
    __reset_tls();
    longjmp(p, 1);
}


...
    for (;;) {
        siginfo_t si;
        while (sigwaitinfo(SIGTIMER_SET, &si) < 0);
        if (si.si_code == SI_TIMER && !setjmp(jb)) {
            pthread_cleanup_push(cleanup_fromsig, jb);
            notify(val);
            pthread_cleanup_pop(1);
        }
        if (self->timer_id < 0) break;
    }
...


Best
Li

[-- Attachment #2: Type: text/html, Size: 8136 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-22 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-22 11:19 [musl] Do we have any requirements for the notify method which is registered into the timer_create of Musl, such as not using tsd JinCheng Li

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).