From nobody Mon Apr 17 13:50:00 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 4Q0T2J4PxWz45w5q; Mon, 17 Apr 2023 13:50:00 +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 4Q0T2J27C5z3xcP; Mon, 17 Apr 2023 13:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681739400; 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=8Bg9z9wt/Xb+vuMchvkaz9Z6TvoHTownS7JjjaJvxlc=; b=jQBPb5h7DxNSc/7kh+yk6FrQbvj0UBqkMo4CegqF9THT+K4nHRmPPaUYi54oLss6OD/jxz iVhO4E+tUULwIXvgIk7KayUXrMlsksOEOEIuaLUseYHFqlk7eQkjzNB8iGzIW78CUePG+8 z4rOwmSKyta91VoiqCP+M7o+lpJGN540mi1y+kb4JpT98LBjOtLVmURRfiuw5x4IKLmbC/ PvN0izokrESHNV5kUkAx0OIMNyoEEuVXJ1XN35+YcrfNywH0wEZcbxNBpclzdVFhuo8IXf RBkVjhxpN6mOS/5bqXr+OAxbMBgWwOVCmDbJRQz0a0WiRGkWHAf1uz/8T1QE+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681739400; 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=8Bg9z9wt/Xb+vuMchvkaz9Z6TvoHTownS7JjjaJvxlc=; b=nTTkk39ZWeoW4Cj84SOYWwhjbXdJSOL9ge0nAH+/v/fvLec1U/OYtvK9lZLc/xSvZEHCcA v/BPWbOeP1i3Dc7b8QX3EWRLMokrDzP2FbcNEXvcbo0L62bCsvkFBojN11SzmIr9urOPJg s2zk8O4ltp1oKTdsBVn92xt4ZWAMGSaYrd36IdaaILTPKQZQdiQIn8Oabh/shmbjjm18CU EyunKOmuIS9aJObKc4Ah3Liv5URBoLW+0+VH0n214/wtflCF51dOOLJdFBZ+7QTyiyQajt bTJLlN9WuHphHG/q+Zhe/fzBWCDm7ghhlZxX7Tf/4hvHIuE6Wd/7SQC/swoZkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681739400; a=rsa-sha256; cv=none; b=TpqjhCcd5aEyjRNqelK+sXZzD/aDNiSmQ3uOasOxEbe83khr/A8JJ0a8ysp4rzGub6Vb86 Uou2enbGqTmcTLcgZiYtW1zOLD1p5tPaLm0gClnxRObeCot7pfA23VqeUaKTRcBDrQhHdf mbphX4ddkEpFKOWItMxZQtGafDX+eK15DDMBDHAZNCoQNbFhWS5wbJqb+iknwAbZBJdYh9 YJKrp7vUJ05/QWEF3zgVA9fUVp72LDdxH3TgK+mvUg5NvmNIUGECkP7gB1nOuGCjv/QBjY bIaj/yt5tuzn+zMaSAoaP76HYkNZe4LaurNYdEZsn5UHYuzB5bqeB8nOtaWXwg== 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 4Q0T2J0ywLzWdM; Mon, 17 Apr 2023 13:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33HDo0SO072728; Mon, 17 Apr 2023 13:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33HDo0A8072708; Mon, 17 Apr 2023 13:50:00 GMT (envelope-from git) Date: Mon, 17 Apr 2023 13:50:00 GMT Message-Id: <202304171350.33HDo0A8072708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d95fbf4e1a12 - main - riscv: save the thread pointer in both modes 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d95fbf4e1a12565908b04b442263fe60c9e890b4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d95fbf4e1a12565908b04b442263fe60c9e890b4 commit d95fbf4e1a12565908b04b442263fe60c9e890b4 Author: Mark Johnston AuthorDate: 2023-04-17 13:44:44 +0000 Commit: Mark Johnston CommitDate: 2023-04-17 13:49:52 +0000 riscv: save the thread pointer in both modes The contents of frame->tf_tp are uninitialized if accessed by DTrace (in probe context), resulting in a panic when trying to access the memory pointed to by tp. This saves the thread pointer to the trap frame when handling both userland and kernel exceptions. Reviewed by: markj, mhorne MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39582 --- sys/riscv/riscv/exception.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/riscv/riscv/exception.S b/sys/riscv/riscv/exception.S index cf06c364de46..a68e7938e537 100644 --- a/sys/riscv/riscv/exception.S +++ b/sys/riscv/riscv/exception.S @@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$"); /* Load our pcpu */ sd tp, (TF_TP)(sp) ld tp, (TF_SIZE)(sp) +.else + sd tp, (TF_TP)(sp) .endif sd t0, (TF_T + 0 * 8)(sp)