sys-fs/gfs2-utils: version bump to 3.3.0

Signed-off-by: Andrea Postiglione <andrea.postiglione@gmail.com>
This commit is contained in:
Andrea Postiglione
2020-10-21 11:42:43 +02:00
parent a6ffdc7ab7
commit c678f8607a
2 changed files with 123 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
From eb1020191f7743f451442096db8635643c5fddb1 Mon Sep 17 00:00:00 2001
From: Andrew Price <anprice@redhat.com>
Date: Sep 05 2020 23:59:02 +0000
Subject: restoremeta: Fix unaligned access in restore_init()
On sparc64 we get restoremeta tests failing with SIGBUS due to an
unaligned access when scanning for the super block offset in the
metadata file. memcpy the buffer into a gfs2_sb struct to avoid that. In
most cases, if not always, this loop succeeds on the first iteration
and might not even be needed, so the added overhead is minimal.
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 80c11c9..32e1f70 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -1251,7 +1251,7 @@ nobuffer:
return NULL;
}
-static int restore_super(struct metafd *mfd, char *buf, int printonly)
+static int restore_super(struct metafd *mfd, void *buf, int printonly)
{
int ret;
@@ -1337,7 +1337,7 @@ static void complain(const char *complaint)
static int restore_init(const char *path, struct metafd *mfd, struct savemeta_header *smh, int printonly)
{
- struct gfs2_meta_header *sbmh;
+ struct gfs2_sb rsb;
uint16_t sb_siglen;
char *end;
char *bp;
@@ -1372,12 +1372,12 @@ static int restore_init(const char *path, struct metafd *mfd, struct savemeta_he
return -1;
}
/* Scan for the position of the superblock. Required to support old formats(?). */
- end = &restore_buf[256 + sizeof(struct saved_metablock) + sizeof(*sbmh)];
+ end = &restore_buf[256 + sizeof(struct saved_metablock) + sizeof(struct gfs2_meta_header)];
while (bp <= end) {
+ memcpy(&rsb, bp + sizeof(struct saved_metablock), sizeof(rsb));
sb_siglen = be16_to_cpu(((struct saved_metablock *)bp)->siglen);
- sbmh = (struct gfs2_meta_header *)(bp + sizeof(struct saved_metablock));
- if (sbmh->mh_magic == cpu_to_be32(GFS2_MAGIC) &&
- sbmh->mh_type == cpu_to_be32(GFS2_METATYPE_SB))
+ if (be32_to_cpu(rsb.sb_header.mh_magic) == GFS2_MAGIC &&
+ be32_to_cpu(rsb.sb_header.mh_type) == GFS2_METATYPE_SB)
break;
bp++;
}
@@ -1386,7 +1386,7 @@ static int restore_init(const char *path, struct metafd *mfd, struct savemeta_he
return -1;
}
bp += sizeof(struct saved_metablock);
- ret = restore_super(mfd, bp, printonly);
+ ret = restore_super(mfd, &rsb, printonly);
if (ret != 0)
return ret;

View File

@@ -0,0 +1,64 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools toolchain-funcs linux-info
DESCRIPTION="Shared-disk cluster file system"
HOMEPAGE="https://pagure.io/gfs2-utils"
SRC_URI="https://pagure.io/gfs2-utils/archive/${PV}/${P}.tar.gz"
LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="nls test"
BDEPEND="sys-devel/autoconf
sys-devel/automake
sys-devel/libtool
sys-devel/make
"
RDEPEND="sys-libs/zlib
app-arch/bzip2
sys-libs/ncurses
sys-apps/util-linux
"
DEPEND="${RDEPEND}
sys-devel/gettext
sys-devel/bison
sys-devel/flex
test? ( dev-libs/check )
sys-kernel/linux-headers
"
src_prepare() {
eapply "${FILESDIR}"/reproducible.patch
eapply "${FILESDIR}"/gfs2_withdraw_helper.patch
eapply "${FILESDIR}"/python3.patch
eapply "${FILESDIR}"/restoremeta.patch
default
./autogen.sh
eautoreconf
}
src_configure() {
local econf_args
econf_args=(
bzip2_LIBS="-L/$(get_libdir) -lbz2"
bzip2_CFLAGS="-I${prefix}/include"
)
ECONF_SOURCE="${S}" econf "${econf_args[@]}"
}
src_compile() {
emake
}
src_install() {
emake DESTDIR="${D}" install
}