diff mbox series

nptl: Fix issue unwinding through sem_wait futex

Message ID 20201111214645.1506645-1-shorne@gmail.com
State New
Headers show
Series nptl: Fix issue unwinding through sem_wait futex | expand

Commit Message

Stafford Horne Nov. 11, 2020, 9:46 p.m. UTC
Calls to sem_wait may use the __futex_abstimed_wait_cancelable64
function that is built in futex-internal.  If we get a C++ exception,
i.e. thread cancel when we are waiting on a semaphore thread unwinding
fails.  Example test: nptl/tst-cancel24

Adding -fexceptions flag when building futex-internal fixes this.
---
 nptl/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Adhemerval Zanella Nov. 12, 2020, 11:38 a.m. UTC | #1
On 11/11/2020 18:46, Stafford Horne via Libc-alpha wrote:
> Calls to sem_wait may use the __futex_abstimed_wait_cancelable64
> function that is built in futex-internal.  If we get a C++ exception,
> i.e. thread cancel when we are waiting on a semaphore thread unwinding
> fails.  Example test: nptl/tst-cancel24
> 
> Adding -fexceptions flag when building futex-internal fixes this.
> ---
>  nptl/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/nptl/Makefile b/nptl/Makefile
> index b30d263ca4..a1ffb6258a 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -220,6 +220,7 @@ CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables
>  CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
>  CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
>  CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
> +CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
>  
>  # These are the function wrappers we have to duplicate here.
>  CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables
> 

I have fixed it with a04689ee7a2600a1466354096123c57ccd1e1dc7, are
you still seeing the same issue with master?
Stafford Horne Nov. 12, 2020, 11:03 p.m. UTC | #2
On Thu, Nov 12, 2020, 8:39 PM Adhemerval Zanella via Libc-alpha <
libc-alpha@sourceware.org> wrote:

>
>
> On 11/11/2020 18:46, Stafford Horne via Libc-alpha wrote:
> > Calls to sem_wait may use the __futex_abstimed_wait_cancelable64
> > function that is built in futex-internal.  If we get a C++ exception,
> > i.e. thread cancel when we are waiting on a semaphore thread unwinding
> > fails.  Example test: nptl/tst-cancel24
> >
> > Adding -fexceptions flag when building futex-internal fixes this.
> > ---
> >  nptl/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/nptl/Makefile b/nptl/Makefile
> > index b30d263ca4..a1ffb6258a 100644
> > --- a/nptl/Makefile
> > +++ b/nptl/Makefile
> > @@ -220,6 +220,7 @@ CFLAGS-pthread_cond_wait.c += -fexceptions
> -fasynchronous-unwind-tables
> >  CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
> >  CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
> >  CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
> > +CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
> >
> >  # These are the function wrappers we have to duplicate here.
> >  CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables
> >
>
> I have fixed it with a04689ee7a2600a1466354096123c57ccd1e1dc7, are
> you still seeing the same issue with master?
>

(Replying on phone)

No I am on about 2 month old master. I'll try the latest.  I checked master
to see if there were any patches addressing this, but I must have missed
it. Hence, I sent the patch.

Thanks for replying with the details.

I'll rebase and report if there are more issues.

I'll also pick up the new syscall errno handling with the rebase. Which
will be good.

-Stafford

>
diff mbox series

Patch

diff --git a/nptl/Makefile b/nptl/Makefile
index b30d263ca4..a1ffb6258a 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -220,6 +220,7 @@  CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
 
 # These are the function wrappers we have to duplicate here.
 CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables