From nobody Mon Apr 08 20:25:39 2024 X-Original-To: dev-commits-src-branches@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 4VD0w33crKz5HhsX; Mon, 8 Apr 2024 20:25:39 +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 4VD0w31kvgz3xTM; Mon, 8 Apr 2024 20:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712607939; 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=N+ISLryvi4iE9WTb1xnV87fJvvFTTkFhaCU7A2vaojg=; b=H++4LB1+qF0bReQT5Phb/PYn918p3IVzU4G3unwVzinQ0i/jLtT06OXVhvQ4q+pYbR0wEf 4n1LJjArudSNggS/P324T8JOV9xnDpHJ6ar6LSwZnyA8IukV+lom5gG+bbjM3tn9jz2+sP WCSeptzt7pJR5ZA4i1pyY4UUZE8JQXlM8L82bUFNtD24jJbE9LRLDEjmLnvwnSWsL61ci3 GGM2YiQeddCGKd7kNy0bptj8qUfAvGDnF1Z/nC6tTqQjD1un/6R82V5h7/REw0xXL2xsI7 Ttk0w2E2g0LPze/D9jh3JH0+4EocqKuTy7wSiu4po8Tep1f+zzoeS1lNZJr84w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712607939; a=rsa-sha256; cv=none; b=HhtbEzumyPyLM+Gnt3Wo/6wMHWcTo/XKs7frdLZplDuj8Zh86g6/ZCzDlroSlIMhy2sbDp tTHRrEESSY8BI+wwGYxWRgpezekJL8akyk5d4uhoZSlsnq8iuprZU0MXqmTGu+UVFf3H2u A9ROhXep3I3RDiMVRVkBNl3HeNf/Prxi6acBVds63RdGx2b8vJSqu7u1HM/v9mWl9uZLSn BSgvvhEoeIsUh6qBkF4PlF4zYB8PgnFG32wIstxIht/q2DAuLWqf4JtlZDgqPRPWwnUQGC WOyKxZzRU2ZLVy2e8/HavXsQM9zVVGrPeDDkhpGQkrxUHQkBReDVwMM9xuzoUg== 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=1712607939; 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=N+ISLryvi4iE9WTb1xnV87fJvvFTTkFhaCU7A2vaojg=; b=aupZiwR8mPeBwXobwd6L9Tl+0mv60gzq7aweR6ZGhpdGtK1zjnEk7g8LVHoyJ3Gb5LSFW/ RHYh3qLpj6AKtX0FzT2QmTXlnCbs8CUNXxkjiNjFAgBz7BEPAuKBWELzhmQ+Wrz1WTfc/E PgQ4uWNjbrTEZBsiHVAQro+VMQn95euSQOIVIIeSfe8jkSGvPv/L3/46qNSTNP5SdskU60 Nw8H4ZQQ6tobhRKhgbTx40z0D5Ob0+N45YAgoNUHKFXTxpsMtZPQi2fHHw7HjjD/DenWog 0/MbjjlNgcToDM82g8ZE02HlZmtOdIEXtuaA4nHLJSa28lAd6Z3wDjoie/ixYg== 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 4VD0w31LN5zQGR; Mon, 8 Apr 2024 20:25:39 +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 438KPd1w039382; Mon, 8 Apr 2024 20:25:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 438KPdvv039379; Mon, 8 Apr 2024 20:25:39 GMT (envelope-from git) Date: Mon, 8 Apr 2024 20:25:39 GMT Message-Id: <202404082025.438KPdvv039379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 402c6c331d73 - stable/13 - riscv db_trace: Ensure trapframe pointer is suitably aligned. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 402c6c331d73491e5cc711336a7ec23fcc87d03c Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=402c6c331d73491e5cc711336a7ec23fcc87d03c commit 402c6c331d73491e5cc711336a7ec23fcc87d03c Author: John Baldwin AuthorDate: 2023-08-22 04:00:26 +0000 Commit: John Baldwin CommitDate: 2024-04-08 17:29:34 +0000 riscv db_trace: Ensure trapframe pointer is suitably aligned. Suggested by: jrtc27 Reviewed by: jrtc27 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D41534 (cherry picked from commit 7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc) --- sys/riscv/riscv/db_trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c index 00ec1a750e33..12972839c29d 100644 --- a/sys/riscv/riscv/db_trace.c +++ b/sys/riscv/riscv/db_trace.c @@ -84,7 +84,8 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) struct trapframe *tf; tf = (struct trapframe *)(uintptr_t)frame->sp; - if (!kstack_contains(td, (vm_offset_t)tf, + if (!__is_aligned(tf, _Alignof(*tf)) || + !kstack_contains(td, (vm_offset_t)tf, sizeof(*tf))) { db_printf("--- invalid trapframe %p\n", tf); break;