* [LTP] [PATCH] af_alg08: Don't check recv() errno
@ 2026-05-12 12:49 Martin Doucha
2026-05-12 13:07 ` Cyril Hrubis
2026-05-12 13:30 ` Andrea Cervesato via ltp
0 siblings, 2 replies; 3+ messages in thread
From: Martin Doucha @ 2026-05-12 12:49 UTC (permalink / raw)
To: ltp
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);
+ }
SAFE_CLOSE(pipefd[0]);
SAFE_CLOSE(pipefd[1]);
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] af_alg08: Don't check recv() errno
2026-05-12 12:49 [LTP] [PATCH] af_alg08: Don't check recv() errno Martin Doucha
@ 2026-05-12 13:07 ` Cyril Hrubis
2026-05-12 13:30 ` Andrea Cervesato via ltp
1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2026-05-12 13:07 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] af_alg08: Don't check recv() errno
2026-05-12 12:49 [LTP] [PATCH] af_alg08: Don't check recv() errno Martin Doucha
2026-05-12 13:07 ` Cyril Hrubis
@ 2026-05-12 13:30 ` Andrea Cervesato via ltp
1 sibling, 0 replies; 3+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-12 13:30 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-12 13:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 12:49 [LTP] [PATCH] af_alg08: Don't check recv() errno Martin Doucha
2026-05-12 13:07 ` Cyril Hrubis
2026-05-12 13:30 ` Andrea Cervesato via ltp
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.