git: 4cd9804b1d29 - releng/15.1 - 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:50:31 UTC
The branch releng/15.1 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=4cd9804b1d2990ac727f8a01b28d59ce8f7d0827
commit 4cd9804b1d2990ac727f8a01b28d59ce8f7d0827
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-07-27 15:36:22 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-28 17:34:40 +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 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index c3ae5e8a9ff8..9fa017902a19 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 .
@@ -1666,6 +1670,17 @@ crypto_clonereq(struct cryptop *crp, crypto_session_t cses, int how)
void
crypto_done(struct cryptop *crp)
{
+ 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);