Alexey Serbin has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/18510 )
Change subject: [client] prohibit copying/assigning of ResourceMetrics
......................................................................
[client] prohibit copying/assigning of ResourceMetrics
Since ResourceMetrics contains a raw pointer, it makes it dangerous
since its auto-generated copy constructor and assignment operator
are not private. Somebody could write something like
{
KuduScanner scanner();
{
ResouceMetrics m = session->GetResourceMetrics();
...
}
// Continue scanning activity with the 'scanner'.
...
}
or
{
KuduSession session(...);
{
ResouceMetrics m = session->GetWriteOpMetrics();
...
}
// Continue writing activity with the 'session'.
...
}
and hit a silent memory corruption issue since that's the use-after-free
condition for the KuduScanner and KuduSession instances when the data
behind the raw pointer in ResourceMetrics::data_ is accessed later on.
This patch breaks the ABI compatibility for the kudu_client C++ library,
but this would surface only if there is a dangerous code like above
in the Kudu application linked with the library. It's much worse having
such a hidden memory corruption issue in an application than hitting
a build breakage due to a linkage error which is quite simple to fix.
This is a follow-up to ece7b5653998db318e4baa5d57f27ba3a836731d.
Change-Id: I602cc4e194a975752687d13d525e44043955a5cf
Reviewed-on: http://gerrit.cloudera.org:8080/18510
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Riza Suminto <[email protected]>
Reviewed-by: Attila Bukor <[email protected]>
---
M src/kudu/client/resource_metrics.h
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Alexey Serbin: Verified
Riza Suminto: Looks good to me, but someone else must approve
Attila Bukor: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/18510
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I602cc4e194a975752687d13d525e44043955a5cf
Gerrit-Change-Number: 18510
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Attila Bukor <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Reviewer: Tidy Bot (241)