Commit e2e4c525 authored by Sergey Doroshenko's avatar Sergey Doroshenko Committed by Praveen Kumar Ramakrishnan

Move FOLLY_DISABLE_ADDRESS_SANITIZER from Fiber::init()'s definition to declaration

Summary:
I just had topaggr built from trunk crash with https://phabricator.fb.com/P19825084. It seems that
placing `FOLLY_DISABLE_ADDRESS_SANITIZER` next to the function definition has no effect. Though
what's strange, https://phabricator.fb.com/D2036280 test plan says the false-positive crashes
stopped after that diff. Have we run the tao script on the latest revisions of that diff? Anyway,
clang/gcc docs clearly say the attributes belong to declarations, not definitions, so let's do that.

Test Plan:
Compiled, unit tests.

Reviewed By: aap@fb.com

Subscribers: folly-diffs@, yfeldblum, chalfant, soren

FB internal diff: D2042149

Signature: t1:2042149:1430681824:aea21b9a1fcddfd5585180ba7f526c3a6ee0c8bf
parent 589052a6
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <cstring> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <folly/CPortability.h>
#include <folly/Likely.h> #include <folly/Likely.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/experimental/fibers/BoostContextCompatibility.h> #include <folly/experimental/fibers/BoostContextCompatibility.h>
...@@ -78,8 +77,6 @@ Fiber::Fiber(FiberManager& fiberManager) : ...@@ -78,8 +77,6 @@ Fiber::Fiber(FiberManager& fiberManager) :
fcontext_ = makeContext(limit, size, &Fiber::fiberFuncHelper); fcontext_ = makeContext(limit, size, &Fiber::fiberFuncHelper);
} }
// It is necessary to disable ASAN because this function changes fiber's stack.
FOLLY_DISABLE_ADDRESS_SANITIZER
void Fiber::init(bool recordStackUsed) { void Fiber::init(bool recordStackUsed) {
recordStackUsed_ = recordStackUsed; recordStackUsed_ = recordStackUsed;
if (UNLIKELY(recordStackUsed_ && !stackFilledWithMagic_)) { if (UNLIKELY(recordStackUsed_ && !stackFilledWithMagic_)) {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <boost/context/all.hpp> #include <boost/context/all.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#include <folly/AtomicLinkedList.h> #include <folly/AtomicLinkedList.h>
#include <folly/CPortability.h>
#include <folly/IntrusiveList.h> #include <folly/IntrusiveList.h>
#include <folly/experimental/fibers/BoostContextCompatibility.h> #include <folly/experimental/fibers/BoostContextCompatibility.h>
...@@ -69,7 +70,9 @@ class Fiber { ...@@ -69,7 +70,9 @@ class Fiber {
friend class FiberManager; friend class FiberManager;
explicit Fiber(FiberManager& fiberManager); explicit Fiber(FiberManager& fiberManager);
void init(bool recordStackUsed);
// It is necessary to disable ASAN because init() changes the fiber's stack.
void init(bool recordStackUsed) FOLLY_DISABLE_ADDRESS_SANITIZER;
template <typename F> template <typename F>
void setFunction(F&& func); void setFunction(F&& func);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment