From: Li Wang <li.wang@linux.dev>
To: Jan Stancek <jstancek@redhat.com>
Cc: LTP List <ltp@lists.linux.it>, linuxtestproject.agent@gmail.com
Subject: Re: [LTP] openposix: timers/twoevtimers: Wait for both timer signals
Date: Sun, 11 Oct 2026 09:07:37 +0800 [thread overview]
Message-ID: <asrhWVwAvAYLtBM3@linux.dev> (raw)
In-Reply-To: <CAASaF6wO7=9vHVJ3BxE307tFc1n_xbJEihw1EMECsRNhxvvDHw@mail.gmail.com>
> > > On Fri, 9 Oct 2026, Jan Stancek via ltp wrote:
> > > > openposix: timers/twoevtimers: Wait for both timer signals
> > >
> > > > + PTS_WRITE_MSG("Caught abort signal\n");
> > > > + PTS_WRITE_MSG("Caught alarm signal\n");
> > > > + if (errno != EINTR) {
> > > > + perror("nanosleep() did not return success\n");
> > > > + return PTS_UNRESOLVED;
> > > > + }
> > >
> > > Medium: PTS_WRITE_MSG() calls write() without preserving errno. If the
> > > second signal arrives after nanosleep() sets EINTR but before the new
> > > errno check, a failed handler write (e.g. EAGAIN on a full nonblocking
> > > stdout pipe) causes a spurious unresolved result even when both timers
> > > fired. Save errno on entry and restore it before returning in both
> > > handlers.
> >
> > The race condition pointed out by the AI seems plausible. Would it make
> > sense to save and restore errno in the signal handlers, like this:
> >
>
> It seems very unlikely. I was thinking to move the print outside of signal
> handler if we want to address it.
Agreed, moving the prints from the handlers is the better fix.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-10-11 1:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 6:49 [LTP] [PATCH] openposix: timers/twoevtimers: Wait for both timer signals Jan Stancek via ltp
2026-10-09 10:09 ` [LTP] " linuxtestproject.agent
2026-10-09 10:52 ` [LTP] [PATCH v2] " Jan Stancek via ltp
2026-10-09 17:26 ` [LTP] " linuxtestproject.agent
2026-10-10 9:06 ` Li Wang
2026-10-10 9:42 ` Jan Stancek via ltp
2026-10-11 1:07 ` Li Wang [this message]
2026-10-12 4:56 ` [LTP] [PATCH v3] " Jan Stancek via ltp
2026-10-12 7:19 ` [LTP] " linuxtestproject.agent
2026-10-12 8:03 ` [LTP] [PATCH v4] " Jan Stancek via ltp
2026-10-12 9:33 ` Petr Vorel
2026-10-12 15:47 ` [LTP] " linuxtestproject.agent
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=asrhWVwAvAYLtBM3@linux.dev \
--to=li.wang@linux.dev \
--cc=jstancek@redhat.com \
--cc=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
/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