From nobody Fri Sep 01 10:07:15 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RcYc35gnVz4sKPv; Fri, 1 Sep 2023 10:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RcYc33jzBz3Zxc; Fri, 1 Sep 2023 10:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693562835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fdgoiNJwN8hy5s1/LN267pCbTsHgrF8v37Vs+Pe3x0s=; b=XgPD8cl2yQtjHkA9w/5GCe/jldsCv1cgFYvJr6wM2DPSkAJqGE8MpHOnI5RU+Ptw2Qfbt2 BZTCR+rHvANjt3yblo4wUB6LK6h6S0gT18FUiCwj7Fe7VbKUxWzsE0hzigxHltRQwaVLCY P6ZoumxlgztxYz/qre/Cl3yx1AoQVzqq1fqZCDrm07WIeCfMVHDTLSfqgr3aj0cOLfHQZ6 Q26d3pVPTNGEjVY3EDYoU+5RuLLJMOs4UZPOrqGQlFujLbjk+QDmdBoop/5h6sEWcFcLnk +jh1Fnh7fdO6aMpTzi/9v/3gelP9tsee3oDd/4XB7f8WucHPdklyaC+FY269qA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693562835; a=rsa-sha256; cv=none; b=OkYtUn7EIhhQKH4vll7zLJZflg1rXM/i2f4EwYFzuiWZrBe6UCmWSVOtSUZB2RYDDl/e3y zWZfO2k3Is64jdcviMFgwAFri6VDcaN1BVQx/T/YiFVY7ThHnRYydOY6G0TJ4f1G1ty2TD XnPH7FeEeJGrDU5GRxWU1j88T448PPaHuE/qzWuYsqjB81JN4ZVRIZUXCodwEPqDPgMVZH 6HfvwDEQvSNA75kyovYu4Obz+Sa0TadkkwNedgTSzVqvJ29iESVlPORGeZ2W9l145aC7m/ B2J+ekivv9YV7fAVOE98ORcpyOUjYPpw1f7pd1Wtb1Hz7dQALpJa2BHGnusImg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693562835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fdgoiNJwN8hy5s1/LN267pCbTsHgrF8v37Vs+Pe3x0s=; b=AVevFf1607KG0SlYRZgc1Mq/j7oPSRPvhu+BjvVJ3xl/gNrJnUlcYMhFLJLKs7C9Az88QW w8q1hSfOaWL6/9WDVKLOPJLZPAqkXD7zC6ADPr7ttjiJTUXsyB4EPR8mlVwTHvmnj52FwF bZyqXb5m42jO2oUc0KlmTRm9uFTVWPPw/xU1va+LJG8Egm8ycUOcd8S13qPBBag4lfz0af 6GF+riwLW0lrLDgatbqUn89euAPjm5nL7RxlJVO6NPuyPdh1Dsa1OdB1eMPnTdzkRl5gzG XSU46rPNtxPtTh8ym7Sm8ATp4Qp1AvK6mhl/vfWKGQY168P5bMYi2tnp63lBqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RcYc32CyBzwt6; Fri, 1 Sep 2023 10:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 381A7FR1092446; Fri, 1 Sep 2023 10:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 381A7F6w092443; Fri, 1 Sep 2023 10:07:15 GMT (envelope-from git) Date: Fri, 1 Sep 2023 10:07:15 GMT Message-Id: <202309011007.381A7F6w092443@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 565c887a7752 - main - armv8_crypto: fix recursive fpu_kern_enter call List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 565c887a775284bfb1a15eadee2c3f312d288c01 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=565c887a775284bfb1a15eadee2c3f312d288c01 commit 565c887a775284bfb1a15eadee2c3f312d288c01 Author: Zachary Leaf AuthorDate: 2023-08-31 13:11:53 +0000 Commit: Andrew Turner CommitDate: 2023-09-01 09:56:58 +0000 armv8_crypto: fix recursive fpu_kern_enter call Now armv8_crypto is using FPU_KERN_NOCTX, this results in a kernel panic in armv8_crypto.c:armv8_crypto_cipher_setup: panic: recursive fpu_kern_enter while in PCB_FP_NOSAVE state This is because in armv8_crypto.c:armv8_crypto_cipher_process, directly after calling fpu_kern_enter() a call is made to armv8_crypto_cipher_setup(), resulting in nested calls to fpu_kern_enter() without the required fpu_kern_leave() in between. Move fpu_kern_enter() in armv8_crypto_cipher_process() after the call to armv8_crypto_cipher_setup() to resolve this. Reviewed by: markj, andrew Fixes: 6485286f536f ("armv8_crypto: Switch to using FPU_KERN_NOCTX") Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41671 --- sys/crypto/armv8/armv8_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index fd1d845c29b0..fcbc7e77de29 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -336,8 +336,6 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_cursor_copy(&fromc, &toc); } - fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); - if (crp->crp_cipher_key != NULL) { armv8_crypto_cipher_setup(ses, csp, crp->crp_cipher_key, csp->csp_cipher_klen); @@ -345,6 +343,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_read_iv(crp, iv); + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); + error = 0; switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: