summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-09-26 10:36:29 +0800
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-09-30 21:34:09 -0400
commitb202f3824bdbf65b922d58e348972183e57f61fe (patch)
tree848371a13480519d90ced1bf0723a9a468776e7f
parentf6d23e4364a729006fd655c758e74f1c7e69cf94 (diff)
downloadmeta-cloud-services-b202f3824bdbf65b922d58e348972183e57f61fe.tar.gz
glusterfs: fix CVE-2018-10924
Backport patch to fix the following CVE. CVE: CVE-2018-10924 Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-extended/glusterfs/files/0005-cluster-afr-Fix-dict-leak-in-pre-op.patch135
-rw-r--r--recipes-extended/glusterfs/glusterfs.inc1
2 files changed, 136 insertions, 0 deletions
diff --git a/recipes-extended/glusterfs/files/0005-cluster-afr-Fix-dict-leak-in-pre-op.patch b/recipes-extended/glusterfs/files/0005-cluster-afr-Fix-dict-leak-in-pre-op.patch
new file mode 100644
index 0000000..d218a22
--- /dev/null
+++ b/recipes-extended/glusterfs/files/0005-cluster-afr-Fix-dict-leak-in-pre-op.patch
@@ -0,0 +1,135 @@
1From f4dddd7727988b8077b2da577e195621d5bac9c7 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 25 Sep 2018 15:23:10 +0800
4Subject: [PATCH 5/7] cluster/afr: Fix dict-leak in pre-op
5
6At the time of pre-op, pre_op_xdata is populted with the xattrs we get from the
7disk and at the time of post-op it gets over-written without unreffing the
8previous value stored leading to a leak.
9This is a regression we missed in
10https://review.gluster.org/#/q/ba149bac92d169ae2256dbc75202dc9e5d06538e
11
12BUG: 1550078
13Change-Id: I0456f9ad6f77ce6248b747964a037193af3a3da7
14Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
15
16Upstream-Status: Backport
17
18Fix CVE-2018-10924
19
20Modified for this old glusterfs version.
21
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23---
24 xlators/cluster/afr/src/afr-common.c | 14 +++++++-------
25 xlators/cluster/afr/src/afr-transaction.c | 20 ++++++++++----------
26 xlators/cluster/afr/src/afr.h | 4 ++--
27 3 files changed, 19 insertions(+), 19 deletions(-)
28
29diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
30index 0643204..85150a0 100644
31--- a/xlators/cluster/afr/src/afr-common.c
32+++ b/xlators/cluster/afr/src/afr-common.c
33@@ -1673,13 +1673,13 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this)
34 GF_FREE (local->transaction.pre_op);
35
36 GF_FREE (local->transaction.pre_op_sources);
37- if (local->transaction.pre_op_xdata) {
38+ if (local->transaction.changelog_xdata) {
39 for (i = 0; i < priv->child_count; i++) {
40- if (!local->transaction.pre_op_xdata[i])
41+ if (!local->transaction.changelog_xdata[i])
42 continue;
43- dict_unref (local->transaction.pre_op_xdata[i]);
44+ dict_unref (local->transaction.changelog_xdata[i]);
45 }
46- GF_FREE (local->transaction.pre_op_xdata);
47+ GF_FREE (local->transaction.changelog_xdata);
48 }
49
50 GF_FREE (local->transaction.eager_lock);
51@@ -5396,10 +5396,10 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
52 goto out;
53
54 if (priv->arbiter_count == 1) {
55- local->transaction.pre_op_xdata =
56- GF_CALLOC (sizeof (*local->transaction.pre_op_xdata),
57+ local->transaction.changelog_xdata =
58+ GF_CALLOC (sizeof (*local->transaction.changelog_xdata),
59 priv->child_count, gf_afr_mt_dict_t);
60- if (!local->transaction.pre_op_xdata)
61+ if (!local->transaction.changelog_xdata)
62 goto out;
63
64 local->transaction.pre_op_sources =
65diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
66index 35621d9..c9a4474 100644
67--- a/xlators/cluster/afr/src/afr-transaction.c
68+++ b/xlators/cluster/afr/src/afr-transaction.c
69@@ -276,9 +276,9 @@ afr_compute_pre_op_sources (call_frame_t *frame, xlator_t *this)
70 matrix = ALLOC_MATRIX (priv->child_count, int);
71
72 for (i = 0; i < priv->child_count; i++) {
73- if (!local->transaction.pre_op_xdata[i])
74+ if (!local->transaction.changelog_xdata[i])
75 continue;
76- xdata = local->transaction.pre_op_xdata[i];
77+ xdata = local->transaction.changelog_xdata[i];
78 afr_selfheal_fill_matrix (this, matrix, i, idx, xdata);
79 }
80
81@@ -295,13 +295,6 @@ afr_compute_pre_op_sources (call_frame_t *frame, xlator_t *this)
82 for (j = 0; j < priv->child_count; j++)
83 if (matrix[i][j] != 0)
84 local->transaction.pre_op_sources[j] = 0;
85-
86- /*We don't need the xattrs any more. */
87- for (i = 0; i < priv->child_count; i++)
88- if (local->transaction.pre_op_xdata[i]) {
89- dict_unref (local->transaction.pre_op_xdata[i]);
90- local->transaction.pre_op_xdata[i] = NULL;
91- }
92 }
93
94 gf_boolean_t
95@@ -1175,7 +1168,7 @@ afr_changelog_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
96
97 if (priv->arbiter_count == 1 && !op_ret) {
98 if (xattr)
99- local->transaction.pre_op_xdata[child_index] =
100+ local->transaction.changelog_xdata[child_index] =
101 dict_ref (xattr);
102 }
103
104@@ -1608,6 +1601,13 @@ afr_changelog_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
105 local = frame->local;
106 priv = this->private;
107
108+ for (i = 0; i < priv->child_count; i++) {
109+ if (local->transaction.changelog_xdata[i]) {
110+ dict_unref (local->transaction.changelog_xdata[i]);
111+ local->transaction.changelog_xdata[i] = NULL;
112+ }
113+ }
114+
115 ret = afr_changelog_prepare (this, frame, &call_count, changelog_resume,
116 op, &xdata, &newloc_xdata);
117
118diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
119index cf736ed..2854153 100644
120--- a/xlators/cluster/afr/src/afr.h
121+++ b/xlators/cluster/afr/src/afr.h
122@@ -737,8 +737,8 @@ typedef struct _afr_local {
123
124 unsigned char *pre_op;
125
126- /* For arbiter configuration only. */
127- dict_t **pre_op_xdata;
128+ /* Changelog xattr dict for [f]xattrop*/
129+ dict_t **changelog_xdata;
130 unsigned char *pre_op_sources;
131
132 /* @failed_subvols: subvolumes on which a pre-op or a
133--
1342.7.4
135
diff --git a/recipes-extended/glusterfs/glusterfs.inc b/recipes-extended/glusterfs/glusterfs.inc
index ce18fed..0ce2acd 100644
--- a/recipes-extended/glusterfs/glusterfs.inc
+++ b/recipes-extended/glusterfs/glusterfs.inc
@@ -27,6 +27,7 @@ SRC_URI += "file://glusterd.init \
27 file://0002-posix-disable-open-read-write-on-special-files.patch \ 27 file://0002-posix-disable-open-read-write-on-special-files.patch \
28 file://0003-server-protocol-don-t-allow-.-path-in-name.patch \ 28 file://0003-server-protocol-don-t-allow-.-path-in-name.patch \
29 file://0004-io-stats-dump-io-stats-info-in-var-run-gluster.patch \ 29 file://0004-io-stats-dump-io-stats-info-in-var-run-gluster.patch \
30 file://0005-cluster-afr-Fix-dict-leak-in-pre-op.patch \
30 " 31 "
31 32
32LICENSE = "(LGPLv3+ | GPLv2) & GPLv3+ & LGPLv3+ & GPLv2+ & LGPLv2+ & LGPLv2.1+ & Apache-2.0" 33LICENSE = "(LGPLv3+ | GPLv2) & GPLv3+ & LGPLv3+ & GPLv2+ & LGPLv2+ & LGPLv2.1+ & Apache-2.0"