Package: corosync
Version: 2.3.5-3
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu yakkety ubuntu-patch

Dear Maintainer,

The following patch has been applied to version 2.3.5-3 of 
Ubuntu Xenial to correct a memory leak situation. Bug report
is : https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1563089

Application of this fix from upstream has lead to a solution of the
problem.


  * debian/patches/Totempg-Fix-memory-leak.patch: Fixes memory leak on 
    Totempg. (LP: #1563089).

Please consider applying the proposed patch to your package.

Kind regards,

Louis Bouchard



-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety
  APT policy: (500, 'yakkety')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-23-generic (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru corosync-2.3.5/debian/libtotem-pg5.symbols corosync-2.3.5/debian/libtotem-pg5.symbols
--- corosync-2.3.5/debian/libtotem-pg5.symbols	2015-10-21 17:27:29.000000000 +0200
+++ corosync-2.3.5/debian/libtotem-pg5.symbols	2016-04-01 15:52:10.000000000 +0200
@@ -2,7 +2,6 @@
 * Build-Depends-Package: libtotem-pg-dev
  active_algo@Base 1.99.9
  assembly_list_free@Base 1.99.9
- assembly_list_free_trans@Base 2.3.0
  assembly_list_inuse@Base 1.99.9
  assembly_list_inuse_trans@Base 2.3.0
  callback_token_received_handle@Base 1.99.9
diff -Nru corosync-2.3.5/debian/patches/series corosync-2.3.5/debian/patches/series
--- corosync-2.3.5/debian/patches/series	2015-10-22 15:36:41.000000000 +0200
+++ corosync-2.3.5/debian/patches/series	2016-04-01 15:52:10.000000000 +0200
@@ -25,3 +25,4 @@
 Use-debian-changelog-timestamp-for-the-build-time-of.patch
 cmap_track_add.3.in-fix-typo-bellow-below.patch
 totemip.h-uses-list.h.patch
+Totempg-Fix-memory-leak.patch
diff -Nru corosync-2.3.5/debian/patches/Totempg-Fix-memory-leak.patch corosync-2.3.5/debian/patches/Totempg-Fix-memory-leak.patch
--- corosync-2.3.5/debian/patches/Totempg-Fix-memory-leak.patch	1970-01-01 01:00:00.000000000 +0100
+++ corosync-2.3.5/debian/patches/Totempg-Fix-memory-leak.patch	2016-04-01 15:52:10.000000000 +0200
@@ -0,0 +1,118 @@
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1563089
+Origin: upstream, https://github.com/corosync/corosync/commit/600fb4084adcbfe7678b44a83fa8f3d3550f48b9
+
+---
+
+From 600fb4084adcbfe7678b44a83fa8f3d3550f48b9 Mon Sep 17 00:00:00 2001
+From: Jan Friesse <[email protected]>
+Date: Wed, 10 Feb 2016 12:36:52 +0100
+Subject: [PATCH] totempg: Fix memory leak
+
+Previously there were two free lists. One for operational and one for
+transitional state. Because every node starts in transitional state and
+always ends in the operational state, assembly was always put to normal
+state free list and never in transitional free list, so new assembly
+structure was always allocated after new node connected.
+
+Solution is to have only one free list.
+
+Signed-off-by: Jan Friesse <[email protected]>
+Reviewed-by: Christine Caulfield <[email protected]>
+Reviewed-by: Steven Dake <[email protected]>
+---
+ exec/totempg.c | 26 +++++++-------------------
+ 1 file changed, 7 insertions(+), 19 deletions(-)
+
+diff --git a/exec/totempg.c b/exec/totempg.c
+index fe111b1..0b46782 100644
+--- a/exec/totempg.c
++++ b/exec/totempg.c
+@@ -212,12 +212,13 @@ static int callback_token_received_fn (enum totem_callback_token_type type,
+ 
+ DECLARE_LIST_INIT(assembly_list_inuse);
+ 
++/*
++ * Free list is used both for transitional and operational assemblies
++ */
+ DECLARE_LIST_INIT(assembly_list_free);
+ 
+ DECLARE_LIST_INIT(assembly_list_inuse_trans);
+ 
+-DECLARE_LIST_INIT(assembly_list_free_trans);
+-
+ DECLARE_LIST_INIT(totempg_groups_list);
+ 
+ /*
+@@ -291,14 +292,11 @@ static struct assembly *assembly_ref (unsigned int nodeid)
+ 	struct assembly *assembly;
+ 	struct list_head *list;
+ 	struct list_head *active_assembly_list_inuse;
+-	struct list_head *active_assembly_list_free;
+ 
+ 	if (totempg_waiting_transack) {
+ 		active_assembly_list_inuse = &assembly_list_inuse_trans;
+-		active_assembly_list_free = &assembly_list_free_trans;
+ 	} else {
+ 		active_assembly_list_inuse = &assembly_list_inuse;
+-		active_assembly_list_free = &assembly_list_free;
+ 	}
+ 
+ 	/*
+@@ -318,8 +316,8 @@ static struct assembly *assembly_ref (unsigned int nodeid)
+ 	/*
+ 	 * Nothing found in inuse list get one from free list if available
+ 	 */
+-	if (list_empty (active_assembly_list_free) == 0) {
+-		assembly = list_entry (active_assembly_list_free->next, struct assembly, list);
++	if (list_empty (&assembly_list_free) == 0) {
++		assembly = list_entry (assembly_list_free.next, struct assembly, list);
+ 		list_del (&assembly->list);
+ 		list_add (&assembly->list, active_assembly_list_inuse);
+ 		assembly->nodeid = nodeid;
+@@ -350,16 +348,9 @@ static struct assembly *assembly_ref (unsigned int nodeid)
+ 
+ static void assembly_deref (struct assembly *assembly)
+ {
+-	struct list_head *active_assembly_list_free;
+-
+-	if (totempg_waiting_transack) {
+-		active_assembly_list_free = &assembly_list_free_trans;
+-	} else {
+-		active_assembly_list_free = &assembly_list_free;
+-	}
+ 
+ 	list_del (&assembly->list);
+-	list_add (&assembly->list, active_assembly_list_free);
++	list_add (&assembly->list, &assembly_list_free);
+ }
+ 
+ static void assembly_deref_from_normal_and_trans (int nodeid)
+@@ -367,16 +358,13 @@ static void assembly_deref_from_normal_and_trans (int nodeid)
+ 	int j;
+ 	struct list_head *list, *list_next;
+ 	struct list_head *active_assembly_list_inuse;
+-	struct list_head *active_assembly_list_free;
+ 	struct assembly *assembly;
+ 
+ 	for (j = 0; j < 2; j++) {
+ 		if (j == 0) {
+ 			active_assembly_list_inuse = &assembly_list_inuse;
+-			active_assembly_list_free = &assembly_list_free;
+ 		} else {
+ 			active_assembly_list_inuse = &assembly_list_inuse_trans;
+-			active_assembly_list_free = &assembly_list_free_trans;
+ 		}
+ 
+ 		for (list = active_assembly_list_inuse->next;
+@@ -388,7 +376,7 @@ static void assembly_deref_from_normal_and_trans (int nodeid)
+ 
+ 			if (nodeid == assembly->nodeid) {
+ 				list_del (&assembly->list);
+-				list_add (&assembly->list, active_assembly_list_free);
++				list_add (&assembly->list, &assembly_list_free);
+ 			}
+ 		}
+ 	}
+-- 
+2.5.0
+

Reply via email to