Bug#1099624: libc6 2.41 pthread cause pari to FTBFS
On Thu, Mar 06, 2025 at 07:17:25PM +0100, Aurelien Jarno wrote:
> On 2025-03-06 19:03, Bill Allombert wrote:
> > >
> > > Do you have more details about that? I have tried to build pari locally,
> > > and it builds fine. On which architecture is that? In which version?
> >
> > Is there a way to do a bisection ? I think this would settle the matter.
> >
>
> It's what I was currently doing. I found that the issue is caused by this
> upstream commit:
> https://sourceware.org/git/?p=glibc.git;a=commit;h=89b53077d2a58f00e7debdfe58afabe953dac60d
Wow! Thanks a lot!
> This is the corresponding bug that got fixed by this commit:
> https://sourceware.org/bugzilla/show_bug.cgi?id=12683
>
> Compiling pari with -fsanitize=address, I get this trace for the double
> free:
>
> ==3034379==ERROR: AddressSanitizer: attempting double-free on 0x511000010800 in thread T12:
(but only with glibc 2.41)
Now, you can skip the (impossible ?) double free by applying the attached patch and ignoring
memory leaks with ASAN_OPTIONS=detect_leaks=false, but then the test still fails sometime
Thread 2422 "gp-sta" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7bfd989ef6c0 (LWP 1877815)]
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000055555632cf76 in mt_queue_run (arg=0x0) at ../src/mt/pthread.c:170
#2 0x00007ffff785bc96 in asan_thread_start (arg=0x7bfeff75b000) at ../../../../src/libsanitizer/asan/asan_interceptors.cpp:239
#3 0x00007ffff73da990 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:456
#4 0x00007ffff74587b8 in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)
You should be able reproduce this bug by typing
export(f=i->1/0);for(i=1,1000,iferr(parsum(i=1,10,f(i)),E,print1(".")))
inside gp.
I also tried to remove the call to
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
in src/mt/pthread.c (see second patch)
but I still get crashes and SEGV only with 2.41.
Cheers,
--
Bill. <ballombe@debian.org>
Imagine a large red swirl here.
diff --git a/src/mt/pthread.c b/src/mt/pthread.c
index 1170f0a7a0..c6f5728ad1 100644
--- a/src/mt/pthread.c
+++ b/src/mt/pthread.c
@@ -154,7 +154,6 @@ static void
mt_queue_cleanup(void *arg)
{
(void) arg;
- pari_thread_close();
}
static void
diff --git a/src/mt/pthread.c b/src/mt/pthread.c
index 1170f0a7a0..7e7b9bff93 100644
--- a/src/mt/pthread.c
+++ b/src/mt/pthread.c
@@ -154,7 +154,6 @@ static void
mt_queue_cleanup(void *arg)
{
(void) arg;
- pari_thread_close();
}
static void
@@ -188,9 +187,9 @@ mt_queue_run(void *arg)
pari_mainstack = mq->mainstack;
set_avma(mq->avma);
work = mq->input;
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
+ // pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
done = closure_callgenvec(mq->worker,work);
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
+ // pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
LOCK(mq->pmut)
{
mq->mainstack = pari_mainstack;
Reply to: