public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] Refactor timer_getoverrun test using new LTP API
Date: Mon, 30 Oct 2023 14:56:06 +0100	[thread overview]
Message-ID: <ZT-19kgC8PqKMlb8@yuki> (raw)
In-Reply-To: <20230904111940.26824-1-andrea.cervesato@suse.de>

Hi!
> +	switch (tst_variant) {
> +	case 0:
> +		SAFE_TIMER_CREATE(CLOCK_REALTIME, &ev, &timer);
> +		TST_EXP_POSITIVE(timer_getoverrun(timer));
> +
> +		/* glibc causes SIGSEGV where timer_getoverrun() fails with EINVAL */
> +#ifndef __GLIBC__
> +		TST_EXP_FAIL(timer_getoverrun((timer_t)-1), EINVAL);
> +#endif

I wonder if we should even keep it here, the most likely end result is
that we will have to add to this ifdef once other libc implementations
attempt to interpret the id before passing it to kernel. Maybe we should
just remove it and save our future time.

> +		break;
> +	case 1:
> +		tst_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer);
> +		TST_EXP_POSITIVE(tst_syscall(__NR_timer_getoverrun, timer));
> +		TST_EXP_FAIL(tst_syscall(__NR_timer_getoverrun, -1), EINVAL);

There are actually two different cases that can cause EINVAL in the
kernel, first obvious case is that we id > INT_MAX, the second case is
failed lookup. I suppose that the -1 gets casted to unsigned long long
in kernel and ends up > INT_MAX.

I guess to trigger the second case we can call timer_delete(timer); and
then test it as:
		TST_EXP_FAIL(tst_syscall(__NR_timer_getoverrun, timer), EINVAL);

-- 
Cyril Hrubis
chrubis@suse.cz

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

  parent reply	other threads:[~2023-10-30 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 11:19 [LTP] [PATCH v2] Refactor timer_getoverrun test using new LTP API Andrea Cervesato
2023-10-02 10:43 ` Richard Palethorpe
2023-10-30 13:34   ` Cyril Hrubis
2023-10-30 13:56 ` Cyril Hrubis [this message]
2023-11-16 15:13   ` Andrea Cervesato via ltp

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=ZT-19kgC8PqKMlb8@yuki \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --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