Sync from SUSE:SLFO:Main gfs2-utils revision 058bab65393beb7c5ee55ddfc73dfa46

This commit is contained in:
Adrian Schröter 2024-08-23 16:58:23 +02:00
commit 9710d7fbb8
9 changed files with 365 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,47 @@
From caab270a739d619cfa3b8d4c57789cb6b1ef94e8 Mon Sep 17 00:00:00 2001
From: Andrew Price <anprice@redhat.com>
Date: Thu, 11 May 2023 17:04:34 +0100
Subject: [PATCH] fsck.gfs2: Tighten offset check in check_eattr_entries()
The "offset >= bsize" check is insufficient as it doesn't detect invalid
ea_header offsets less than one ea_header from the end of the block.
This fixes an unlikely fsck.gfs2 buffer over-read that can occur.
For the bug to occur:
1. The last valid xattr header must not have GFS2_EAFLAG_LAST set
2. Its ea_rec_len must result in an offset of the next xattr within 15
bytes of the end of the block
A segfault can then occur if this region contains non-zero data that
results in the loop continuing with another bad offset and another bad
read, and so on.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/metawalk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 66316e4d864c..819a7e670f73 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -846,6 +846,7 @@ static int check_eattr_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
int i;
int error = 0, err;
uint32_t offset = (uint32_t)sizeof(struct gfs2_meta_header);
+ uint32_t offset_limit = ip->i_sbd->sd_bsize - sizeof(struct gfs2_ea_header);
if (!pass->check_eattr_entry)
return 0;
@@ -894,7 +895,7 @@ static int check_eattr_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
}
offset += be32_to_cpu(ea_hdr->ea_rec_len);
if (ea_hdr->ea_flags & GFS2_EAFLAG_LAST ||
- offset >= ip->i_sbd->sd_bsize || ea_hdr->ea_rec_len == 0){
+ offset > offset_limit || ea_hdr->ea_rec_len == 0) {
break;
}
ea_hdr_prev = ea_hdr;
--
2.35.3

View File

@ -0,0 +1,31 @@
From f50a6c8aa6175c5763fb076da0efd07f36adb698 Mon Sep 17 00:00:00 2001
From: Andrew Price <anprice@redhat.com>
Date: Thu, 11 May 2023 18:28:04 +0100
Subject: [PATCH] fsck.gfs2: Fix max xattr record length check
xattr blocks have a meta header so the max size to check ea_rec_len
against is one meta header less than the block size. Fixes detection of
bad ea_rec_len values that result in offsets up to 24 bytes past the end
of the block.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/pass1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 206929fcdbd5..ebd66e2c9bc5 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -881,7 +881,7 @@ static int p1_check_eattr_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
char ea_name[256];
uint32_t offset = (uint32_t)(((unsigned long)ea_hdr) -
((unsigned long)leaf_bh->b_data));
- uint32_t max_size = sdp->sd_bsize;
+ uint32_t max_size = sdp->sd_bsize - sizeof(struct gfs2_meta_header);
uint32_t avail_size;
int max_ptrs;
--
2.35.3

View File

