Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <avinesh.kumar@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3] openposix: timer_*/speculative: fork() to isolate the SIGSEGV on old glibc
Date: Wed, 30 Sep 2026 11:10:21 +0200	[thread overview]
Message-ID: <20260930091021.GB2623399@pevik> (raw)
In-Reply-To: <20260930084603.947906-1-avinesh.kumar@suse.com>

Hi Avinesh,

> Commit d377d1cff1ec ("openposix: timer_*/speculative: Don't pass a
> stack pointer as timerid") fixed a SIGSEGV on i586, where current
> glibc's sign-bit check (timer_is_sigev_thread()) can misread a stack
> address as a tagged pointer. A small constant avoids that.

> But older glibc (<= 2.31, before this check existed) unconditionally
> dereferences timerid as a pointer, so the same small constant now
> faults instead:

>   timer_delete_sp[13131]: segfault at 186a3 ip 00007f15973aed4e sp 00007ffefb52c5a0 error 4 in librt-2.31.so[7f15973aa000+8000]

> fork() a child to make the call, then inspect the child's exit status.
> POSIX defines no required behavior for an invalid timer ID (EINVAL is
> only a recommendation), so the child being killed by SIGSEGV or SIGBUS
> is treated as success.

> Fixes: d377d1cff1ec ("openposix: timer_*/speculative: Don't pass a stack pointer as timerid")
> Suggested-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
> ---
>  .../interfaces/timer_delete/speculative/5-1.c | 56 +++++++++++-----
>  .../timer_getoverrun/speculative/6-1.c        | 55 +++++++++++-----
>  .../timer_gettime/speculative/6-1.c           | 58 +++++++++++-----
>  .../timer_settime/speculative/12-1.c          | 66 +++++++++++++------
>  4 files changed, 169 insertions(+), 66 deletions(-)

> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c
> index dce9277b5d6a..8e7d1b2e54dc 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c
> @@ -5,34 +5,58 @@
>   * of this license, see the COPYING file at the top level of this
>   * source tree.

> - * Test to see if timer_delete() returns -1 and sets errno==EINVAL if
> - * timerid is not a valid timer ID or not.
> - * Since this is a "may" requirement, either option is a PASS.
> + * Test to see if timer_delete() sets errno==EINVAL for an invalid
> + * timerid. Recent POSIX versions leave this behavior undefined, so

nit: I suggest before merge to mention the version:

"Recent POSIX versions leave" => "/Since POSIX 2016 Edition is"

(no need for v4). Why? In 5+ years we can hopefully delete those tests.
Specifying the version saves somebody searching it again.

The code itself LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-09-30  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 12:47 [LTP] [PATCH] openposix: timer_*/speculative: Handle SIGSEGV on old glibc Avinesh Kumar via ltp
2026-09-29 17:50 ` [LTP] " linuxtestproject.agent
2026-09-29 19:31 ` [LTP] [PATCH v2] openposix: timer_*/speculative: fork() to isolate the " Avinesh Kumar via ltp
2026-09-29 22:04   ` [LTP] " linuxtestproject.agent
2026-09-30  7:35     ` Petr Vorel
2026-09-30  8:46       ` [LTP] [PATCH v3] " Avinesh Kumar via ltp
2026-09-30  9:10         ` Petr Vorel [this message]
2026-09-30 10:12           ` Cyril Hrubis
2026-09-30 12:02             ` Petr Vorel

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=20260930091021.GB2623399@pevik \
    --to=pvorel@suse.cz \
    --cc=avinesh.kumar@suse.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