summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2015-04-21 11:48:15 -0400
committerVijay Bellur <vbellur@redhat.com>2015-04-22 06:18:09 -0700
commit24422a6f1599597b3a378fa2ff392aa40f5a33f5 (patch)
tree0ef2024cbaf8ea6a7663a03e3b64856be7e189b9 /libglusterfs
parent11a179331ef428906a843b59c69c97f621446f9e (diff)
core: avoid crashes in gf_msg dup-detection code
Use global_xlator for allocations so that we don't try to free objects belonging to an already-deleted translator (which will crash). Change-Id: Ie72a546e7770cf5cb8a8370e22448c8d09e3ab37 BUG: 1214220 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/10319 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/10330 Tested-by: NetBSD Build System
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/logging.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 3b0c1e8244c..774dd092660 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -296,6 +296,18 @@ log_buf_init (log_buf_t *buf, const char *domain, const char *file,
int errnum, uint64_t msgid, char **appmsgstr, int graph_id)
{
int ret = -1;
+ xlator_t *old_THIS;
+ extern xlator_t global_xlator;
+
+ /*
+ * The current translator will be put in the block header for any
+ * memory block we allocate here. Unfortunately, these objects might
+ * outlive the current translator, and if we then try to dereference
+ * that pointer we go BOOM. Since this is really a global structure,
+ * use the global translator.
+ */
+ old_THIS = THIS;
+ THIS = &global_xlator;
if (!buf || !domain || !file || !function || !appmsgstr || !*appmsgstr)
goto out;
@@ -326,6 +338,7 @@ log_buf_init (log_buf_t *buf, const char *domain, const char *file,
ret = 0;
out:
+ THIS = old_THIS;
return ret;
}