You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Sailesh Mukil (Code Review)" <ge...@cloudera.org> on 2016/10/21 20:55:16 UTC

[kudu-CR] KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure

Sailesh Mukil has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/4782

Change subject: KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure
......................................................................

KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure

We may end up with a use-after-free or a deadlock depending on a
destruction order race, on a Messenger::Init() failure during a
MessengerBuilder::Build().

The main reason for this is because previously a gscoped_ptr and a
shared_ptr pointed to the same object, causing the destructor to be
called on the same object twice on destruction.

This patch does away with the gscoped_ptr and uses a raw pointer in
MessengerBuilder::Build() instead, where we don't explicitly free the
raw pointer since it will be freed when 'retain_self_' is reset()
anyway.

A more detailed explanation is given in the JIRA.

Change-Id: If48c8481c4bf2255f40ddd38460c1ba40c1b0faa
---
M src/kudu/rpc/messenger.cc
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/82/4782/1
-- 
To view, visit http://gerrit.cloudera.org:8080/4782
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If48c8481c4bf2255f40ddd38460c1ba40c1b0faa
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>

[kudu-CR] KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure
......................................................................


Patch Set 1: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/4782
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If48c8481c4bf2255f40ddd38460c1ba40c1b0faa
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.

Change subject: KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure
......................................................................


KUDU-1719: Heap use-after-free and deadlock on Messenger::Init() failure

We may end up with a use-after-free or a deadlock depending on a
destruction order race, on a Messenger::Init() failure during a
MessengerBuilder::Build().

The main reason for this is because previously a gscoped_ptr and a
shared_ptr pointed to the same object, causing the destructor to be
called on the same object twice on destruction.

This patch does away with the gscoped_ptr and uses a raw pointer in
MessengerBuilder::Build() instead, where we don't explicitly free the
raw pointer since it will be freed when 'retain_self_' is reset()
anyway.

A more detailed explanation is given in the JIRA.

Change-Id: If48c8481c4bf2255f40ddd38460c1ba40c1b0faa
Reviewed-on: http://gerrit.cloudera.org:8080/4782
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
---
M src/kudu/rpc/messenger.cc
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/4782
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If48c8481c4bf2255f40ddd38460c1ba40c1b0faa
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>