diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2015-04-21 11:48:15 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-21 23:15:41 -0700 |
commit | 765849ee00f6661c9059122ff2346b03b224745f (patch) | |
tree | 46fc5390e2ce98d1a328d499dd46e61f818d1643 | |
parent | f1bdc3f186576107fda4f3665c809c791b4cbe95 (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: 1212660
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/10319
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: NetBSD Build System
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>
-rw-r--r-- | libglusterfs/src/logging.c | 13 |
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; } |