public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/shmctl05: new test for IPC file use-after-free bug
Date: Thu, 28 Jun 2018 11:00:14 +0200	[thread overview]
Message-ID: <20180628090010.GB8182@rei> (raw)
In-Reply-To: <20180628064612.GA719@sol.localdomain>

Hi!
> Hi, this works well for me too -- thanks!  Though, IIUC it relies on scheduling
> nondeterminism to hit the race.  It might help reproducing bugs like this if
> tst_fzsync_wait_*() cycled through different delay deltas between the two
> threads.

We were talking about something like this with Richard recently, but in
the end we agreed to try to apply the library to a few more testcases to
get a better picture of the real world requirements and obstackles.

I guess that synchronizing with spinlocks like this test does then
introducing slowly graduating delay before we call one of the syscalls
up to some reasonable upper bound a few times sounds reasonable. We
would still have to measure how much time do the syscalls spend in the
kernel so that we have a reasonable estimate for the upper bound, but
that should be doable.

> Also with a fixed kernel, to make the test pass rather than timing out, I had to
> change
> 
> 	while (tst_timer_elapsed_ms() < 5000)
> 
> to
> 
> 	while (tst_timer_stop(), tst_timer_elapsed_ms() < 5000)
>
> It would be nice if there was a simpler supported way to implement time-based
> tests like this.  E.g. the test framework could just save the start time
> automatically for all tests, and then a single function call could return the
> time elapsed so far.

Ah, right, let me fix that first.

The original purpose for the timer library is to measure time spend
doing some operation so the action to sample the end time and to convert
it to interval was separated intentionally.

I will add tst_timer_expired_ms() that could be used as:

tst_timer_start(CLOCK_MONOTONIC);

while (!tst_timer_expired_ms(5000)) {
	...
}

> Anyway, should I go ahead and send a formal v2 patch?

Just let me push the change to the timer library first :-).

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2018-06-28  9:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13  1:23 [LTP] [PATCH] syscalls/shmctl05: new test for IPC file use-after-free bug Eric Biggers
2018-05-18 13:25 ` Cyril Hrubis
2018-06-26 11:35   ` Cyril Hrubis
2018-06-27  6:18     ` Eric Biggers
2018-06-27 10:51       ` Cyril Hrubis
2018-06-27 13:59       ` Cyril Hrubis
2018-06-28  6:46         ` Eric Biggers
2018-06-28  9:00           ` Cyril Hrubis [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=20180628090010.GB8182@rei \
    --to=chrubis@suse.cz \
    --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