From nobody Fri Oct 08 01:16:40 2021 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 917D612D1348; Fri, 8 Oct 2021 01:16:47 +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 4HQVdp5W33z3tr4; Fri, 8 Oct 2021 01:16:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CC21A1DE5A; Fri, 8 Oct 2021 01:16:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1981Geji010861; Fri, 8 Oct 2021 01:16:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1981GerW010860; Fri, 8 Oct 2021 01:16:40 GMT (envelope-from git) Date: Fri, 8 Oct 2021 01:16:40 GMT Message-Id: <202110080116.1981GerW010860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 5a6dd8690100 - stable/12 - As with r352446 align blocks in boot1.efi 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5a6dd8690100ff19cdd8072d068db260cacebc3d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5a6dd8690100ff19cdd8072d068db260cacebc3d commit 5a6dd8690100ff19cdd8072d068db260cacebc3d Author: Andrew Turner AuthorDate: 2020-05-05 09:42:26 +0000 Commit: Kyle Evans CommitDate: 2021-10-08 01:15:59 +0000 As with r352446 align blocks in boot1.efi We need to ensure the buffers are aligned before passing them to ReadBlocks. Assume 512 bytes is enough for now. (cherry picked from commit 3d5e12ebce94791aa0d6df3e81e7a8ac48ee4b51) --- stand/efi/boot1/ufs_module.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c index fa0e5fc051a0..edd7918e00b6 100644 --- a/stand/efi/boot1/ufs_module.c +++ b/stand/efi/boot1/ufs_module.c @@ -73,12 +73,12 @@ dskread(void *buf, uint64_t lba, int nblk) #include "ufsread.c" -static struct dmadat __dmadat; +static struct dmadat __dmadat __aligned(512); +static char ufs_buffer[BSD_LABEL_BUFFER] __aligned(512); static int init_dev(dev_info_t* dev) { - char buffer[BSD_LABEL_BUFFER]; struct disklabel *dl; uint64_t bs; int ok; @@ -109,14 +109,14 @@ init_dev(dev_info_t* dev) * will retry fsread(0) only if there's a label found with a non-zero * offset. */ - if (dskread(buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0) + if (dskread(ufs_buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0) return (-1); dl = NULL; bs = devinfo->dev->Media->BlockSize; if (bs != 0 && bs <= BSD_LABEL_BUFFER / 2) - dl = (struct disklabel *)&buffer[bs]; + dl = (struct disklabel *)&ufs_buffer[bs]; if (dl == NULL || dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC) - dl = (struct disklabel *)&buffer[BSD_LABEL_OFFSET]; + dl = (struct disklabel *)&ufs_buffer[BSD_LABEL_OFFSET]; if (dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC || dl->d_partitions[0].p_offset == 0) return (-1);