|
Message-ID:
<SE1P216MB2484F022DB76311939D8B0C79E6E2@SE1P216MB2484.KORP216.PROD.OUTLOOK.COM>
Date: Sun, 22 Sep 2024 11:19:53 +0000
From: JinCheng Li <naiveli233@...look.com>
To: musl <musl@...ts.openwall.com>
Subject: Do we have any requirements for the notify method which is registered
into the timer_create of Musl, such as not using tsd
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
Content of type "text/html" skipped
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.