Bug 1559337

Summary: server-less glusterfsd segmentation faults without volfile-id
Product: [Community] GlusterFS Reporter: fredrik.widlund
Component: coreAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: mainlineCC: amukherj, atumball, bugs, jeff, rhs-bugs, vbellur
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: glusterfs-4.1.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-08 11:02:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description fredrik.widlund 2018-03-22 10:42:26 UTC
Description of problem:

# glusterfsd -f server.vol --debug # crash

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

git master 22/3 2018

How reproducible:

Always

Steps to Reproduce:

# cat server.vol 
volume posix
  type storage/posix
  option directory /data
end-volume

volume server
  type protocol/server
  option transport-type tcp
  subvolumes posix
end-volume
# glusterfsd -f server.vol --debug

Actual results:

[...]
/usr/local/lib/libglusterfs.so.0(+0x23c3c)[0x7fb7a7b20c3c]
/usr/local/lib/libglusterfs.so.0(gf_print_trace+0x2d2)[0x7fb7a7b2aa32]
/usr/lib/libc.so.6(+0x348e0)[0x7fb7a5f008e0]
/usr/lib/libc.so.6(+0x156f11)[0x7fb7a6022f11]
/usr/local/lib/glusterfs/4.1dev/xlator/protocol/server.so(+0xa30e)[0x7fb7a116930e]
/usr/local/lib/glusterfs/4.1dev/xlator/protocol/server.so(+0xc1c3)[0x7fb7a116b1c3]
/usr/local/lib/libglusterfs.so.0(xlator_init+0x9f)[0x7fb7a7b1e21f]
/usr/local/lib/libglusterfs.so.0(+0x5af39)[0x7fb7a7b57f39]
/usr/local/lib/libglusterfs.so.0(glusterfs_graph_activate+0x34)[0x7fb7a7b58794]
glusterfsd(glusterfs_process_volfp+0x13b)[0x5642c4634f0b]
glusterfsd(glusterfs_volumes_init+0xf7)[0x5642c4635097]
glusterfsd(main+0x7ee)[0x5642c463128e]
/usr/lib/libc.so.6(__libc_start_main+0xea)[0x7fb7a5eecf4a]
glusterfsd(_start+0x2a)[0x5642c463141a]
---------
Segmentation fault (core dumped)


Additional info:

# glusterfsd -f server.vol --debug --volfile-id=foo # works even though no server is used

server.c:1145        FIRST_CHILD(this)->volfile_id
	                    = gf_strdup (this->ctx->cmd_args.volfile_id);

Comment 2 Jeff Darcy 2018-03-22 14:56:31 UTC
While I agree that this shouldn't crash, I'm not sure it should actually work either. Volfile-id could be considered essential information, as it's used for things other than finding a volfile - e.g. in notifications, for attaching/detaching bricks when multiplexing is enabled. IMO we should check for its presence and exit if it's not given. Any external automation not using glusterd (which is not generally supported anyway) should be trivially able to deal with that.

Comment 3 Amar Tumballi 2018-10-08 11:02:23 UTC
This is fixed with https://review.gluster.org/#/c/glusterfs/+/19893/