public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: David Hildenbrand <david@redhat.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] crypto/af_alg0[13]: update tests for additional possible errno case
Date: Tue, 5 Nov 2024 11:40:03 +0100	[thread overview]
Message-ID: <20241105104003.GA1573194@pevik> (raw)
In-Reply-To: <20241104153404.21273-1-akumar@suse.de>

Hi Cyril, Jan, David,

> kernel behaviour wrt checking invalid algorithms has changed [1] [2]
> updating the tests to address the additional errno case.
> Related discussion on the mailing list [3]

Looking at 57ab2160c0 ("move_pages04: remove special-casing for kernels < 4.3") [4]
recently reverting errnos for 4.3 d539a004dd ("move_pages04: fix zero page
status code for kernels >= 4.3") [5] please double check this already merged
change. I still believe it's a different case thus merging this is correct.
Also Eric is suggesting this (I should have added Suggested-by: tag for him).

Maybe we need some rules to clarify when we are ok with different errno and when not.

I also thought there would be some rule "don't hide kernel bugs", but I can't
find it in the docs.

Kind regards,
Petr

[4] https://github.com/linux-test-project/ltp/commit/d539a004dde3b760f610ef7cae90a96de8489ec8
[5] https://github.com/linux-test-project/ltp/commit/57ab2160c0b002cbeeb1cba477cf8875ca9d660d
[6] https://lore.kernel.org/lkml/20240924222839.GC1585@sol.localdomain/

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e7a4142b35ce489fc8908d75596c51549711ade0
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=795f85fca229a88543a0a706039f901106bf11c1
> [3] https://lore.kernel.org/lkml/20240924222839.GC1585@sol.localdomain/

> Signed-off-by: Avinesh Kumar <akumar@suse.de>
> ---
>  lib/tst_af_alg.c                   | 1 +
>  testcases/kernel/crypto/af_alg01.c | 5 ++++-
>  testcases/kernel/crypto/af_alg03.c | 5 ++++-
>  3 files changed, 9 insertions(+), 2 deletions(-)

> diff --git a/lib/tst_af_alg.c b/lib/tst_af_alg.c
> index f5437c5c5..a14f9865c 100644
> --- a/lib/tst_af_alg.c
> +++ b/lib/tst_af_alg.c
> @@ -103,6 +103,7 @@ bool tst_have_alg(const char *algtype, const char *algname)
>  	case 0:
>  		return true;
>  	case ENOENT:
> +	case EINVAL:
>  		tst_res(TCONF, "kernel doesn't have %s algorithm '%s'",
>  			algtype, algname);
>  		return false;
> diff --git a/testcases/kernel/crypto/af_alg01.c b/testcases/kernel/crypto/af_alg01.c
> index 7cefe5946..2100b3698 100644
> --- a/testcases/kernel/crypto/af_alg01.c
> +++ b/testcases/kernel/crypto/af_alg01.c
> @@ -21,6 +21,7 @@ static void test_with_hash_alg(const char *hash_algname)
>  {
>  	char hmac_algname[64];
>  	char key[4096] = { 0 };
> +	int ret;

>  	if (!tst_have_alg("hash", hash_algname))
>  		return;
> @@ -30,7 +31,9 @@ static void test_with_hash_alg(const char *hash_algname)
>  		return;

>  	sprintf(hmac_algname, "hmac(hmac(%s))", hash_algname);
> -	if (tst_try_alg("hash", hmac_algname) != ENOENT) {
> +
> +	ret = tst_try_alg("hash", hmac_algname);
> +	if (ret != ENOENT && ret != EINVAL) {
>  		int algfd;

>  		tst_res(TFAIL, "instantiated nested hmac algorithm ('%s')!",
> diff --git a/testcases/kernel/crypto/af_alg03.c b/testcases/kernel/crypto/af_alg03.c
> index bb8d480e2..d7d385883 100644
> --- a/testcases/kernel/crypto/af_alg03.c
> +++ b/testcases/kernel/crypto/af_alg03.c
> @@ -15,10 +15,13 @@

>  static void run(void)
>  {
> +	int ret;
> +
>  	tst_require_alg("aead", "rfc7539(chacha20,poly1305)");
>  	tst_require_alg("hash", "sha256");

> -	if (tst_try_alg("aead", "rfc7539(chacha20,sha256)") != ENOENT) {
> +	ret = tst_try_alg("aead", "rfc7539(chacha20,sha256)");
> +	if ( ret != ENOENT && ret != EINVAL) {
>  		tst_res(TFAIL,
>  			"instantiated rfc7539 template with wrong digest size");
>  	} else {

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

  parent reply	other threads:[~2024-11-05 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 15:33 [LTP] [PATCH] crypto/af_alg0[13]: update tests for additional possible errno case Avinesh Kumar
2024-11-04 16:12 ` Petr Vorel
2024-11-05 10:40 ` Petr Vorel [this message]
2024-11-05 16:42   ` David Hildenbrand
2024-11-05 18:05     ` Petr Vorel
2024-11-05 19:54       ` David Hildenbrand

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=20241105104003.GA1573194@pevik \
    --to=pvorel@suse.cz \
    --cc=akumar@suse.de \
    --cc=david@redhat.com \
    --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