Bug 27417 - glibc lacks define for sigev_notify_thread_id
Summary: glibc lacks define for sigev_notify_thread_id
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2021-02-14 20:40 UTC by Aliaksey Kandratsenka
Modified: 2021-02-15 09:27 UTC (History)
2 users (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Aliaksey Kandratsenka 2021-02-14 20:40:43 UTC
On linux (and freebsd) man page for sigevent lists support for event notification kind that sends given signal to given thread.

Linux kernel headers define sigev_notify_thread_id in linux/signal.h, but this header is actually unusable in practice: https://bugzilla.kernel.org/show_bug.cgi?id=200081

Both freebsd and musl actually have this macro defined under <signal.h>, so would be reasonable for glibc to also do same.

I guess this might be relevant to "famous" issue of glibc not having gettid exposed as well. Since in order to use this kind of sigevent someone needs to use tid. But tid is straightforward to get by using syscall function.

Also notably, glibc does "support" the feature by having sigevent struct with _sigev_un._tid field, just not via "standard" naming.

Context: gperftools cpu profiler has a feature to use per-thread cpu time timers for profiling "ticks", since stock interval timers commonly have skewed tickings. E.g. see: https://github.com/golang/go/issues/14434. And using per-thread cpu timers obviously depends on this sigevent feature.