You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2018/07/26 20:13:36 UTC

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Hello Adar Dembo,

I'd like you to do a code review. Please visit

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

to review the following change.


Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................

KUDU-2509 fix use-after-free in case of WAL replay error

Fixed use-after-free mistake in case of a failure to apply a pending
commit message from the WAL while bootstrapping a tablet.

Also, a repro scenario to expose the use-after-free condition is added.
Prior to the fix, the repro scenario would crash with SIGSEGV on Linux
or with SIGBUS on OS X (at least for DEBUG builds).

Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Reviewed-on: http://gerrit.cloudera.org:8080/10997
Tested-by: Alexey Serbin <as...@cloudera.com>
Reviewed-by: Adar Dembo <ad...@cloudera.com>
(cherry picked from commit 6b429e8a42ad9fb12a97cc26e33ca19ac2626533)
---
M src/kudu/tablet/tablet_bootstrap-test.cc
M src/kudu/tablet/tablet_bootstrap.cc
2 files changed, 74 insertions(+), 3 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: newchange
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................


Patch Set 1: Code-Review+2

No conflicts, right?


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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 23:41:26 +0000
Gerrit-HasComments: No

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has posted comments on this change. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc
File src/kudu/tablet/tablet_bootstrap.cc:

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc@985
PS1, Line 985: RETURN_NOT_OK
Won't this leak on error applying the commit? In that case shouldn't we use something like a SCOPED_CLEANUP for this to apply this delete as we exit the scope?



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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 23:22:31 +0000
Gerrit-HasComments: Yes

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................


Patch Set 1:

> (1 comment)

Right: there are no textual nor logical conflicts with this cherry-pick.  The good thing is that the patch is simple and localized.

I would leave corresponding conflicts list in the commit message if there were any.


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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 23:43:49 +0000
Gerrit-HasComments: No

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................

KUDU-2509 fix use-after-free in case of WAL replay error

Fixed use-after-free mistake in case of a failure to apply a pending
commit message from the WAL while bootstrapping a tablet.

Also, a repro scenario to expose the use-after-free condition is added.
Prior to the fix, the repro scenario would crash with SIGSEGV on Linux
or with SIGBUS on OS X (at least for DEBUG builds).

Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Reviewed-on: http://gerrit.cloudera.org:8080/10997
Tested-by: Alexey Serbin <as...@cloudera.com>
Reviewed-by: Adar Dembo <ad...@cloudera.com>
(cherry picked from commit 6b429e8a42ad9fb12a97cc26e33ca19ac2626533)
Reviewed-on: http://gerrit.cloudera.org:8080/11063
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>
---
M src/kudu/tablet/tablet_bootstrap-test.cc
M src/kudu/tablet/tablet_bootstrap.cc
2 files changed, 74 insertions(+), 3 deletions(-)

Approvals:
  Kudu Jenkins: Verified
  Mike Percy: Looks good to me, but someone else must approve
  Adar Dembo: Looks good to me, approved

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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: merged
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc
File src/kudu/tablet/tablet_bootstrap.cc:

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc@985
PS1, Line 985: RETURN_NOT_OK
> Won't this leak on error applying the commit? In that case shouldn't we use
No, it will not leak -- the upper-level code in TabletBootstrap::PlaySegments() takes care of that.  Also, that if that was the case that would be caught in ASAN build while running the BootstrapTest.TestKudu2509 test scenario.

Just FYI: in the main trunk there was an additional clean-up changelist that makes the passing of the ownership of the entry more robust.



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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 23:30:27 +0000
Gerrit-HasComments: Yes

[kudu-CR](branch-1.7.x) KUDU-2509 fix use-after-free in case of WAL replay error

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has posted comments on this change. ( http://gerrit.cloudera.org:8080/11063 )

Change subject: KUDU-2509 fix use-after-free in case of WAL replay error
......................................................................


Patch Set 1: Code-Review+1

(1 comment)

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc
File src/kudu/tablet/tablet_bootstrap.cc:

http://gerrit.cloudera.org:8080/#/c/11063/1/src/kudu/tablet/tablet_bootstrap.cc@985
PS1, Line 985: RETURN_NOT_OK
> No, it will not leak -- the upper-level code in TabletBootstrap::PlaySegmen
OK I'll just let Adar review the backport since he has the context on the trunk change also



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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11373b1cc34d9e2e0181bee2d3841b49022218ed
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 23:38:12 +0000
Gerrit-HasComments: Yes