From nobody Fri Jan 12 23:40:43 2024 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 4TBdMJ1Kv6z56f7V; Fri, 12 Jan 2024 23:40:44 +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 4TBdMJ0qsnz4xXZ; Fri, 12 Jan 2024 23:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705102844; 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=OOfa6aNKgqKIFfRYQgJSytBPVWZsw4SHwblBymS0yLw=; b=BWmbOLq52otPG1QqFjVEc28TXDher86XQaBCXAtsa9o5FZ7odAnKwJLATZMRRSv1iEiePJ Y+RbhrunmS/mZAwttY57NBDa0oCsPoXGXj+FAaciHgKo3Ydl+6eVwEs1L8E2TGBQlSu9wo UYBNxsDWDhwAtYSdlnVkJEzLN+bEDHINkwP0fISxoDh9mKHXcedYjrHzLwNUxWZnrsecPs y/awDicXkf+3HuRk6dEhYSwQjgJx3WM5lvn5uoJz/l2tf/esRgRGIxjLNIRi+e7MhRPtMm r8DIzdOMlEMzAxp7ykBCp+gjTxnP4/CmHsj6FInTvOWoR3mI1ah7Z8XJOKv8Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705102844; 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=OOfa6aNKgqKIFfRYQgJSytBPVWZsw4SHwblBymS0yLw=; b=kd/gawZ+csAkrkgZFlyp8QC/zaKDXx0f0gZ5Z5ZyZcyy/yqHFkoUGoIRjEUX15aNnSIsY9 nlH5zW56mjoJi11JYLaDHNbLkaOBWWtAbSWrL3HFAyN5Z9V54p+3EZ+X+K6av2xr7PJy33 Ay22ooc79dGIbze9c+hWD4ovDybxtKw4JM4nPNBJNiLPbZWnZSutgdykhv4bC7dfRD6Yb1 NSfAH5QZO6vDLtIG0Ny89tkfwBFwaYJ65JYuI9yqOtQdN8UkoTHzYYQW/39D/OznvfBb06 5bFpO8tu6bZBIzWXfBKnRVYPlLoLYCpyAQiXL3lq3sG7cSsxql1291pfThfbWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705102844; a=rsa-sha256; cv=none; b=LQnQBP7+856jFWCfodD7zyowFedcAzJEUVaR59/Rf6+SGUfqnVuEJbJq1gwMQBQwdROnhr TZHNzjHQ6oiYvxy9af9jQlaPQlIIK8KsjWHfpiUBGOWfTGzJNgnGfYKyXrjo8U/pe5JtKR P+uI6pjgDDkoOpE3T8bAM6dAiTpqgN58NV4b3hbn05EOrHN6j7GZdnS1z56JlSJx1sexDY fA2vcm5W7uGPeOBUKiImUZd/zNXhrINx8uRlTi5ouk1+iIRPuYWoirwW8HIVE/9ltM4zvQ s33vCdufrcAm7jfjnvC+FIsUt4m2jXb8y8EJOlBj8P2cSLkReyUjM5xy9iJvJA== 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 4TBdMH70R9z1Lv7; Fri, 12 Jan 2024 23:40:43 +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 40CNehle087102; Fri, 12 Jan 2024 23:40:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40CNehD5087099; Fri, 12 Jan 2024 23:40:43 GMT (envelope-from git) Date: Fri, 12 Jan 2024 23:40:43 GMT Message-Id: <202401122340.40CNehD5087099@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: 03d04bf49492 - main - Stop using expressions in _Alignof() 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: 03d04bf49492fc70366e6d78194336a4122282a2 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=03d04bf49492fc70366e6d78194336a4122282a2 commit 03d04bf49492fc70366e6d78194336a4122282a2 Author: Minsoo Choo AuthorDate: 2024-01-12 23:37:53 +0000 Commit: John Baldwin CommitDate: 2024-01-12 23:37:53 +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 --- 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 9d9a2cd4a7bb..a57b38dd0818 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -205,7 +205,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 1c9290f19ed5..4bc6af26a023 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -92,7 +92,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 d3a52ecf59bf..0d374b1493d7 100644 --- a/sys/riscv/riscv/db_trace.c +++ b/sys/riscv/riscv/db_trace.c @@ -83,7 +83,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);