debugfs: byteswap dirsearch dirent buf on big endian systems
Resolves: RHEL-74431 Signed-off-by: Pavel Reichl <preichl@redhat.com>
This commit is contained in:
parent
46214138eb
commit
33e34b26c3
@ -0,0 +1,46 @@
|
||||
From 4be42019388d76c933e3b2ea80284aaf5b8eaecb Mon Sep 17 00:00:00 2001
|
||||
From: Brian Foster <bfoster@redhat.com>
|
||||
Date: Thu, 23 Jan 2025 08:52:11 -0500
|
||||
Subject: [PATCH] debugfs: byteswap dirsearch dirent buf on big endian systems
|
||||
|
||||
fstests test ext4/048 fails on big endian systems due to broken
|
||||
debugfs dirsearch functionality. On an s390x system and 4k block
|
||||
size, the dirsearch command seems to hang indefinitely. On the same
|
||||
system with a 1k block size, the command fails to locate an existing
|
||||
entry and causes the test to fail due to unexpected results.
|
||||
|
||||
The cause of the dirsearch failure is lack of byte swapping of the
|
||||
on-disk (little endian) dirent buffer before attempting to iterate
|
||||
entries in the given block. This leads to garbage record and name
|
||||
length values, for example. To resolve this problem, byte swap the
|
||||
directory buffer on big endian systems.
|
||||
|
||||
Signed-off-by: Brian Foster <bfoster@redhat.com>
|
||||
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20250123135211.575895-1-bfoster@redhat.com
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
debugfs/htree.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/debugfs/htree.c b/debugfs/htree.c
|
||||
index a1008150..4ea8f30b 100644
|
||||
--- a/debugfs/htree.c
|
||||
+++ b/debugfs/htree.c
|
||||
@@ -482,6 +482,12 @@ static int search_dir_block(ext2_filsys fs, blk64_t *blocknr,
|
||||
return BLOCK_ABORT;
|
||||
}
|
||||
|
||||
+#ifdef WORDS_BIGENDIAN
|
||||
+ errcode = ext2fs_dirent_swab_in(fs, p->buf, 0);
|
||||
+ if (errcode)
|
||||
+ return BLOCK_ABORT;
|
||||
+#endif
|
||||
+
|
||||
while (offset < fs->blocksize) {
|
||||
dirent = (struct ext2_dir_entry *) (p->buf + offset);
|
||||
errcode = ext2fs_get_rec_len(fs, dirent, &rec_len);
|
||||
--
|
||||
2.50.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: Utilities for managing ext2, ext3, and ext4 file systems
|
||||
Name: e2fsprogs
|
||||
Version: 1.47.1
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
|
||||
# License tags based on COPYING file distinctions for various components
|
||||
License: GPLv2
|
||||
@ -39,6 +39,7 @@ BuildRequires: make
|
||||
BuildRequires: gnupg2 xz
|
||||
|
||||
Patch0: rhelonly-metadata_csum_orphan_file_off.patch
|
||||
Patch1: 0002-master-debugfs-byteswap-dirsearch-dirent-buf-on-big-endian-.patch
|
||||
|
||||
%description
|
||||
The e2fsprogs package contains a number of utilities for creating,
|
||||
@ -168,7 +169,8 @@ managed device with some free space available in respective volume group.
|
||||
xzcat '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=-
|
||||
%setup -q
|
||||
|
||||
%patch0 -p1
|
||||
%patch -p1 0
|
||||
%patch -p1 1
|
||||
|
||||
# Remove flawed tests
|
||||
rm -rf tests/m_rootdir_acl
|
||||
@ -338,6 +340,10 @@ make PRINT_FAILED=yes fullcheck
|
||||
%{_udevdir}/96-e2scrub.rules
|
||||
|
||||
%changelog
|
||||
* Tue Jun 24 2025 Pavel Reichl <preichl@redhat.com> - 1.47.1-4
|
||||
- debugfs: byteswap dirsearch dirent buf on big endian systems
|
||||
Resolves: RHEL-74431
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.47.1-3
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
Loading…
Reference in New Issue
Block a user