git: 4ae10ff966b5 - releng/14.4 - OCF: Add a fail point to inject EBADMSG decryption errors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Jul 2026 17:49:34 UTC
The branch releng/14.4 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=4ae10ff966b5f1b40356b9fd04696ba40f8b69b3
commit 4ae10ff966b5f1b40356b9fd04696ba40f8b69b3
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-07-27 15:36:22 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-28 14:38:26 +0000
OCF: Add a fail point to inject EBADMSG decryption errors
Approved by: so
Security: FreeBSD-SA-26:52.if_wg
Security: CVE-2026-58085
Reviewed by: markj
Sponsored by: Chelsio Communications
---
sys/opencrypto/crypto.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index e840d514fcd5..907bc34b7b0d 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -61,6 +61,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/counter.h>
+#include <sys/fail.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/linker.h>
@@ -145,6 +146,9 @@ static struct mtx crypto_q_mtx;
SYSCTL_NODE(_kern, OID_AUTO, crypto, CTLFLAG_RW, 0,
"In-kernel cryptography");
+static SYSCTL_NODE(_debug_fail_point, OID_AUTO, crypto, CTLFLAG_RW, 0,
+ "OCF fail points");
+
/*
* Taskqueue used to dispatch the crypto requests submitted with
* crypto_dispatch_async .
@@ -1679,6 +1683,18 @@ crypto_done(struct cryptop *crp)
KASSERT((crp->crp_flags & CRYPTO_F_DONE) == 0,
("crypto_done: op already done, flags 0x%x", crp->crp_flags));
crp->crp_flags |= CRYPTO_F_DONE;
+
+ if (crp->crp_etype == 0) {
+ switch (crp->crp_session->csp.csp_mode) {
+ case CSP_MODE_DIGEST:
+ case CSP_MODE_AEAD:
+ if ((crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) != 0)
+ KFAIL_POINT_CODE(_debug_fail_point_crypto,
+ inject_badmsg, crp->crp_etype = EBADMSG);
+ break;
+ }
+ }
+
if (crp->crp_etype != 0)
CRYPTOSTAT_INC(cs_errs);