Red Hat Bugzilla – Bug 764923
rebalance follows symlinks outside of volume
Last modified: 2015-12-01 11:45:32 EST
This should be mentioned in major bug in next release notes.
Thanks for pointing this out Joe. IMO very critical bug.
Created attachment 559
This will prevent S_ISDIR from returning true for symlinks, preventing it from walking out of the filesystem.
(In reply to comment #2)
> Created an attachment (id=559) [details]
> use lstat instead of stat when walking the directory tree
> This will prevent S_ISDIR from returning true for symlinks, preventing it from
> walking out of the filesystem.
Yes, absolutely right fix. Found that as soon as I saw the bug report. Currently changes are made, and testing the fix :-)
Another point to consider is that glusterd segfaulted in the snprintf on line 223. Is some boundary checking necessary?
CHANGE: http://review.gluster.com/26 (so the symlinks pointing to directories are not considered) merged in release-3.2 by Anand Avati (firstname.lastname@example.org)
(In reply to comment #4)
> Another point to consider is that glusterd segfaulted in the snprintf on line
> 223. Is some boundary checking necessary?
We consider PATH_MAX as the boundary. So, with this fix, we should not be hitting that error anymore.
Please also patch against release-3.1
CHANGE: http://review.gluster.com/28 (so the symlinks pointing to directories are not considered) merged in release-3.1 by Anand Avati (email@example.com)
CHANGE: http://review.gluster.com/30 (so the symlinks pointing to directories are not considered) merged in master by Anand Avati (firstname.lastname@example.org)
Fix committed to all the branches.
glusterd dumped core on me last night while performing a rebalance. The core dump shows an endless loop of:
#48 0x00f38889 in gf_glusterd_rebalance_fix_layout (volinfo=0xacb07508,
where /var/lib/glusterd = /etc/glusterd under your default configuration.
ls -l home/jjulian/.wine64/dosdevices/
lrwxrwxrwx. 1 502 500 10 Jun 2 16:47 c: -> ../drive_c
lrwxrwxrwx. 1 502 500 8 Jun 2 16:47 d: -> /usr/src
lrwxrwxrwx. 1 root root 6 Jun 2 16:47 e: -> /home~
lrwxrwxrwx. 1 502 500 4 Jun 2 16:47 f: -> /var
lrwxrwxrwx. 1 502 500 8 Jun 2 16:47 g: -> /var/log
lrwxrwxrwx. 1 root root 19 Jun 2 16:47 h: -> /share/home/jjulian
lrwxrwxrwx. 1 502 500 1 Jun 2 16:47 z: -> /
So it's clearly following the symlinks and getting itself into an endless loop.
I followed the following steps for verification
- created a distribute volume and also created some symlinks on its mount point
- later i added two brick and rebalanced
in version 3.1.5
- According to logs , it was following the symlink and was getting hung
In recent pull,
- It is not showing any such logs, which means its neglecting the symlinks.
I have tested it again in 3.1.6qa2 release with same steps. Its working fine.
Sorry, I forgot bugzilla takes me to the next bug after I save changes...