diff options
author | Günther Deschner <gd@samba.org> | 2017-10-09 18:02:25 +0200 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2017-11-09 09:07:06 +0000 |
commit | 535d677beabd4d6e06437c386ae80e41ae34f122 (patch) | |
tree | c9f7f8bbe42fd45b1b85e6e11562b7bd88a3e777 /tests/bugs | |
parent | 3654ddc269a366d786cdef2a799a8b95025f1c8a (diff) |
md-cache: avoid checking the xattr value buffer with string functions.
xattrs may very well contain binary, non-text data with leading 0
values. Using strcmp for checking empty values is not the appropriate
thing to do: In the best case, it might treat a binary xattr value
starting with 0 from being cached (and hence also from being reported
back with xattr). In the worst case, we might read beyond the end
of a data blob that does contain any zero byte.
We fix this by checking the length of the data blob and checking
the first byte against 0 if the length is one.
> Signed-off-by: Guenther Deschner <gd@samba.org>
> Pair-Programmed-With: Michael Adam <obnox@samba.org>
> Change-Id: If723c465a630b8a37b6be58782a2724df7ac6b11
> BUG: 1476324
> Reviewed-on: https://review.gluster.org/17910
> Reviewed-by: Michael Adam <obnox@samba.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Poornima G <pgurusid@redhat.com>
> Tested-by: Poornima G <pgurusid@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> (cherry picked from commit ab4ffdac9dec1867f2d9b33242179cf2b347319d)
Change-Id: If723c465a630b8a37b6be58782a2724df7ac6b11
BUG: 1499892
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/md-cache/bug-1476324.t | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/bugs/md-cache/bug-1476324.t b/tests/bugs/md-cache/bug-1476324.t new file mode 100644 index 00000000000..c34f412a15e --- /dev/null +++ b/tests/bugs/md-cache/bug-1476324.t @@ -0,0 +1,27 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd; + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3}; + +TEST $CLI volume start $V0 + +TEST $CLI volume set $V0 performance.md-cache-timeout 600 +TEST $CLI volume set $V0 performance.cache-samba-metadata on + +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 + +TEST touch $M0/file1 + +TEST "setfattr -n user.DOSATTRIB -v 0sAAOW $M0/file1" +TEST "getfattr -n user.DOSATTRIB $M0/file1 -e base64 | grep -q 0sAAOW" + +TEST "setfattr -n user.DOSATTRIB -v 0x00ff $M0/file1" +TEST "getfattr -n user.DOSATTRIB $M0/file1 -e hex | grep -q 0x00ff" + +cleanup; |