@ -0,0 +1,53 @@
From d85e19e45f1df1cc4a933c84b8e7ff25df1959d4 Mon Sep 17 00:00:00 2001
From: Andrew Price <anprice@redhat.com>
Date: Mon, 22 May 2023 11:24:26 +0100
Subject: [PATCH] fsck.gfs2: Fix xattr offset checks in p1_check_eattr_entries
Valid ea_header offsets fall within the block, at the block boundary,
but not in the final 15 bytes of the block as that would result in a
partial ea_header. Make sure these cases are all taken into account in
the ea_rec_len checks in p1_check_eattr_entries(). Also improve logging
of erroneous values.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/pass1.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index ebd66e2c9bc5..df2d8c4e59e9 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -879,9 +879,10 @@ static int p1_check_eattr_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
{
struct lgfs2_sbd *sdp = ip->i_sbd;
char ea_name[256];
+ uint32_t offset_limit = sdp->sd_bsize - sizeof(struct gfs2_ea_header);
uint32_t offset = (uint32_t)(((unsigned long)ea_hdr) -
((unsigned long)leaf_bh->b_data));
- uint32_t max_size = sdp->sd_bsize - sizeof(struct gfs2_meta_header);
+ uint32_t rec_len = be32_to_cpu(ea_hdr->ea_rec_len);
uint32_t avail_size;
int max_ptrs;
@@ -890,12 +891,14 @@ static int p1_check_eattr_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
return ask_remove_eattr_entry(cx, leaf_bh, ea_hdr,
ea_hdr_prev, 1, 1);
}
- if (offset + be32_to_cpu(ea_hdr->ea_rec_len) > max_size){
- log_err( _("EA rec length too long\n"));
+ if (offset + rec_len > offset_limit &&
+ offset + rec_len != sdp->sd_bsize) {
+ log_err( _("EA record length too long (%"PRIu32"+%"PRIu32")\n"),
+ offset, rec_len);
return ask_remove_eattr_entry(cx, leaf_bh, ea_hdr,
ea_hdr_prev, 1, 1);
}
- if (offset + be32_to_cpu(ea_hdr->ea_rec_len) == max_size &&
+ if (offset + rec_len == sdp->sd_bsize &&
(ea_hdr->ea_flags & GFS2_EAFLAG_LAST) == 0){
log_err( _("last EA has no last entry flag\n"));
return ask_remove_eattr_entry(cx, leaf_bh, ea_hdr,
--
2.35.3

19
_service Normal file
View File

@ -0,0 +1,19 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://pagure.io/gfs2-utils.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">gfs2-utils*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">gfs2-utils</param>
</service>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://pagure.io/gfs2-utils.git</param>
<param name="changesrevision">b52677874d0e9fe4d311bd0ce430299e7ddc4c3c</param></service></servicedata>

BIN
gfs2-utils-3.5.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

95
gfs2-utils.changes Normal file
View File

@ -0,0 +1,95 @@
-------------------------------------------------------------------
Tue Feb 27 10:59:24 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %autosetup macro. Allows to eliminate the usage of deprecated
%patchN.
-------------------------------------------------------------------
Mon Aug 21 01:22:00 UTC 2023 - Heming Zhao <heming.zhao@suse.com>
- Update to version 3.5.1 (jsc#PED-6362)
* Don't use char arrays as temporary buffers
* libgfs2: Separate gfs and gfs2 code in lgfs2_sb_out()
* Re-enable -Wstrict-aliasing
* gfs2_convert: Clean up strict-aliasing warnings
* libgfs2: Fix strict-aliasing warning in lgfs2_rgrp_bitbuf_alloc
* gfs2_jadd: Fix format string warnings on 32-bit
* gfs2_edit: Fix savemeta test failures in 32-bit environments
- Back port bugfix patch after tag 3.5.1
+ 0001-fsck.gfs2-Tighten-offset-check-in-check_eattr_entrie.patch
+ 0002-fsck.gfs2-Fix-max-xattr-record-length-check.patch
+ 0003-fsck.gfs2-Fix-xattr-offset-checks-in-p1_check_eattr_.patch
- Update rpm build file
* _service
* _servicedata
-------------------------------------------------------------------
Mon Mar 6 15:28:16 UTC 2023 - Andrea Manzini <andrea.manzini@suse.com>
- Update to version 3.5.0:
* Update translation template
* Fix uninitialized memory coverity warnings
* gfs2_grow: Don't free rgs when it's NULL
* libgfs2: Fix potential NULL deref in lgfs2_lookupi()
* libgfs2: Add lgfs2_bfree(), lgfs2_inode_free()
* Free per_node in build_per_node error paths
* fsck.gfs2: Fix wrong entry used in dentry comparison
* added unit tests
* Remove lgfs2_breadm()
* libgfs2: Make sure block_alloc() fails when out of space
* Remove dependency on linux/limits.h
* mkfs.gfs2: Improve journal write error reporting
* mkfs.gfs2: Add -U UUID option
-------------------------------------------------------------------
Wed Nov 24 16:23:38 UTC 2021 - varkoly@suse.com
- Update to version 3.4.1+git.87.c0ea1bc4:
* libgfs2: Remove new_rgrps from struct gfs2_sbd
* tests: Increase the size of the sparse file used by tests
* gfs2/edit: always use "%s"-style format for printf()-style functions
* tunegfs2: Use O_EXCL when opening the device rw
* Make sure i_bh is set after lgfs2_gfs_inode_get()
* libgfs2: Avoid potential gfs/gfs2 superblock update clash
* gfs2_edit: Fix segfault in hexdump()
* libgfs2: Add NULL-checking for ip->i_bh in inode_put()
* fsck.gfs2: Fix remaining endianness sparse warnings
* gfs2_edit: Fix remaining endianness sparse warnings
-------------------------------------------------------------------
Wed Aug 3 03:27:36 UTC 2016 - zren@suse.com
- Update to version 3.1.9
- Fix RPM building error due to upstream putting all binaries
into /usr/sbin now
-------------------------------------------------------------------
Wed Jan 14 22:00:09 UTC 2015 - p.drouand@gmail.com
- Update to version 3.1.7
+ No changelog available
- Use download Url as source
- Use official tarball
- Specfile cleanup
- Pass NOCONFIGURE to autogen.sh
-------------------------------------------------------------------
Tue Sep 17 15:37:28 UTC 2013 - lmb@suse.com
- Update spec file copyright
- Remove unnecessary clean section
-------------------------------------------------------------------
Fri Sep 13 09:15:03 UTC 2013 - lmb@suse.com
- Update to 3.1.6+git.1378394292.fa32906
- Remove source URL from spec file, since there are no downloadable tar
balls for the git version
------------------------------------------------------------------
Sat Aug 3 11:39:43 CDT 2013 - rgoldwyn@suse.com
- Initial package gfs2-utils

90
gfs2-utils.spec Normal file
View File

@ -0,0 +1,90 @@
#
# spec file for package gfs2-utils
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: gfs2-utils
Version: 3.5.1
Release: 0
Summary: Utilities for managing the global file system (GFS2)
License: GPL-2.0-or-later AND LGPL-2.0-or-later
Group: System/Filesystems
URL: https://pagure.io/gfs2-utils
Source: https://pagure.io/gfs2-utils/archive/%{version}/%{name}-%{version}.tar.gz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: bzip2
BuildRequires: check
BuildRequires: flex
BuildRequires: gettext
BuildRequires: libblkid-devel
BuildRequires: libblkid1
BuildRequires: libbz2-devel
BuildRequires: libtool
BuildRequires: libuuid-devel
BuildRequires: libuuid1
BuildRequires: make
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
# Upstream patches
Patch1: 0001-fsck.gfs2-Tighten-offset-check-in-check_eattr_entrie.patch
Patch2: 0002-fsck.gfs2-Fix-max-xattr-record-length-check.patch
Patch3: 0003-fsck.gfs2-Fix-xattr-offset-checks-in-p1_check_eattr_.patch
%description
The gfs2-utils package contains a number of utilities for creating,
checking, modifying, and correcting any inconsistencies in GFS2
file systems.
%prep
%autosetup -p1
%build
#NOCONFIGURE=1
./autogen.sh
%configure
%make_build
%check
make check
%install
make -C gfs2 install DESTDIR=%{buildroot}
# Don't ship gfs2_{trace,lockcapture} in this package
rm -f %{buildroot}%{_sbindir}/gfs2_trace
rm -f %{buildroot}%{_sbindir}/gfs2_lockcapture
rm -f %{buildroot}%{_mandir}/man8/gfs2_trace.8
rm -f %{buildroot}%{_mandir}/man8/gfs2_lockcapture.8
%files
%license doc/COPYING.*
%doc doc/COPYRIGHT doc/README.* doc/*.txt
%dir %{_prefix}/lib/udev
%dir %{_prefix}/lib/udev/rules.d
%{_sbindir}/fsck.gfs2
%{_sbindir}/glocktop
%{_sbindir}/mkfs.gfs2
%{_sbindir}/tunegfs2
%{_sbindir}/gfs2_*
%{_libexecdir}/gfs2_withdraw_helper
%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules
%{_mandir}/man8/*gfs2*%{?ext_man}
%{_mandir}/man5/*
%{_mandir}/man8/glocktop.8%{?ext_man}
%changelog