From: Cyril Hrubis <chrubis@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] af_alg08: Don't check recv() errno
Date: Tue, 12 May 2026 15:07:36 +0200 [thread overview]
Message-ID: <agMmGMyPJdvqD2zO@yuki.lan> (raw)
In-Reply-To: <20260512124909.27094-1-mdoucha@suse.cz>
Hi!
> Recent kernels return EBADMSG from recv() when the crypto operation
> fails. However, older kernels return EINVAL instead. Remove check
> for specific errno and only check that recv() failed.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> testcases/kernel/crypto/af_alg08.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c
> index 5e04b579c..4cc3e5c4e 100644
> --- a/testcases/kernel/crypto/af_alg08.c
> +++ b/testcases/kernel/crypto/af_alg08.c
> @@ -100,7 +100,14 @@ 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);
> + TEST(recv(reqfd, recvbuf, sizeof(recvbuf), 0));
> +
> + if (TST_RET >= 0) {
> + tst_res(TFAIL, "Decryption succeeded unexpectedly");
> + } else if (TST_RET != -1) {
> + tst_res(TFAIL | TTERRNO, "Invalid recv() return value %ld",
> + TST_RET);
> + }
Maybe allowing all errnos is bit to broad.
I wonder why we haven't added TST_EXP_FAIL_ARR_SILENT() since that
should be as simple as:
#define TST_EXP_FAIL_ARR_SILENT(SCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
TST_EXP_FAIL_SILENT_(TST_RET == 0, SCALL, #SCALL, EXP_ERRS, EXP_ERRS_CNT, ##__VA_ARGS__)
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-05-12 13:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 12:49 [LTP] [PATCH] af_alg08: Don't check recv() errno Martin Doucha
2026-05-12 13:07 ` Cyril Hrubis [this message]
2026-05-12 13:30 ` Andrea Cervesato via ltp
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=agMmGMyPJdvqD2zO@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.cz \
/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