Bug 1600349 - call stack group list leaks
Summary: call stack group list leaks
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On: 1513928
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-12 04:12 UTC by homma
Modified: 2018-11-20 05:53 UTC (History)
4 users (show)

Fixed In Version:
Clone Of: 1513928
Environment:
Last Closed: 2018-11-20 05:53:15 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description homma 2018-07-12 04:12:33 UTC
+++ This bug was initially created as a clone of Bug #1513928 +++

Description of problem:

The call_stack_set_groups() function that was made available in https://review.gluster.org/17706 (the fix of Bug 1464327) is a defectuous interface: it sets the group list buffer of the call stack in a way that ignores its memory management conventions and thus the call stack's group list will not be freed upon the retirement of the call stack.

--- Additional comment from Worker Ant on 2017-11-16 06:09:01 EST ---

REVIEW: https://review.gluster.org/18789 (libglusterfs: fix the call_stack_set_group() function) posted (#1) for review on master by Csaba Henk

--- Additional comment from Worker Ant on 2017-11-24 11:55:19 EST ---

COMMIT: https://review.gluster.org/18789 committed in master by \"Csaba Henk\" <csaba> with a commit message- libglusterfs: fix the call_stack_set_group() function

- call_stack_set_group() will take the ownership of passed
  buffer from caller;
- to indicate the change, its signature is changed from
  including the buffer directly to take a pointer to it;
- either the content of the buffer is copied to the
  groups_small embedded buffer of the call stack, or
  the buffer is set as groups_large member of the call
  stack;
- the groups member of the call stack is set to,
  respectively, groups_small or groups_large, according
  to the memory management conventions of the call stack;
- the buffer address is overwritten with junk to effectively
  prevent the caller from using it further on.

Also move call_stack_set_group to stack.c from stack.h
to prevent "defined but not used [-Wunused-function]"
warnings (not using it anymore in call_stack_alloc_group()
implementation, which saved us from this so far).

protocol/server: refactor gid_resolve()

In gid_resolve there are two cases:
either the gid_cache_lookup() call returns
a value or not. The result is caputured in
the agl variable, and throughout the function,
each particular stage of the implementation
comes with an agl and a no-agl variant.

In most cases this is explicitly indicated
via an

   if (agl) {
      ...
   } else {
      ...
   }

but some of this branching are expressed via
goto constructs (obfuscating the fact we stated
above, that is, each particular stage having
an agl/no-agl variant).

In the current refactor, we bring the agl
conditional to the top, and present the
agl/non-agl implementations sequentially.

Also we take the opportunity to clean up and
fix the agl case:
- remove the spurious
    gl.gl_list = agl->gl_list;
  setting, as gl is not used in the agl caae
- populate the group list of call stack from
  agl, fixing thus referred BUG.

Also fixes BUG: 1513920

Change-Id: I61f4574ba21969f7661b9ff0c9dce202b874025d
BUG: 1513928
Signed-off-by: Csaba Henk <csaba>

--- Additional comment from Shyamsundar on 2018-03-15 07:20:54 EDT ---

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-4.0.0, please open a new bug report.

glusterfs-4.0.0 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/2018-March/000092.html
[2] https://www.gluster.org/pipermail/gluster-users/

Comment 1 Amar Tumballi 2018-09-18 13:47:01 UTC
Can you consider upgrading to 4.1.4, which has the fix?

https://docs.gluster.org/en/latest/Developer-guide/Backport-Guidelines/

Comment 2 Shyamsundar 2018-10-23 14:55:28 UTC
Release 3.12 has been EOLd and this bug was still found to be in the NEW state, hence moving the version to mainline, to triage the same and take appropriate actions.

Comment 3 Vijay Bellur 2018-11-20 05:53:15 UTC
Closing this bug report as the issue has been fixed in 4.1.4 and later releases.


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