From nobody Tue Nov 15 12:42:03 2022 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 4NBQml07Zbz4d8Vb for ; Tue, 15 Nov 2022 12:42:15 +0000 (UTC) (envelope-from bT.sn6jkp5c30=dk6lvbpk9yzq=moug0yul6y@em790814.fubar.geek.nz) Received: from e2i342.smtp2go.com (e2i342.smtp2go.com [103.2.141.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NBQmk6Kkqz4Prc for ; Tue, 15 Nov 2022 12:42:14 +0000 (UTC) (envelope-from bT.sn6jkp5c30=dk6lvbpk9yzq=moug0yul6y@em790814.fubar.geek.nz) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=mgy720.a1-4.dyn; x=1668517034; h=Feedback-ID: X-Smtpcorp-Track:To:Message-Id:Date:From:Subject:Reply-To:Sender: List-Unsubscribe; bh=ds6eXyC602v9wwMgs99l9jzm8S1TwzhpAbkkf9Mfs9U=; b=Trqf6qsS KdTv172Bfw6wxJq10ystI7RNEsfcN7SNp4gN5nsiwi8BHQBvgZjio7vfaQmSx5BhI0YouDqFK4KQ3 mFIZh7qegYsbEM5TF8X15CdTI0wmOL6LX4tbilu48KinG1Tubuce4swxDcea2Y/N2Jtiy8p/gjGci 1CKOAshUL+8MfRylejdw5CIMsn/QxONI5U9dZyR6jHDDk8kEqP5nBK04n9T7zsVLiJyefQQGnEOuV 3zht0S2toPscDTTnwwl7RgiLAPJLf0ycvMGJEyihNB3HKBQ4JdgepsottI2LH+4jt/dtPxaYKf86O RBoFjHPklExjKF6qGmgHg+wx9A==; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; i=@fubar.geek.nz; q=dns/txt; s=s790814; t=1668516134; h=from : subject : to : message-id : date; bh=ds6eXyC602v9wwMgs99l9jzm8S1TwzhpAbkkf9Mfs9U=; b=JhH0+CtdfReZppu8LxthIeJBq9DrzBm3EL0/AVmBbPq2Y1hSpoZY+rttEUdhg/ldQ9JIW PLsOSjjfkUAYXOAZI0FJHiQv6Lr+x4WTxb0qsyuLb9f3K1GnbWfYBWqZCNQqySbzT9Ct5Sg jtUfj33BTnR3HZ+61WFWcpBCwEpU5HTmRuNMMLjhzD0fWaH8//HKz4UVqhNVLXVPFQtrzJF 6U1z47YZmDDqo+B5tufxj6pr5C31p2qcXKm2At5wo78Vud9IFJOSOEs/a272Sa/hhSPGfma DUrz+H2CJyI4zV7h4c7u0bvUuz1NJhk4+8t/YpWNF/vaP02LxK5BSuUwFK7A== Received: from [10.176.58.103] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1ouvGT-TRjz9M-BH; Tue, 15 Nov 2022 12:42:09 +0000 Received: from [10.162.55.164] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96-S2G) (envelope-from ) id 1ouvGT-9EReGk-0Q; Tue, 15 Nov 2022 12:42:09 +0000 Received: from smtpclient.apple (cpc91214-cmbg18-2-0-cust234.5-4.cable.virginm.net [81.102.75.235]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id 29009B722; Tue, 15 Nov 2022 12:42:04 +0000 (UTC) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: git: 40e0fa10f58d - main - Check alignment of fp in unwind_frame From: Andrew Turner In-Reply-To: Date: Tue, 15 Nov 2022 12:42:03 +0000 Cc: Brooks Davis , "" , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <30B11BD5-A1B5-4513-8C0D-8BA89C12C55A@fubar.geek.nz> References: <202211150026.2AF0Q9vH048757@gitrepo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Smtpcorp-Track: 1oIvGT9ER-Gk0Q.c1kMf5gBgr4wh Feedback-ID: 790814m:790814amQcrys:790814sjifSSxn8Z X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Rspamd-Queue-Id: 4NBQmk6Kkqz4Prc X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:103.2.140.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N I=E2=80=99ve reverted for now & reopened the Phabricator review. Andrew > On 15 Nov 2022, at 08:22, Mateusz Guzik wrote: >=20 > this fails to build: >=20 > /usr/src/sys/riscv/riscv/unwind.c:50:7: error: implicit declaration of > function 'is_aligned' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > if (!is_aligned(fp, sizeof(fp)) || > ^ > 1 error generated. >=20 > On 11/15/22, Brooks Davis wrote: >> The branch main has been updated by brooks: >>=20 >> URL: >> = https://cgit.FreeBSD.org/src/commit/?id=3D40e0fa10f58d90744c2857b57adf0ddb= ce1a1e1c >>=20 >> commit 40e0fa10f58d90744c2857b57adf0ddbce1a1e1c >> Author: Dapeng Gao >> AuthorDate: 2022-11-15 00:21:38 +0000 >> Commit: Brooks Davis >> CommitDate: 2022-11-15 00:25:46 +0000 >>=20 >> Check alignment of fp in unwind_frame >>=20 >> A misaligned frame pointer is certainly not a valid frame pointer = and >> with strict alignment enabled (as on CHERI) can cause panics when = it is >> loaded from later in the code. >>=20 >> Reviewed By: jhb >> Differential Revision: https://reviews.freebsd.org/D34646 >> --- >> sys/arm64/arm64/unwind.c | 3 ++- >> sys/riscv/riscv/unwind.c | 3 ++- >> 2 files changed, 4 insertions(+), 2 deletions(-) >>=20 >> diff --git a/sys/arm64/arm64/unwind.c b/sys/arm64/arm64/unwind.c >> index 470b64c00540..81431e109494 100644 >> --- a/sys/arm64/arm64/unwind.c >> +++ b/sys/arm64/arm64/unwind.c >> @@ -41,7 +41,8 @@ unwind_frame(struct thread *td, struct unwind_state >> *frame) >>=20 >> fp =3D frame->fp; >>=20 >> - if (!kstack_contains(td, fp, sizeof(uintptr_t) * 2)) >> + if (!is_aligned(fp, sizeof(fp)) || >> + !kstack_contains(td, fp, sizeof(fp) * 2)) >> return (false); >>=20 >> /* FP to previous frame (X29) */ >> diff --git a/sys/riscv/riscv/unwind.c b/sys/riscv/riscv/unwind.c >> index 9efb1fef9451..a66ffebcdc35 100644 >> --- a/sys/riscv/riscv/unwind.c >> +++ b/sys/riscv/riscv/unwind.c >> @@ -47,7 +47,8 @@ unwind_frame(struct thread *td, struct unwind_state >> *frame) >>=20 >> fp =3D frame->fp; >>=20 >> - if (!kstack_contains(td, fp - sizeof(fp) * 2, sizeof(fp) * 2)) >> + if (!is_aligned(fp, sizeof(fp)) || >> + !kstack_contains(td, fp - sizeof(fp) * 2, sizeof(fp) * 2)) >> return (false); >>=20 >> frame->sp =3D fp; >>=20 >=20 >=20 > --=20 > Mateusz Guzik >=20