Flutter Engine
The Flutter Engine
SkASAN.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkASAN_DEFINED
9#define SkASAN_DEFINED
10
11#include <cstddef>
12
13#ifdef __SANITIZE_ADDRESS__
14 #define SK_SANITIZE_ADDRESS 1
15#endif
16#if !defined(SK_SANITIZE_ADDRESS) && defined(__has_feature)
17 #if __has_feature(address_sanitizer)
18 #define SK_SANITIZE_ADDRESS 1
19 #endif
20#endif
21
22// Typically declared in LLVM's asan_interface.h.
23#ifdef SK_SANITIZE_ADDRESS
24extern "C" {
25 void __asan_poison_memory_region(void const volatile *addr, size_t size);
26 void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
27 int __asan_address_is_poisoned(void const volatile *addr);
28}
29#endif
30
31// Code that implements bespoke allocation arenas can poison the entire arena on creation, then
32// unpoison chunks of arena memory as they are parceled out. Consider leaving gaps between blocks
33// to detect buffer overrun.
34static inline void sk_asan_poison_memory_region([[maybe_unused]] void const volatile* addr,
35 [[maybe_unused]] size_t size) {
36#ifdef SK_SANITIZE_ADDRESS
37 __asan_poison_memory_region(addr, size);
38#endif
39}
40
41static inline void sk_asan_unpoison_memory_region([[maybe_unused]] void const volatile* addr,
42 [[maybe_unused]] size_t size) {
43#ifdef SK_SANITIZE_ADDRESS
44 __asan_unpoison_memory_region(addr, size);
45#endif
46}
47
48static inline int sk_asan_address_is_poisoned([[maybe_unused]] void const volatile* addr) {
49#ifdef SK_SANITIZE_ADDRESS
50 return __asan_address_is_poisoned(addr);
51#else
52 return 0;
53#endif
54}
55
56#endif // SkASAN_DEFINED
static void sk_asan_poison_memory_region(void const volatile *addr, size_t size)
Definition: SkASAN.h:34
static int sk_asan_address_is_poisoned(void const volatile *addr)
Definition: SkASAN.h:48
static void sk_asan_unpoison_memory_region(void const volatile *addr, size_t size)
Definition: SkASAN.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259