Commit db4e040d authored by Pranjal Raihan's avatar Pranjal Raihan Committed by Facebook GitHub Bot

Disable MSAN for MicroLock functions

Summary: Even though `folly::MicroLock` is 1 byte, `detail::Futex<>` (aka `std::atomic<uint32_t>`) operates on 4 bytes. So 3 bytes are accessed but not used in any way. So we need to disable memory sanitizer.

Reviewed By: andriigrynenko

Differential Revision: D26082888

fbshipit-source-id: fe585b60c96f48c02df69d182bd75a8eccde2a42
parent 6477caf1
......@@ -159,14 +159,14 @@ class MicroLockCore {
}
template <typename Func>
FOLLY_DISABLE_ADDRESS_SANITIZER void unlockAndStoreWithModifier(
Func modifier) noexcept;
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_MEMORY_SANITIZER void
unlockAndStoreWithModifier(Func modifier) noexcept;
public:
/**
* Loads the data stored in the unused bits of the lock atomically.
*/
FOLLY_DISABLE_ADDRESS_SANITIZER uint8_t
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_MEMORY_SANITIZER uint8_t
load(std::memory_order order = std::memory_order_seq_cst) const noexcept {
return decodeDataFromWord(word()->load(order));
}
......@@ -176,7 +176,7 @@ class MicroLockCore {
* used by the lock, the most significant 2 bits of the provided value will be
* ignored.
*/
FOLLY_DISABLE_ADDRESS_SANITIZER void store(
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_MEMORY_SANITIZER void store(
uint8_t value,
std::memory_order order = std::memory_order_seq_cst) noexcept;
......@@ -270,9 +270,11 @@ class MicroLockBase : public MicroLockCore {
* data, in which case reading and locking should be done in one atomic
* operation.
*/
FOLLY_DISABLE_ADDRESS_SANITIZER uint8_t lockAndLoad() noexcept;
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_MEMORY_SANITIZER uint8_t
lockAndLoad() noexcept;
void lock() noexcept { lockAndLoad(); }
FOLLY_DISABLE_ADDRESS_SANITIZER bool try_lock() noexcept;
FOLLY_DISABLE_ADDRESS_SANITIZER FOLLY_DISABLE_MEMORY_SANITIZER bool
try_lock() noexcept;
/**
* A lock guard which allows reading and writing to the unused bits of the
......
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