1#
2# Copyright (c) 2019, Google, Inc. All rights reserved
3#
4# Permission is hereby granted, free of charge, to any person obtaining
5# a copy of this software and associated documentation files
6# (the "Software"), to deal in the Software without restriction,
7# including without limitation the rights to use, copy, modify, merge,
8# publish, distribute, sublicense, and/or sell copies of the Software,
9# and to permit persons to whom the Software is furnished to do so,
10# subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be
13# included in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22#
23
24# Entries in this section disable sanitizers listed in enable.mk.
25[alignment|bool|builtin|bounds|enum|float-cast-overflow|float-divide-by-zero|implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change|integer-divide-by-zero|pointer-overflow|return|shift|signed-integer-overflow|unreachable|unsigned-integer-overflow|vla-bound]
26
27# dlmalloc is fragile enough that it isn't worth the risk to try to make it
28# UBSan clean
29src:*/dlmalloc.c
30
31# Fixing errors in boringssl is more likely to cause problems than fix them
32src:external/boringssl/*
33
34# ocb.c implements pseudo-bignum math, and so plays fast and loose with signs
35# We would either need to annotate many of the functions in here, or rewrite
36# it dangerously to avoid this exemption.
37src:*/system/keymaster/key_blob_utils/ocb.c
38
39# test-runner is missing important facilities for error reporting (e.g. printf)
40# and is not a actual product, just testing infrastructure.
41src:external/trusty/bootloader/*
42
43# If we are inside Musl's ldso or crt components, we're too early in process
44# start for a lot of information to be correct, and our error reporting
45# facilities won't work yet.
46src:external/trusty/musl/crt/*
47src:external/trusty/musl/ldso/*
48
49# Musl is fond of negating unsigned integers to round values up.
50# There are also a few not-quite-buggy unsigned overflows and signed constants
51# being coerced to unsigned values.
52[unsigned-integer-overflow|implicit-integer-sign-change]
53src:external/trusty/musl/src/*
54
55# Signature of memset is void* memset(void *s, int c, size_t n);
56# i.e. it has to convert its second argument to a 8-bit type, which can result
57# in a truncation.
58[implicit-signed-integer-truncation]
59src:external/trusty/musl/src/string/memset.c
60
61# Allow unsigned overflow in keymaster until keymaster's checks are reworked.
62# The cases we know can overflow *are* overflow checks.
63[unsigned-integer-overflow|pointer-overflow]
64src:*/system/keymaster/android_keymaster/authorization_set.cpp
65src:*/system/keymaster/android_keymaster/serializable.cpp
66
67# Exempt libfreetype from overflow sanitization.
68[unsigned-integer-overflow|implicit-integer-sign-change|pointer-overflow|cfi]
69src:*/external/freetype/*
70
71# Exempt libfdt from implicit integer sign changes
72[implicit-integer-sign-change]
73src:external/dtc/libfdt/*
74
75# Exempt some libbinder functions from CFI because they make indirect
76# calls from C++ into Rust and the latter does not support CFI.
77# TODO(b/181755948): Remove these lines when that changes.
78[cfi-icall]
79# This is the file path as seen by clang
80src:frameworks/native/libs/binder/trusty/binder_rpc_unstable/../../libbinder_rpc_unstable.cpp
81src:frameworks/native/libs/binder/ndk/ibinder.cpp
82src:frameworks/native/libs/binder/ndk/parcel.cpp
83src:frameworks/native/libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp
84