Workaround ASan false positive in RouteController.
Bug: 27037723
Change-Id: I40e7f0d07652aeb6484de5f963a7698b6805d582
(cherry picked from commit dfde1d6c6c397e437adf937a1718784d9cb2c0cf)
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index b2cd93a..e4b7cc1 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -180,6 +180,15 @@
// |iov| is an array of struct iovec that contains the netlink message payload.
// The netlink header is generated by this function based on |action| and |flags|.
// Returns -errno if there was an error or if the kernel reported an error.
+
+// Disable optimizations in ASan build.
+// ASan reports an out-of-bounds 32-bit(!) access in the first loop of the
+// function (over iov[]).
+#ifdef __clang__
+#if __has_feature(address_sanitizer)
+__attribute__((optnone))
+#endif
+#endif
WARN_UNUSED_RESULT int sendNetlinkRequest(uint16_t action, uint16_t flags, iovec* iov, int iovlen) {
nlmsghdr nlmsg = {
.nlmsg_type = action,