[LTP] [PATCH v2] openposix: timer_*/speculative: Handle SIGSEGV on invalid timer ID
Petr Vorel
pvorel@suse.cz
Tue Sep 29 15:24:58 CEST 2026
> Hi!
> > I'm not sure if the approach of creating bogus timer_t is a good idea anyway.
> > Shouldn't be just some timer_t tid set to invalid value? That would IMHO be
> > less awkward solution.
> There is no documented invalid value. It's a opaque handle we get from
> libc and different versions of libc interpret the value differently.
> Sometimes it's a pointer, sometimes it is not and we have no idea what
> it is until we try to pass it to the timer functions.
> So choosing safe enough safe value and handling SIGSEGV is probably the
> best we can do.
I trust Cyril that this is safer.
FYI, not sure how much relevant, but the change was reported by Rich Felker
(musl author) in 2013 [1]. IEEE Std 1003.1-2008, 2016 Edition is the first
standard which introduced it as an undefined behavior [2]:
The behavior is undefined if the value specified by the timerid argument to
timer_delete() does not correspond to a timer ID returned by timer_create()
but not yet deleted by timer_delete().
The last standard *without* is IEEE Std 1003.1, 2013 Edition [3].
Kind regards,
Petr
[1] https://austingroupbugs.net/view.php?id=659
[2] https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/functions/timer_delete.html
[3] https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/timer_delete.html
More information about the ltp
mailing list