Bug 1068781

Summary: glfs_read fails for large read
Product: [Community] GlusterFS Reporter: Joel Rausch <jsrausch.sojourn>
Component: libgfapiAssignee: GlusterFS Bugs list <gluster-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Sudhir D <sdharane>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.4.2CC: bugs, gluster-bugs, kelly.burkhart, kkeithle
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 14:18:21 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:
Attachments:
Description Flags
Program capable of reproducing problem none

Description Joel Rausch 2014-02-21 20:51:17 UTC
Created attachment 866271 [details]
Program capable of reproducing problem

Description of problem:

Reading a >32MB file with a single glfs_read call can cause a segmentation fault in the iov_copy function. It appears that some, but not all of the iov_base pointers were invalid.

Core was generated by `./tst'.
Program terminated with signal 11, Segmentation fault.
#0  __memcpy_ssse3_back ()
    at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:1579
1579	../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: No such file or directory.
	in ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
(gdb) bt
#0  __memcpy_ssse3_back ()
    at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:1579
#1  0x00007f3634b0fa7e in iov_copy (dst=0x7fff37ada3e0, dcnt=1, src=
    0x7f36200e3b70, scnt=272) at ../../libglusterfs/src/common-utils.h:386
#2  0x00007f3634b112e8 in glfs_preadv (glfd=0x633f90, iovec=0x7fff37ada3e0, 
    iovcnt=1, offset=0, flags=0) at glfs-fops.c:482
#3  0x00007f3634b113c9 in glfs_read (glfd=0x633f90, buf=0x7f361ca45010, count=
    35651584, flags=0) at glfs-fops.c:511
#4  0x00000000004012f4 in main ()
    at /home/TRADEBOT/jrausch/source/tradebot/vc/tst/tst.cpp:47
(gdb) f 1
#1  0x00007f3634b0fa7e in iov_copy (dst=0x7fff37ada3e0, dcnt=1, src=
    0x7f36200e3b70, scnt=272) at ../../libglusterfs/src/common-utils.h:386
386			memcpy (dst[d_i].iov_base + d_ii, src[s_i].iov_base + s_ii,
(gdb) p (char*) src[s_i].iov_base
$1 = 0x7f362aaf1000 <Address 0x7f362aaf1000 out of bounds>
(gdb) p (char*) src[s_i - 1].iov_base
$2 = 0x7f3616f00000 ""
(gdb) p (char*) src[s_i + 1].iov_base
$3 = 0x7f362aa71000 <Address 0x7f362aa71000 out of bounds>
(gdb) p (char*) src[s_i + 2].iov_base
$4 = 0x7f362aab1000 <Address 0x7f362aab1000 out of bounds>
(gdb) p s_i
$5 = 47
(gdb) p scnt
$6 = 272

Comment 2 Kaleb KEITHLEY 2014-10-14 14:18:21 UTC
gfapi was substantially updated in 3.4.3. If you are using 3.4.3 or later and this is still a problem please file a new bugreport. Thanks