Consider including ef388e2054fe ("xfs: don't allow di_size with high bit set") into stable releases
Subsystems (2)
Hello,
The patch in the subject applies cleanly on 4.4 and I have attached the backport for 3.12. This causes hangs in both xfs/133 and xfs/134. As is customary - a battery of xfstests have been run to ensure no regressions were introduced.
Regards,
Nikolay
Quoted 1 line
From
a8581aae46a02f329fce5678a5932d99e1c188e0Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Mon, 5 Dec 2016 12:38:38 +1100
Subject: [PATCH] xfs: don't allow di_size with high bit set
The on-disk field di_size is used to set i_size, which is a signed integer of loff_t. If the high bit of di_size is set, we'll end up with a negative i_size, which will cause all sorts of problems. Since the VFS won't let us create a file with such length, we should catch them here in the verifier too.
[nborisov: Backported to 3.12]
--- fs/xfs/xfs_inode_buf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/xfs/xfs_inode_buf.c +8 -0
@@ -301,6 +301,14 @@ xfs_dinode_verify(if (dip->di_magic !=cpu_to_be16 (XFS_DINODE_MAGIC ))return false; +/* don't allow invalid i_size */ +if (be64_to_cpu (dip->di_size) & (1ULL <<63 )) +return false; + +/* No zero-length symlinks. */ +if (S_ISLNK (be16_to_cpu (dip->di_mode)) && dip->di_size ==0 ) +return false; +/* only version 3 or greater inodes are extensively verified here */ if (dip->di_version <3 )return true;
Signature · 1 line
2.7.4
Jiri Slaby
AppliedQuoted 7 lines · Nikolay Borisov
Hello,
The patch in the subject applies cleanly on 4.4 and I have attached the backport for 3.12. This causes hangs in both xfs/133 and xfs/134. As is customary - a battery of xfstests have been run to ensure no regressions were introduced.
Applied to 3.12, thanks!
Signature · 2 lines
js suse labs