Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jul 2026 17:50:06 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        John Baldwin <jhb@FreeBSD.org>
Subject:   git: 2864c9b3b511 - releng/15.0 - OCF: Add a fail point to inject EBADMSG decryption errors
Message-ID:  <6a6a3d4e.3ac36.253572c4@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch releng/15.0 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=2864c9b3b51140a62b2860d826fb91d405738956

commit 2864c9b3b51140a62b2860d826fb91d405738956
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:59 +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);
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6a3d4e.3ac36.253572c4>