/* * Copyright 2016 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Ask ASan to mark the memory range [ptr, ptr + element_size * num_elements) // as being unaddressable, so that reads and writes are not allowed. ASan may // narrow the range to the nearest alignment boundaries. staticinlinevoid rtc_AsanPoison(constvolatilevoid* ptr,
size_t element_size,
size_t num_elements) { #if RTC_HAS_ASAN
ASAN_POISON_MEMORY_REGION(ptr, element_size * num_elements); #else // This is to prevent from the compiler raising a warning/error over unused // variables. We cannot use clang's annotation (`[[maybe_unused]]`) because // this file is also included from c files which doesn't support the // annotation till we switch to C23
(void)ptr;
(void)element_size;
(void)num_elements; #endif
}
// Ask ASan to mark the memory range [ptr, ptr + element_size * num_elements) // as being addressable, so that reads and writes are allowed. ASan may widen // the range to the nearest alignment boundaries. staticinlinevoid rtc_AsanUnpoison(constvolatilevoid* ptr,
size_t element_size,
size_t num_elements) { #if RTC_HAS_ASAN
ASAN_UNPOISON_MEMORY_REGION(ptr, element_size * num_elements); #else
(void)ptr;
(void)element_size;
(void)num_elements; #endif
}
// Ask MSan to mark the memory range [ptr, ptr + element_size * num_elements) // as being uninitialized. staticinlinevoid rtc_MsanMarkUninitialized(constvolatilevoid* ptr,
size_t element_size,
size_t num_elements) { #if RTC_HAS_MSAN
__msan_poison(ptr, element_size * num_elements); #else
(void)ptr;
(void)element_size;
(void)num_elements; #endif
}
// Force an MSan check (if any bits in the memory range [ptr, ptr + // element_size * num_elements) are uninitialized the call will crash with an // MSan report). staticinlinevoid rtc_MsanCheckInitialized(constvolatilevoid* ptr,
size_t element_size,
size_t num_elements) { #if RTC_HAS_MSAN
__msan_check_mem_is_initialized(ptr, element_size * num_elements); #else
(void)ptr;
(void)element_size;
(void)num_elements; #endif
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.