[PATCH] nptl: Fix __libc_cleanup_pop_restore asynchronous restore (BZ#29214)

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Jun 7 12:47:39 GMT 2022



On 07/06/2022 08:20, Florian Weimer via Libc-alpha wrote:
> * Andreas Schwab via Libc-alpha:
> 
>>> +  /* Wait indefinitely for cancellation, which only works if asynchronous
>>> +     cancellation is enabled.  */
>>> +#ifdef SYS_futex
>>> +  syscall (SYS_futex, &(int){0}, FUTEX_WAIT_PRIVATE, 0, NULL, NULL, 0);
>>> +#else
>>> +  for (;;);
>>> +#endif
>>
>> Should that handle SYS_futex_time64?

Indeed, riscv32 for instance is using the loop instead.

> 
> syscall (SYS_pause) should be architecture-agnostic, and like any
> syscall-invoked system call, it's not a cancellation point.

It is not in unfortunately:

$ python3 ./sysdeps/unix/sysv/linux/glibcsyscalls.py query-syscall pause
pause:
  defined: arm hppa i386 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 powerpc/powerpc32 powerpc/powerpc64 s390/s390-32 s390/s390-64 sh sparc/s
parc32 sparc/sparc64 x86_64/64 x86_64/x32
  undefined: aarch64 alpha arc csky ia64 nios2 or1k riscv/rv32 riscv/rv64

So we will need to use ppoll and also ppoll_time64.  I think it would
be better to add a libspport to abstract and use glibc internal definition
that handle the ppoll/poll_time64 (since there is no need to handle the
timeout here).


More information about the Libc-alpha mailing list