public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3] af_alg07: add dynamic bias for ARM
Date: Thu, 03 Dec 2020 12:32:54 +0000	[thread overview]
Message-ID: <878saf6pe1.fsf@suse.de> (raw)
In-Reply-To: <20201203110616.28302-3-liwang@redhat.com>

Hello,

Li Wang <liwang@redhat.com> writes:

> We observed that af_alg07 sporadically failed on hpe-moonshot(aarch64) with
> fixed kernel, but after trying manually we can NOT reproduce it again, one
> possibility is that the FAIL is caused by an unaligned race window between
> two threads, so here add dynamic bias adjustment to see if it helps.
>
> Point of view from Martin Doucha:
> 1) fchownat() returns 0 => fchownat() was called too early or the kernel is vulnerable
> 2) fchwonat() fails with ENOENT => kernel is fixed, print TPASS and exit
> 3) fchownat() fails with EBADF => fchownat() was called too late

Just FYI, what really prevents fzsync from working is if the temporal
behaviour (time to execute) of a syscall changes dramatically depending
on the outcome of a race[1].

For example if fchownat returns very quickly after EBADF, but takes a
long time otherwise, then the delay will be too small. I guess most
syscalls will check the FD very early so this is likely to be the
problem.

>
> Signed-off-by: Li Wang <liwang@redhat.com>
> CC: Richard Palethorpe <rpalethorpe@suse.com>
> CC: Martin Doucha <mdoucha@suse.cz>
> CC: Joerg Vehlow <lkml@jv-coder.de>
> CC: Chunyu Hu <chuhu@redhat.com>
> CC: Cyril Hrubis <chrubis@suse.cz>
> ---
>  testcases/kernel/crypto/af_alg07.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/testcases/kernel/crypto/af_alg07.c b/testcases/kernel/crypto/af_alg07.c
> index 539ebee11..ee48c2edb 100644
> --- a/testcases/kernel/crypto/af_alg07.c
> +++ b/testcases/kernel/crypto/af_alg07.c
> @@ -76,6 +76,16 @@ static void run(void)
>  			return;
>  		}
>  
> +		if (TST_RET == 0) {
> +			tst_fzsync_pair_add_bias(&fzsync_pair, -1);
> +			continue;
> +		}

It may actually be better to remove this and only increase the delay if
EBADF?

> +
> +		if (TST_RET == -1 && TST_ERR == EBADF) {
> +			tst_fzsync_pair_add_bias(&fzsync_pair, 1);
> +			continue;
> +		}
> +
>  		if (TST_RET == -1 && TST_ERR == ENOENT) {
>  			tst_res(TPASS | TTERRNO,
>  				"fchownat() failed successfully");

[1] Not necessarily the race which causes the bug.

-- 
Thank you,
Richard.

  reply	other threads:[~2020-12-03 12:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 11:06 [LTP] [PATCH 1/3] lib: add .min_cpus in tst_test struct Li Wang
2020-12-03 11:06 ` [LTP] [PATCH 2/3] syscalls: take use of .min_cpus Li Wang
2020-12-03 11:06 ` [LTP] [PATCH 3/3] af_alg07: add dynamic bias for ARM Li Wang
2020-12-03 12:32   ` Richard Palethorpe [this message]
2020-12-03 14:27     ` Martin Doucha
2020-12-03 12:18 ` [LTP] [PATCH 1/3] lib: add .min_cpus in tst_test struct Richard Palethorpe
2020-12-04  6:33 ` [LTP] [PATCH v2 " Li Wang
2020-12-04  6:33   ` [LTP] [PATCH v2 2/3] syscalls: make use of .min_cpus Li Wang
2020-12-07 14:41     ` Cyril Hrubis
2020-12-04  6:33   ` [LTP] [PATCH v2 3/3] af_alg07: add dynamic bias for ARM Li Wang
2020-12-09  6:12     ` Li Wang
2020-12-09  9:17       ` Richard Palethorpe
2020-12-09 11:26     ` Martin Doucha
2020-12-09 12:37       ` Li Wang
2020-12-07 14:41   ` [LTP] [PATCH v2 1/3] lib: add .min_cpus in tst_test struct Cyril Hrubis

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=878saf6pe1.fsf@suse.de \
    --to=rpalethorpe@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