[LTP] [PATCH] syscalls/shmctl05: new test for IPC file use-after-free bug
Cyril Hrubis
chrubis@suse.cz
Thu Jun 28 11:00:14 CEST 2018
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
More information about the ltp
mailing list