From owner-svn-src-head@freebsd.org Tue May 5 09:42:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4E462DF12B; Tue, 5 May 2020 09:42:26 +0000 (UTC) (envelope-from andrew@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49GZWk40w7z4dtD; Tue, 5 May 2020 09:42:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84C95BEB9; Tue, 5 May 2020 09:42:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0459gQSa057521; Tue, 5 May 2020 09:42:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0459gQj3057520; Tue, 5 May 2020 09:42:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202005050942.0459gQj3057520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 5 May 2020 09:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360654 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 360654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 09:42:26 -0000 Author: andrew Date: Tue May 5 09:42:26 2020 New Revision: 360654 URL: https://svnweb.freebsd.org/changeset/base/360654 Log: 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. Reviewed by: imp MFC after: 1 month Sponsored by: Innovate UK Modified: head/stand/efi/boot1/ufs_module.c Modified: head/stand/efi/boot1/ufs_module.c ============================================================================== --- head/stand/efi/boot1/ufs_module.c Tue May 5 04:42:47 2020 (r360653) +++ head/stand/efi/boot1/ufs_module.c Tue May 5 09:42:26 2020 (r360654) @@ -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);