folly/.../ExceptionTracerLib.cpp: provide less DOF fodder (avoid heap use-after-free)
authorJim Meyering <meyering@fb.com>
Thu, 15 Sep 2016 23:26:34 +0000 (16:26 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Thu, 15 Sep 2016 23:38:28 +0000 (16:38 -0700)
commit101b2ad7538bc1a5417b54cf5713d403f9a2eefa
treeb9a864b855e02156cc9fbb0a068eb52c50df73a7
parent6848287d30fcbb18bb277ea85001e8864e28ea9e
folly/.../ExceptionTracerLib.cpp: provide less DOF fodder (avoid heap use-after-free)

Summary:
Before this change, an application would fail consistently with a shutdown-time heap use-after-free (i.e., destructor-order-fiasco when one of the following symbols was used after its static-destruction-triggered free):

  DECLARE_CALLBACK(CxaThrow);
  DECLARE_CALLBACK(CxaBeginCatch);
  DECLARE_CALLBACK(CxaRethrow);
  DECLARE_CALLBACK(CxaEndCatch);
  DECLARE_CALLBACK(RethrowException);

Each of those would define a classic meyers singleton.
Since each destructor is trivial, we can fix this by making each a pseudo-leaky (indestructible) meyers singleton instead. Since each static value is never destroyed,
it can never cause a DOF error again.

Differential Revision: D3870740

fbshipit-source-id: 625f5d5268768ca0e4125bed72bc66c53618be29
folly/experimental/exception_tracer/ExceptionTracerLib.cpp