hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Clampffer (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-9265) Use of undefined behavior in remote_block_reader causing deterministic crashes.
Date Mon, 19 Oct 2015 16:04:05 GMT
James Clampffer created HDFS-9265:
-------------------------------------

             Summary: Use of undefined behavior in remote_block_reader causing deterministic
crashes.
                 Key: HDFS-9265
                 URL: https://issues.apache.org/jira/browse/HDFS-9265
             Project: Hadoop HDFS
          Issue Type: Sub-task
            Reporter: James Clampffer
            Priority: Blocker


The remote block reader relies on undefined behavior in how it uses enable_shared_from_this.

http://en.cppreference.com/w/cpp/memory/enable_shared_from_this

The spec states a shared_ptr to an object inheriting from enable_shared_from_this must be
live before calling make_shared_from_this.  
Calling make_shared_from_this without an existing shared_ptr is undefined behavior and causes
deterministic crashes when the code is built with GCC.

example:
class foo : public enable_shared_from_this {/*bar*/};

safe:
auto ptr1 = std::make_shared<foo>();
auto ptr2 = foo->make_shared_from_this();

broken:
foo *ptr = new foo();
auto ptr2 = foo->make_shared_from_this(); //no existing live shared_ptr






--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message