From nobody Mon Apr 08 19:04:13 2024 X-Original-To: dev-commits-src-all@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 4VCz656gnmz5HYVg; Mon, 8 Apr 2024 19:04:13 +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 4VCz655rgVz4g1P; Mon, 8 Apr 2024 19:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603053; 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=VZcp6tSjkwHlZ6d7jvOYl8h0g+S/Sc9RQlliC4YyLzI=; b=PjyR5k9ErGjS/NZg+HZ/OYwwTf5aI8qU2CXTFst7Wn8Y4Glhe3reTTHoQ3x2QOiXLycyUD 9Hm6v4he3HEc+Kjby0ihc/VjP1lyNmifiCvJywxrvXnHUTN2/pIzf30JW3YZXDBZ+CtVYp Zo7WKwu3T0LUgtgtf/oZON+6IGZE/x19qGEhU7oXmki1zJn6lD8JKH+ouiBpwMVo4bJRY2 qPHgCsRy18ud/wIrB86mG8uMDe1i2r9Il78CCoSZfZ2xLxdlVW/akh7ZTLAp19oGzk/yNu v8SA8uilJ/GKxpTfeLjTrMOfV1WcGsBkXgTUDrCcnseLaqlmgayTR5ba47r46g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712603053; a=rsa-sha256; cv=none; b=SPqyPkwudZ7K45FeOaa7wQmWXfPUm/+IjHt34BUXkeMx9Ny7UFpvx6ZK8hcS2Et2gCnYlo jQl7JqOsyqjV5T0rcwaPbBNUrHeOwfYLdKr0GqAn/eTovF8PsodjoHvZ4WOvFOBCqPUNja esS8CCKpgd3sTPazZUNJtOlc6VLbVmsFmok/UYBXizp9wow65tX5McXvavBs5PIK+AeXMr MR6W8a3ocOHk4FoOmHjn0J3hjTHi0+40Sh1BYPF0rkn1K4HELCQgJRVcl6lFEJ65sSGqH3 pEIYD7RIF4J6HEMOEIbqGQ/laWX5z/N5rC7NPbYRcB1YyL9ucXevQXSkqLNaGQ== 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=1712603053; 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=VZcp6tSjkwHlZ6d7jvOYl8h0g+S/Sc9RQlliC4YyLzI=; b=k+kmDWnJeMJWcBbJaPzYL9IGKFfr3NgmCz3B1Gj4cUAc5jV+PkGWZG6kSj7EtN6Yrp9LwJ 1ZFE6cKQ9x1xeyAvoovQ3vpVtL55NP4xGEJZ6VpyTaxktES+FwGz9UD22h5qwCaQuzONWP pdOjHyx3ge7HWKDnquxoLZgTN1mH1jj8cRpathiiFZ4yKeGtuyx0M7mbVRHmG2ll7u8dtr CklTxZzaGLoS2oN421XvHc6koeE8tnBy3amhqqHDFffZmWUrim5RDktNrzstURwY9nIfHP KC/uTbsyNB+nJXmPcJWpcGSqWgmeaWolVdq8lOHoyEyT53QWyCwG6Wxbomd+TA== 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 4VCz655S5WzNN2; Mon, 8 Apr 2024 19:04:13 +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 438J4DaU093546; Mon, 8 Apr 2024 19:04:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 438J4DdU093543; Mon, 8 Apr 2024 19:04:13 GMT (envelope-from git) Date: Mon, 8 Apr 2024 19:04:13 GMT Message-Id: <202404081904.438J4DdU093543@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: 3b2b83bcef04 - stable/14 - Stop using expressions in _Alignof() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: 3b2b83bcef04857097666e2784653cfab78ba366 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b2b83bcef04857097666e2784653cfab78ba366 commit 3b2b83bcef04857097666e2784653cfab78ba366 Author: Minsoo Choo AuthorDate: 2024-01-12 23:37:53 +0000 Commit: John Baldwin CommitDate: 2024-04-08 17:26:16 +0000 Stop using expressions in _Alignof() _Alignof(expression) is a non-standard extension. This is not allowed in gnu11 and gnu17 which follow the C11 standard _Alignof(type). Reviewed by: arichardson, imp, jhb Fixes: 4a9cd9fc22d7 amd64 db_trace: Reject unaligned frame pointers Fixes: 7ccaf76a27f1 riscv db_trace: Ensure trapframe pointer is suitably aligned. Fixes: 638c68897fbd arm64 db_trace: Ensure trapframe pointer is suitably aligned. Differential Revision: https://reviews.freebsd.org/D43409 (cherry picked from commit 03d04bf49492fc70366e6d78194336a4122282a2) --- sys/amd64/amd64/db_trace.c | 3 ++- sys/arm64/arm64/db_trace.c | 2 +- sys/riscv/riscv/db_trace.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index f9a0c2b6a03e..73b03334ffae 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -206,7 +206,8 @@ db_nextframe(db_addr_t *fp, db_addr_t *ip, struct thread *td) */ tf_addr = *fp + 16; - if (!__is_aligned(tf_addr, _Alignof(*tf)) || !INKERNEL(tf_addr)) { + if (!__is_aligned(tf_addr, _Alignof(struct trapframe)) || + !INKERNEL(tf_addr)) { db_printf("--- invalid trapframe %p\n", (void *)tf_addr); *ip = 0; *fp = 0; diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index cb1c0789b03f..87ff4b725297 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -93,7 +93,7 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) struct trapframe *tf; tf = (struct trapframe *)(uintptr_t)frame->fp - 1; - if (!__is_aligned(tf, _Alignof(*tf)) || + if (!__is_aligned(tf, _Alignof(struct trapframe)) || !kstack_contains(td, (vm_offset_t)tf, sizeof(*tf))) { db_printf("--- invalid trapframe %p\n", tf); diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c index 12972839c29d..148ad88b3ffb 100644 --- a/sys/riscv/riscv/db_trace.c +++ b/sys/riscv/riscv/db_trace.c @@ -84,7 +84,7 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) struct trapframe *tf; tf = (struct trapframe *)(uintptr_t)frame->sp; - if (!__is_aligned(tf, _Alignof(*tf)) || + if (!__is_aligned(tf, _Alignof(struct trapframe)) || !kstack_contains(td, (vm_offset_t)tf, sizeof(*tf))) { db_printf("--- invalid trapframe %p\n", tf);