All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls: epoll_pwait01: Work around a race
Date: Wed, 13 Jan 2021 01:54:35 +0100	[thread overview]
Message-ID: <X/5Ey68D0T8oYInJ@pevik> (raw)
In-Reply-To: <20210112132911.4031-1-chrubis@suse.cz>

Hi Cyril,

> There was a race that would manifest on slower machines.

> The call to epoll_pwait() could time out before the child has chance to
> run, and that would cause the signal to be sent to the parent when it
> was already sleeping in wait().

> Ideally the whole test should be rewritten into new library and fixed
> properly, however as we are just before a release this is an attempt for
> a minimal fix.

> The logic in the test is changed so that:

> - epoll_wait() sleeps indefinitely
> - the child:
>   - waits for the parent to get asleep
>   - sends the signal
>   - sleeps
>   - writes to the pipe

> This causes the child to actually run, while the parent is blocked in
> the epoll_wait(), which greatly increases the changes of the signal
> arriving at the right time.

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

> Fixes: #765

Kind regards,
Petr

  reply	other threads:[~2021-01-13  0:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 13:29 [LTP] [PATCH] syscalls: epoll_pwait01: Work around a race Cyril Hrubis
2021-01-13  0:54 ` Petr Vorel [this message]
2021-01-13  8:41 ` Li Wang

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=X/5Ey68D0T8oYInJ@pevik \
    --to=pvorel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.