aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/sanitizer.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-06-09 17:20:16 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-06-21 17:13:05 +0000
commitd4721b2152b245558f5753a60d909b5b233af493 (patch)
tree231d65b1d95b5975bdd1723d6150079e41e77cff /src/vppinfra/sanitizer.c
parent3006289a07429730ff69c2585eed6d6075be3565 (diff)
vppinfra: asan: fix overflow support
In some part of VPP we are accessing memory past what was allocated for efficiency when we know it is safe to do so. We need to tell ASan about it so it does not complain. The initial attempt was too simple and could not manage cases where the poisoned memory was scattered. This new attempt is more robust as we save and restore the full shadow state. Note it will still not work properly if we poison/unpoison memory while in an overflow context, but this should not be a big issue as overflow should only be temporary. Type: fix Change-Id: I636f44eb59aa8455a4d13929a3791b56619af7b4 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vppinfra/sanitizer.c')
-rw-r--r--src/vppinfra/sanitizer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vppinfra/sanitizer.c b/src/vppinfra/sanitizer.c
new file mode 100644
index 00000000000..fab1cdca136
--- /dev/null
+++ b/src/vppinfra/sanitizer.c
@@ -0,0 +1,7 @@
+#ifdef CLIB_SANITIZE_ADDR
+
+#include <vppinfra/sanitizer.h>
+
+__clib_export clib_sanitizer_main_t sanitizer_main = { .shadow_scale = ~0 };
+
+#endif /* CLIB_SANITIZE_ADDR */