update_engine: fix heap-buffer-overflow
ASAN error happens depending on library ordering in compile flags (crbug/887845).
This change updates BUILD.gn so that correct library ordering is generated.
BUG=chromium:976843
TEST=setup_board --board=amd64-generic --profile=asan
TEST=./build_packages --board=amd64-generic update_engine
TEST=FEATURES=test emerge-amd64-generic update_engine # Some test fail, but they also fail without ASAN and this modification.
Change-Id: I40bb72f25e7012105eecac5c53d01662d68bf3d7
Reviewed-on: https://chromium-review.googlesource.com/1679810
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 9ff26e0..2d4e9a4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -396,8 +396,14 @@
"payload_generator/fake_filesystem.cc",
"update_manager/umtest_utils.cc",
]
- all_dependent_configs = [ "//common-mk:test" ]
- configs += [ ":target_defaults" ]
+
+ # TODO(crbug.com/887845): After library odering issue is fixed,
+ # //common-mk:test can be moved in all_dependent_configs and
+ # //common-mk:test in each test configs can be removed.
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ]
pkg_deps = [ "libshill-client-test" ]
deps = [
":libupdate_engine",
@@ -430,7 +436,12 @@
"common/http_common.cc",
"test_http_server.cc",
]
- configs += [ ":target_defaults" ]
+ # //common-mk:test should be on the top.
+ # TODO(crbug.com/887845): Remove this after library odering issue is fixed.
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ]
}
# Test subprocess helper.
@@ -438,7 +449,12 @@
sources = [
"test_subprocess.cc",
]
- configs += [ ":target_defaults" ]
+ # //common-mk:test should be on the top.
+ # TODO(crbug.com/887845): Remove this after library odering issue is fixed.
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ]
}
# Main unittest file.
@@ -525,7 +541,12 @@
"update_manager/variable_unittest.cc",
"update_manager/weekly_time_unittest.cc",
]
- configs += [ ":target_defaults" ]
+ # //common-mk:test should be on the top.
+ # TODO(crbug.com/887845): Remove this after library odering issue is fixed.
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ]
pkg_deps = [
"libbrillo-test-${libbase_ver}",
"libchrome-test-${libbase_ver}",