summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2023-01-28 01:22:29 -0500
committerTheodore Ts'o <tytso@mit.edu>2023-01-29 23:16:38 -0500
commit38e988643a085ee804b5274fc39bc8a4befe6106 (patch)
tree303d51a57af6540f22b1baf724c1e068b9005afe /tests
parent04cee87699b32b1c4e0c41ffc5ca4540e7a3232f (diff)
downloade2fsprogs-38e988643a085ee804b5274fc39bc8a4befe6106.tar.gz
Change the xattr entry hash to use an unsighed char by default
Starting in Linux 6.2, char is forced to always unsigned when compiling the kernel, even on those platforms (such as x86) where char was traditionally signed. This exposed a bug in ext4, where when calculating the extended attribute entry hash, we used a char value from the extended attribute name. This resulted with the entry hash, which is stored on-disk, to variable depending on whether the plaform used a signed or unsigned char. Fortunately, the xattr names tend to be ASCII characters with the 8th bit zero, so it wasn't noticed two decades (this bugs dates back to the introduction of extended attribute support to ext2 in 2.5.46). However, when this change was made in v6.2-rc1, the inconsistency between the extended attribute hash calculated by e2fsprogs (which was still using a signed char on x86) was different from an x86 kernel, and this triggered a test failure in generic/454. This was fixed in kernel commit f3bbac32475b (" ext4: deal with legacy signed xattr name hash values"), where Linus decreed that it wasn't worth it to fix this the same way we had addressed has used by the dir_index feature. Instead, starting in the 6.2 kernel, ext4 will accept both the hash calculated using signed and unsigned chars, but set the entry hash using the unsigned char. This commit makes e2fsprogs follow suit. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests')
-rw-r--r--tests/f_ea_signed_hash/expect.17
-rw-r--r--tests/f_ea_signed_hash/image.gzbin0 -> 1128 bytes
-rw-r--r--tests/f_ea_signed_hash/script2
-rw-r--r--tests/f_ea_unsigned_hash/expect.17
-rw-r--r--tests/f_ea_unsigned_hash/image.gzbin0 -> 1321 bytes
-rw-r--r--tests/f_ea_unsigned_hash/script2
6 files changed, 18 insertions, 0 deletions
diff --git a/tests/f_ea_signed_hash/expect.1 b/tests/f_ea_signed_hash/expect.1
new file mode 100644
index 00000000..5f2b47ac
--- /dev/null
+++ b/tests/f_ea_signed_hash/expect.1
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/24 files (0.0% non-contiguous), 29/200 blocks
+Exit status is 0
diff --git a/tests/f_ea_signed_hash/image.gz b/tests/f_ea_signed_hash/image.gz
new file mode 100644
index 00000000..dbbc97f7
--- /dev/null
+++ b/tests/f_ea_signed_hash/image.gz
Binary files differ
diff --git a/tests/f_ea_signed_hash/script b/tests/f_ea_signed_hash/script
new file mode 100644
index 00000000..8ab2b9c6
--- /dev/null
+++ b/tests/f_ea_signed_hash/script
@@ -0,0 +1,2 @@
+ONE_PASS_ONLY="true"
+. $cmd_dir/run_e2fsck
diff --git a/tests/f_ea_unsigned_hash/expect.1 b/tests/f_ea_unsigned_hash/expect.1
new file mode 100644
index 00000000..5f2b47ac
--- /dev/null
+++ b/tests/f_ea_unsigned_hash/expect.1
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/24 files (0.0% non-contiguous), 29/200 blocks
+Exit status is 0
diff --git a/tests/f_ea_unsigned_hash/image.gz b/tests/f_ea_unsigned_hash/image.gz
new file mode 100644
index 00000000..795cece2
--- /dev/null
+++ b/tests/f_ea_unsigned_hash/image.gz
Binary files differ
diff --git a/tests/f_ea_unsigned_hash/script b/tests/f_ea_unsigned_hash/script
new file mode 100644
index 00000000..8ab2b9c6
--- /dev/null
+++ b/tests/f_ea_unsigned_hash/script
@@ -0,0 +1,2 @@
+ONE_PASS_ONLY="true"
+. $cmd_dir/run_e2fsck