Bug 1333925

Summary: libglusterfs: race conditions and illegal mem access in timer
Product: [Community] GlusterFS Reporter: Kaleb KEITHLEY <kkeithle>
Component: coreAssignee: Kaleb KEITHLEY <kkeithle>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1342620 (view as bug list) Environment:
Last Closed: 2016-12-06 05:17:20 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:
Bug Depends On:    
Bug Blocks: 1342620    

Description Kaleb KEITHLEY 2016-05-06 16:46:19 UTC
Description of problem:

While investigating gfapi memory consumption with valgrind found several issues with memory access

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

mainline, 3.8.x, 3.7.x.

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Vijay Bellur 2016-05-06 17:54:05 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions and illegal mem access) posted (#1) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 2 Vijay Bellur 2016-05-18 14:24:56 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions and illegal mem access) posted (#2) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 3 Vijay Bellur 2016-05-29 01:35:51 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions, illegal mem access, mem leak) posted (#3) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 4 Vijay Bellur 2016-05-29 10:54:31 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions, illegal mem access, mem leak) posted (#4) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 5 Vijay Bellur 2016-05-29 11:34:15 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions, illegal mem access, mem leak) posted (#5) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 6 Vijay Bellur 2016-05-29 13:06:16 UTC
REVIEW: http://review.gluster.org/14247 (libglusterfs (timer): race conditions, illegal mem access, mem leak) posted (#6) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 7 Vijay Bellur 2016-06-01 13:50:17 UTC
COMMIT: http://review.gluster.org/14247 committed in master by Jeff Darcy (jdarcy) 
------
commit 24dd33929bbbc9a72360793048f17bf4e6cec8a3
Author: Kaleb S KEITHLEY <kkeithle>
Date:   Fri May 6 13:04:38 2016 -0400

    libglusterfs (timer): race conditions, illegal mem access, mem leak
    
    While investigating gfapi memory consumption with valgrind, valgrind
    reported several memory access issues.
    
    Also see the timer 'registry' being recreated (shortly) after being
    freed during teardown due to the way it's currently written.
    
    Passing ctx as data to gf_timer_proc() is prone to memory access
    issues if ctx is freed before gf_timer_proc() terminates. (And in
    fact this does happen, at least in valgrind.) gf_timer_proc() doesn't
    need ctx for anything, it only needs ctx->timer, so just pass that.
    
    Nothing ever calls gf_timer_registry_init(). Nothing outside of
    timer.c that is. Making it and gf_timer_proc() static.
    
    Change-Id: Ia28454dda0cf0de2fec94d76441d98c3927a906a
    BUG: 1333925
    Signed-off-by: Kaleb S KEITHLEY <kkeithle>
    Reviewed-on: http://review.gluster.org/14247
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Smoke: Gluster Build System <jenkins.com>
    CentOS-regression: Gluster Build System <jenkins.com>
    Reviewed-by: Poornima G <pgurusid>
    Reviewed-by: Niels de Vos <ndevos>
    Reviewed-by: Jeff Darcy <jdarcy>