From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Martin Doucha <martin.doucha@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] openposix: timer_*/speculative: Handle SIGSEGV on invalid timer ID
Date: Tue, 29 Sep 2026 15:24:58 +0200 [thread overview]
Message-ID: <20260929132458.GA2471077@pevik> (raw)
In-Reply-To: <aruobnaT_g0U7CDo@yuki.lan>
> 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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-09-29 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 15:03 [LTP] [PATCH v2] openposix: timer_*/speculative: Handle SIGSEGV on invalid timer ID Avinesh Kumar via ltp
2026-08-08 15:31 ` [LTP] " linuxtestproject.agent
2026-09-29 11:49 ` [LTP] [PATCH v2] " Petr Vorel
2026-09-29 12:00 ` Cyril Hrubis
2026-09-29 12:16 ` Petr Vorel
2026-09-29 13:24 ` Petr Vorel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929132458.GA2471077@pevik \
--to=pvorel@suse.cz \
--cc=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=martin.doucha@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox