From nobody Tue Aug 22 04:04:19 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 4RVG1v5Nmmz4qGPt; Tue, 22 Aug 2023 04:04:19 +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 4RVG1v4cqtz4Dl3; Tue, 22 Aug 2023 04:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692677059; 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=9jE23AW0T58I8fVHUN64PKO8RRiAR8PUVF0h1ncMhP4=; b=jbo01HhNZ8jzZkXDOH9EC4MPKdByc0lytXrt7oeE3JAnxpdowk0I8lhVZlSMLUixzyXBtr at9qYHg7vA4llVGyUw+IB4ieURTK06WhlV43UylGIzk8HaA5Y9GIRLVI9UTrJyIaZGiIxk r/OtK5/s80Jp3jSQYYPvetEZ1D4DMp05F10HlB0jgcrNgWejRxHsdZnzkEbblsJtXah6y7 TbGqOeHOJX1hLBnjWM4uWt3NPd/kBb7Xeg2PPXmvuGNEqdGCXc+jgHXIDNtm6CxaNaRL8s CmSnDScPyAqHsgLFNv5a8MZpFKliG60YXwNttttm/Ly+GsdlS3UklZwd2CMxjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692677059; 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=9jE23AW0T58I8fVHUN64PKO8RRiAR8PUVF0h1ncMhP4=; b=ybV5A+k/76l0bjh9hZENt3EG0o4eNHhCZepXS8OSoMdW/3UCrqAVJYRUHei8YsutouUPJn 6uN1FUTKLv6ldNaIGHGSx0Xl5edIjLNzQW5yHPJMAQGIGywpVQbuIgh9grLw8jSeP41p+o EiQu7djvbwyUGkaaHGBQIF0+VeIZQkiaU2KbIw9/s2GLlh/JJORn4iH7gPSKDThp/lMfUo /SEbwUlOmRyaSgXwl7eUZ1Wq+peDdvdO7Hj2puoLDZFH4GDAXYDXpx6y2XR+j6M0Rnfcgm 2Ck3V8/Br37HW6GelaBtljOOghIZyOlF5AHKe5Q4bGQjn1Eoojc+4E1Jan9ydg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692677059; a=rsa-sha256; cv=none; b=gDNYANQT2X8bvxmj9uiIosGj2jRYlp1REqD2YK8ysJZ7npeDQauUZVkyYkDa+t3H6iJsMN L5HhsU9EI0cr57uv30/Omf29O+TCPJCXA/hRDPh9efva9QCXMEZbfMPjrImVzdkd/3dhMN 3bMD8x4RQ9R5GiGi1Hn6iVR5wuFivtc7UoAHXm5OAPieTx3TAljoAXYcATVS95VHuxa2c3 s0HsC/AkyaD5+gpvyBGLcHBsLrXfyRjNgl7jARiEIIBgAW7Hu4zZ/FcrIZw7FGUa+9oYcz QpdpLcQcTEeJh9YQksSudDV3d7j2Erxx86VVbbK9rASS3b0WasqNP0A6znq3Aw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RVG1v3gP2zpMH; Tue, 22 Aug 2023 04:04:19 +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 37M44JvX093238; Tue, 22 Aug 2023 04:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37M44Jcx093235; Tue, 22 Aug 2023 04:04:19 GMT (envelope-from git) Date: Tue, 22 Aug 2023 04:04:19 GMT Message-Id: <202308220404.37M44Jcx093235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7ccaf76a27f1 - main - riscv db_trace: Ensure trapframe pointer is suitably aligned. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc commit 7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc Author: John Baldwin AuthorDate: 2023-08-22 04:00:26 +0000 Commit: John Baldwin CommitDate: 2023-08-22 04:00:26 +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 --- 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;