Bug 1499893 - md-cache: xattr values should not be checked with string functions
Summary: md-cache: xattr values should not be checked with string functions
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: md-cache
Version: 3.10
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact:
URL:
Whiteboard:
Depends On: 1476324
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-09 14:42 UTC by Guenther Deschner
Modified: 2017-11-01 12:58 UTC (History)
1 user (show)

Fixed In Version: glusterfs-3.10.7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1476324
Environment:
Last Closed: 2017-11-01 12:58:54 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Guenther Deschner 2017-10-09 14:42:40 UTC
+++ This bug was initially created as a clone of Bug #1476324 +++

Description of problem:

xattr caching does not work for values with a leading 0 (due to an internal strcmp() for ""), given that often binary values are stored in xattrs (for e.g. samba specific xattrs), this is currently a serious limitation.

Version-Release number of selected component (if applicable):


How reproducible:

Everytime

Steps to Reproduce:

gluster volume set VOLUME performance.cache-samba-metadata on
mount VOLUME via fuse to /mnt
touch /mnt/test
setfattr -n user.DOSATTRIB -v 0x00ff /mnt/test
echo $?
0
getfattr -n user.DOSATTRIB -d /mnt/test
/mnt/test: user.DOSATTRIB: No such attribute

--- Additional comment from Worker Ant on 2017-07-28 11:59:05 EDT ---

REVIEW: https://review.gluster.org/17910 (md-cache: avoid checking the xattr value buffer with string functions.) posted (#1) for review on master by Günther Deschner (gd)

--- Additional comment from Worker Ant on 2017-07-31 19:23:35 EDT ---

REVIEW: https://review.gluster.org/17910 (md-cache: avoid checking the xattr value buffer with string functions.) posted (#2) for review on master by Michael Adam (obnox)

--- Additional comment from Worker Ant on 2017-07-31 19:31:26 EDT ---

REVIEW: https://review.gluster.org/17910 (md-cache: avoid checking the xattr value buffer with string functions.) posted (#3) for review on master by Michael Adam (obnox)

--- Additional comment from Worker Ant on 2017-08-01 09:14:07 EDT ---

COMMIT: https://review.gluster.org/17910 committed in master by Jeff Darcy (jeff.us) 
------
commit ab4ffdac9dec1867f2d9b33242179cf2b347319d
Author: Günther Deschner <gd>
Date:   Fri Jul 28 13:38:16 2017 +0200

    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>
    Pair-Programmed-With: Michael Adam <obnox>
    Change-Id: If723c465a630b8a37b6be58782a2724df7ac6b11
    BUG: 1476324
    Reviewed-on: https://review.gluster.org/17910
    Reviewed-by: Michael Adam <obnox>
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Poornima G <pgurusid>
    Tested-by: Poornima G <pgurusid>
    CentOS-regression: Gluster Build System <jenkins.org>

Comment 1 Worker Ant 2017-10-09 16:05:51 UTC
REVIEW: https://review.gluster.org/18460 (md-cache: avoid checking the xattr value buffer with string functions.) posted (#1) for review on release-3.10 by Günther Deschner (gd)

Comment 2 Worker Ant 2017-10-25 14:00:07 UTC
COMMIT: https://review.gluster.org/18460 committed in release-3.10 by Shyamsundar Ranganathan (srangana) 
------
commit 83615a663c1ac17812c8417dc56b85be600d17e3
Author: Günther Deschner <gd>
Date:   Mon Oct 9 18:05:03 2017 +0200

    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>
    > Pair-Programmed-With: Michael Adam <obnox>
    > Change-Id: If723c465a630b8a37b6be58782a2724df7ac6b11
    > BUG: 1476324
    > Reviewed-on: https://review.gluster.org/17910
    > Reviewed-by: Michael Adam <obnox>
    > Smoke: Gluster Build System <jenkins.org>
    > Reviewed-by: Poornima G <pgurusid>
    > Tested-by: Poornima G <pgurusid>
    > CentOS-regression: Gluster Build System <jenkins.org>
    > (cherry picked from commit ab4ffdac9dec1867f2d9b33242179cf2b347319d)
    
    Change-Id: If723c465a630b8a37b6be58782a2724df7ac6b11
    BUG: 1499893
    Signed-off-by: Günther Deschner <gd>

Comment 3 Shyamsundar 2017-11-01 12:58:54 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.10.7, please open a new bug report.

glusterfs-3.10.7 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://lists.gluster.org/pipermail/announce/2017-November/000085.html
[2] https://www.gluster.org/pipermail/gluster-users/


Note You need to log in before you can comment on or make changes to this bug.