All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] af_alg08: Allow recv() to return EINVAL
Date: Tue, 12 May 2026 18:27:17 +0200	[thread overview]
Message-ID: <20260512162735.80055-2-mdoucha@suse.cz> (raw)
In-Reply-To: <20260512162735.80055-1-mdoucha@suse.cz>

Recent kernels return EBADMSG from recv() when the crypto operation
fails. However, older kernels return EINVAL instead. Accept both
errno values.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/crypto/af_alg08.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c
index 5e04b579c..937ab1758 100644
--- a/testcases/kernel/crypto/af_alg08.c
+++ b/testcases/kernel/crypto/af_alg08.c
@@ -60,6 +60,10 @@ static int algfd = -1;
 static int reqfd = -1;
 static int pipefd[2] = { -1, -1 };
 static int file_fd = -1;
+static const int exp_errnos[] = {
+	EBADMSG,
+	EINVAL
+};
 
 static void try_corrupt(void)
 {
@@ -100,7 +104,8 @@ static void try_corrupt(void)
 	SAFE_SPLICE(pipefd[0], NULL, reqfd, NULL, OVERWRITE_SIZE, 0);
 
 	/* Expected to fail (invalid ciphertext); triggers the scratch write */
-	TST_EXP_FAIL_SILENT(recv(reqfd, recvbuf, sizeof(recvbuf), 0), EBADMSG);
+	TST_EXP_FAIL_ARR_SILENT(recv(reqfd, recvbuf, sizeof(recvbuf), 0),
+		exp_errnos, ARRAY_SIZE(exp_errnos));
 
 	SAFE_CLOSE(pipefd[0]);
 	SAFE_CLOSE(pipefd[1]);
-- 
2.53.0


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

  reply	other threads:[~2026-05-12 16:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 16:27 [LTP] [PATCH 1/2] Add TST_EXP_FAIL_ARR_SILENT() helper macros Martin Doucha
2026-05-12 16:27 ` Martin Doucha [this message]
2026-05-12 16:40   ` [LTP] [PATCH 2/2] af_alg08: Allow recv() to return EINVAL Cyril Hrubis
2026-05-12 18:00   ` Petr Vorel
2026-05-12 16:40 ` [LTP] [PATCH 1/2] Add TST_EXP_FAIL_ARR_SILENT() helper macros Cyril Hrubis
2026-05-12 17:58   ` Petr Vorel
2026-05-12 17:16 ` [LTP] " linuxtestproject.agent

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=20260512162735.80055-2-mdoucha@suse.cz \
    --to=mdoucha@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.