Compare commits

...

11 Commits

Author SHA1 Message Date
openeuler-ci-bot
cdefeabd1a
!123 [sync] PR-118: xfs_scrub: don't call phase_end if phase_rusage was not initialized
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-07-12 02:53:07 +00:00
liuh
eddf311333 xfs_scrub: don't call phase_end if phase_rusage was not initialized
(cherry picked from commit 561d0f0e50c68052006347f45e9768bec2700176)
2024-07-12 10:02:32 +08:00
openeuler-ci-bot
d1cc457fd0
!121 [sync] PR-116: xfs_io: fix mread with length 1 mod page size
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-07-12 02:01:39 +00:00
liuh
a0a1e0f997 xfs_io: fix mread with length 1 mod page size
(cherry picked from commit 7562916a73a6101c7c70a03f9367d823c10da354)
2024-07-12 09:46:46 +08:00
openeuler-ci-bot
d7e5e75d30
!119 [sync] PR-114: xfs_db: 修复内存泄漏及代码优化
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-07-12 01:45:43 +00:00
liuh
02a1ee1c57 xfs_db: fix leak in flist_find_ftyp()
(cherry picked from commit 94306635596cb53a5fab70a6eb5b18ca72652656)
2024-07-12 09:17:35 +08:00
openeuler-ci-bot
a185831039
!106 Remove xfs_scrub related files from the main package
From: @ccdxx 
Reviewed-by: @wguanghao, @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2024-05-09 12:22:25 +00:00
chendexi
2568457d49 Merge branch 'openEuler-24.03-LTS' of gitee.com:src-openeuler/xfsprogs into openEuler-24.03-LTS
Signed-off-by: chendexi <chendexi@kylinos.cn>
2024-05-09 11:46:06 +00:00
openeuler-ci-bot
b51d7e1ada
!102 xfs_db: don't hardcode 'type data' size at 512b
From: @liuh0329 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2024-05-09 11:05:19 +00:00
chendexi
151c2f9d83 Remove xfs_scrub related files from the main package to remove python dependencies 2024-05-08 15:01:21 +08:00
liuh
315f731667 xfs_db: don't hardcode 'type data' size at 512b 2024-04-02 10:31:16 +08:00
6 changed files with 336 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From 127b66a4d8afc6f3dfe8929c01b1f1e63c1ebf31 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <djwong@kernel.org>
Date: Thu, 22 Feb 2024 14:04:31 -0800
Subject: xfs_db: don't hardcode 'type data' size at 512b
On a disk with 4096-byte LBAs, the xfs_db 'type data' subcommand doesn't
work:
# xfs_io -c 'sb' -c 'type data' /dev/sda
xfs_db: read failed: Invalid argument
no current object
The cause of this is the hardcoded initialization of bb_count when we're
setting type data -- it should be the filesystem sector size, not just 1.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
---
db/block.c | 3 ++-
db/io.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/db/block.c b/db/block.c
index d730c77967..22930e5a28 100644
--- a/db/block.c
+++ b/db/block.c
@@ -124,6 +124,7 @@ daddr_f(
{
int64_t d;
char *p;
+ int bb_count = BTOBB(mp->m_sb.sb_sectsize);
if (argc == 1) {
xfs_daddr_t daddr = iocur_top->off >> BBSHIFT;
@@ -144,7 +145,7 @@ daddr_f(
return 0;
}
ASSERT(typtab[TYP_DATA].typnm == TYP_DATA);
- set_cur(&typtab[TYP_DATA], d, 1, DB_RING_ADD, NULL);
+ set_cur(&typtab[TYP_DATA], d, bb_count, DB_RING_ADD, NULL);
return 0;
}
diff --git a/db/io.c b/db/io.c
index 590dd1f82f..9b2c6b4cf7 100644
--- a/db/io.c
+++ b/db/io.c
@@ -652,7 +652,8 @@ void
set_iocur_type(
const typ_t *type)
{
- int bb_count = 1; /* type's size in basic blocks */
+ /* type's size in basic blocks */
+ int bb_count = BTOBB(mp->m_sb.sb_sectsize);
int boff = iocur_top->boff;
/*
--
cgit 1.2.3-korg

View File

@ -0,0 +1,35 @@
From 21dc682a3842eb7e4c79f7e511d840e708d7e757 Mon Sep 17 00:00:00 2001
From: Andrey Albershteyn <aalbersh@redhat.com>
Date: Tue, 23 Apr 2024 14:36:14 +0200
Subject: xfs_db: fix leak in flist_find_ftyp()
When count is zero fl reference is lost. Fix it by freeing the list.
Fixes: a0d79cb37a36 ("xfs_db: make flist_find_ftyp() to check for field existance on disk")
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
---
db/flist.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/db/flist.c b/db/flist.c
index c81d229..0a6cc5f 100644
--- a/db/flist.c
+++ b/db/flist.c
@@ -424,8 +424,10 @@ flist_find_ftyp(
if (f->ftyp == type)
return fl;
count = fcount(f, obj, startoff);
- if (!count)
+ if (!count) {
+ flist_free(fl);
continue;
+ }
fa = &ftattrtab[f->ftyp];
if (fa->subfld) {
flist_t *nfl;
--
2.27.0

View File

@ -0,0 +1,101 @@
From a21daa3a739194b929de644779c359949390d467 Mon Sep 17 00:00:00 2001
From: Andrey Albershteyn <aalbersh@redhat.com>
Date: Wed, 17 Apr 2024 18:19:30 +0200
Subject: xfs_db: add helper for flist_find_type for clearer field matching
Make flist_find_type() more readable by unloading field type
matching to the helper.
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
db/flist.c | 60 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 38 insertions(+), 22 deletions(-)
diff --git a/db/flist.c b/db/flist.c
index 0a6cc5f..ab0a0f1 100644
--- a/db/flist.c
+++ b/db/flist.c
@@ -400,6 +400,40 @@ flist_split(
return v;
}
+static flist_t *
+flist_field_match(
+ const field_t *field,
+ fldt_t type,
+ void *obj,
+ int startoff)
+{
+ flist_t *fl;
+ int count;
+ const ftattr_t *fa;
+ flist_t *nfl;
+
+ fl = flist_make(field->name);
+ fl->fld = field;
+ if (field->ftyp == type)
+ return fl;
+ count = fcount(field, obj, startoff);
+ if (!count)
+ goto out;
+ fa = &ftattrtab[field->ftyp];
+ if (!fa->subfld)
+ goto out;
+
+ nfl = flist_find_ftyp(fa->subfld, type, obj, startoff);
+ if (nfl) {
+ fl->child = nfl;
+ return fl;
+ }
+
+out:
+ flist_free(fl);
+ return NULL;
+}
+
/*
* Given a set of fields, scan for a field of the given type.
* Return an flist leading to the first found field
@@ -413,33 +447,15 @@ flist_find_ftyp(
void *obj,
int startoff)
{
- flist_t *fl;
const field_t *f;
- int count;
- const ftattr_t *fa;
+ flist_t *fl;
for (f = fields; f->name; f++) {
- fl = flist_make(f->name);
- fl->fld = f;
- if (f->ftyp == type)
+ fl = flist_field_match(f, type, obj, startoff);
+ if (fl)
return fl;
- count = fcount(f, obj, startoff);
- if (!count) {
- flist_free(fl);
- continue;
- }
- fa = &ftattrtab[f->ftyp];
- if (fa->subfld) {
- flist_t *nfl;
-
- nfl = flist_find_ftyp(fa->subfld, type, obj, startoff);
- if (nfl) {
- fl->child = nfl;
- return fl;
- }
- }
- flist_free(fl);
}
+
return NULL;
}
--
2.27.0

View File

@ -0,0 +1,72 @@
From 7ea701ffc7cf306a903f2966519b3f5aedfb77ea Mon Sep 17 00:00:00 2001
From: Eric Biggers <ebiggers@google.com>
Date: Tue, 11 Jun 2024 11:29:28 -0700
Subject: xfs_io: fix mread with length 1 mod page size
Fix a weird bug in mread where if you passed it a length that was 1
modulo the page size, for example
xfs_io -r file -c "mmap -r 0 8192" -c "mread -v 0 4097"
... it never reset its pointer into the buffer into which it copies the
data from the memory map. This caused an out-of-bounds write, which
depending on the length passed could be very large and reliably
segfault. Also nothing was printed, despite the use of -v option.
(I don't know if this case gets reached by any existing xfstest, but
presumably not. I noticed it while working on a patch to an xfstest.)
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
io/mmap.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/io/mmap.c b/io/mmap.c
index 425957d..a5f30e0 100644
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -472,34 +472,26 @@ mread_f(
dumplen = pagesize;
if (rflag) {
- for (tmp = length - 1, c = 0; tmp >= 0; tmp--, c = 1) {
- *bp = *(((char *)mapping->addr) + dumpoffset + tmp);
- cnt++;
- if (c && cnt == dumplen) {
+ for (tmp = length - 1; tmp >= 0; tmp--) {
+ bp[cnt++] = ((char *)mapping->addr)[dumpoffset + tmp];
+ if (cnt == dumplen) {
if (dump) {
dump_buffer(printoffset, dumplen);
printoffset += dumplen;
}
- bp = (char *)io_buffer;
dumplen = pagesize;
cnt = 0;
- } else {
- bp++;
}
}
} else {
- for (tmp = 0, c = 0; tmp < length; tmp++, c = 1) {
- *bp = *(((char *)mapping->addr) + dumpoffset + tmp);
- cnt++;
- if (c && cnt == dumplen) {
+ for (tmp = 0; tmp < length; tmp++) {
+ bp[cnt++] = ((char *)mapping->addr)[dumpoffset + tmp];
+ if (cnt == dumplen) {
if (dump)
dump_buffer(printoffset + tmp -
(dumplen - 1), dumplen);
- bp = (char *)io_buffer;
dumplen = pagesize;
cnt = 0;
- } else {
- bp++;
}
}
}
--
2.43.0

View File

@ -0,0 +1,42 @@
From c4dd920b8a8900046e0785e55a43c7190b82c59a Mon Sep 17 00:00:00 2001
From: Andrey Albershteyn <aalbersh@redhat.com>
Date: Tue, 23 Apr 2024 14:36:16 +0200
Subject: xfs_scrub: don't call phase_end if phase_rusage was not initialized
If unicrash_load() fails, all_pi can be used uninitialized in
phase_end(). Fix it by going to the unload: section if unicrash_load
fails and just go with unicrash_unload() (the is_service won't be
initialized here).
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
---
scrub/xfs_scrub.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index 752180d..5056585 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -631,7 +631,7 @@ main(
fprintf(stderr,
_("%s: couldn't initialize Unicode library.\n"),
progname);
- goto out;
+ goto out_unicrash;
}
pthread_mutex_init(&ctx.lock, NULL);
@@ -828,6 +828,7 @@ out:
phase_end(&all_pi, 0);
if (progress_fp)
fclose(progress_fp);
+out_unicrash:
unicrash_unload();
/*
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: xfsprogs Name: xfsprogs
Version: 6.6.0 Version: 6.6.0
Release: 2 Release: 7
Summary: Administration and debugging tools for the XFS file system Summary: Administration and debugging tools for the XFS file system
License: GPL+ and LGPLv2+ License: GPL+ and LGPLv2+
URL: https://xfs.wiki.kernel.org URL: https://xfs.wiki.kernel.org
@ -21,6 +21,11 @@ Conflicts: xfsdump < 3.0.1
Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch
Patch1: 0001-xfsprogs-Add-sw64-architecture.patch Patch1: 0001-xfsprogs-Add-sw64-architecture.patch
Patch2: 0002-xfs-fix-internal-error-from-AGFL-exhaustion.patch Patch2: 0002-xfs-fix-internal-error-from-AGFL-exhaustion.patch
Patch3: 0003-xfs_db-don-t-hardcode-type-data-size-at-512b.patch
Patch4: 0004-xfs_db-fix-leak-in-flist_find_ftyp.patch
Patch5: 0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch
Patch6: 0006-xfs_io-fix-mread-with-length-1-mod-page-size.patch
Patch7: 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch
%description %description
xfsprogs are the userspace utilities that manage XFS filesystems. xfsprogs are the userspace utilities that manage XFS filesystems.
@ -81,6 +86,8 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%{_sbindir}/* %{_sbindir}/*
%{_unitdir}/* %{_unitdir}/*
%{_datadir}/xfsprogs/mkfs/*.conf %{_datadir}/xfsprogs/mkfs/*.conf
%exclude %{_sbindir}/xfs_scrub*
%exclude %{_unitdir}/xfs_scrub*
%files xfs_scrub %files xfs_scrub
%{_sbindir}/xfs_scrub* %{_sbindir}/xfs_scrub*
@ -102,6 +109,22 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%changelog %changelog
* Sat Jul 6 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-7
- xfs_scrub: don't call phase_end if phase_rusage was not initialized
* Fri Jun 21 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-6
- sync pathc from community
xfs_io: fix mread with length 1 mod page size
* Tue Jun 4 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-5
- sync patches from community
* Wed May 08 2024 chendexi <chendexi@kylinos.cn> - 6.6.0-4
- Remove xfs_scrub related files from the main package to remove python dependencies
* Tue Apr 2 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-3
- sync patch from community
* Fri Mar 29 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-2 * Fri Mar 29 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-2
- sync patch from community - sync patch from community