Re: [PATCH 9/9] libext2fs: sort keys for xattr blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 13, 2016 at 02:38:24PM -0800, Darrick J. Wong wrote:
> Richard Purdie reports that libext2fs doesn't sort attribute keys in
> the xattr block correctly, causing the kernel to return -ENODATA when
> querying attributes that should be there.  Therefore, sort attributes
> so that whatever ends up in the xattr block is sorted according to
> what the kernel expects.
> 
> Cc: Darren Hart <dvhart@xxxxxxxxxxxxxxx>
> Reported-by: Richard Purdie <richard.purdie@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Applied, with one minor change.  You should never use something like
/tmp/b in a test script becuase it's possible that /tmp/b might
already exist, and might be not even owned by the user.  (In my case
/tmp/b was a root owned file that was sufficiently big that it it
caused ea_set command to fail with a "out of space" error.)

If /tmp/b was writable by the user and was something previous, then
the developer might get after the test script executes "rm -rf /tmp/b".

						- Ted

diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script
index 30c189a..30187f1 100644
--- a/tests/d_xattr_sorting/script
+++ b/tests/d_xattr_sorting/script
@@ -17,16 +17,18 @@ $MKE2FS -Fq $TMPFILE 512 > /dev/null 2>&1
 status=$?
 echo Exit status is $status >> $OUT
 
-perl -e 'print "x" x 256;' > /tmp/b
+B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
+
+perl -e 'print "x" x 256;' > $B
 
 echo "ea_set / security.SMEG64 -f /tmp/b" > $OUT.new
-$DEBUGFS -w -R "ea_set / security.SMEG64 -f /tmp/b" $TMPFILE >> $OUT.new 2>&1
+$DEBUGFS -w -R "ea_set / security.SMEG64 -f $B" $TMPFILE >> $OUT.new 2>&1
 status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
 
 echo "ea_set / security.imb -f /tmp/b" > $OUT.new
-$DEBUGFS -w -R "ea_set / security.imb -f /tmp/b" $TMPFILE >> $OUT.new 2>&1
+$DEBUGFS -w -R "ea_set / security.imb -f $B" $TMPFILE >> $OUT.new 2>&1
 status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
@@ -37,7 +39,8 @@ status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
 
-rm -rf /tmp/b
+rm -f $B
+unset B
 
 echo "ea_list /" > $OUT.new
 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux