aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-08-22Create a symlink for each header fileKelvin Zhang
When marking libzucchini as recovery_available, build system tries to glob all header files in exported include dir. This fails because the symlink points to a parent directory, which also contains the symlink itself. Therefore the glob fails due to infinite recursion. Test: th Bug: 194237829 Change-Id: I49eb64b2c31f3446f17db6139803f81e2a39148b
2021-08-20Link liblog/libbase staticallyKelvin Zhang
zucchini might need to run on host w/o android repo(for testing purposes). Therefore statically link the binary. Test: th Change-Id: Ic3847cbf4694418fa43270580596bf7d5cc70f8e
2021-08-19Compile zucchini binaryKelvin Zhang
Test: th Change-Id: I43210076c7db6df175ba29b128657552e0cff286
2021-08-19Get zucchini to compile w/o code transformation hackKelvin Zhang
Test: th Change-Id: I9b2beec4ee34d1ba23c1af24dec3f4b9169d6bd4
2021-08-17Get zucchini to compile on AOSPKelvin Zhang
Test: mm Change-Id: Ia030273fcc71d0920f2c62327a08903e5e27a544
2021-08-17Add necessary metadata filesKelvin Zhang
Change-Id: I10d1bd2f4e598f39ca459893677f88413db05c7d
2021-08-17Merge remote-tracking branch 'remotes/aosp/upstream-main' into cleanTianjie
Test: N/A Change-Id: I79a86dd69be09f84d5c5d58298916454a572d3d6
2021-08-13[Zucchini] Replace DISALLOW_* macros with =delete versions.Samuel Huang
This CL replaces * 30 instances of DISALLOW_COPY_AND_ASSIGN(Foo), * 1 instance of DISALLOW_IMPLICIT_CONSTRUCTORS(Foo), in Zucchini with: Foo() = delete; // DISALLOW_IMPLICIT_CONSTRUCTORS only. Foo(const Foo&) = delete; const Foo& operator=(const Foo&) = delete; All base/macros.h includes are removed. Bug: 1010217 Change-Id: I13b3d5ed04f04e5c0b209d59e70ac018c5f4938c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3093198 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#911751} NOKEYCHECK=True GitOrigin-RevId: ba0e1f56993c535faa59e2ca02c371bae2ebbb20
2021-08-09Initial empty repositoryInna Palant
2021-08-05[Zucchini] Add ARM support for ELF files.Samuel Huang
This CL enables ARM-ELF (AArch32 and AArch64) support in Zucchini. * Define ARM {AArch32, AArch64}ReferenceType. * Add Rel32Finder{Arm, AArch32, AArch64} (with tests) to use previously-added ARM disassembly code to extract rel32 references. * Add DisassemblerElf{Arm, AArch32, AArch64} to parse ARM ELF files and create reference readers / writers, and reference groups. * For AArch32: Add heuristic detection of ARM vs. Thumb2 mode. * Add IsTargetOffsetInElfSectionList() (with tests) to help ARM reject false positive references. * Add ReferenceBytesMixerElfArm to remove redundant reference target information from bytewise correction data. Bug: 918867 Change-Id: I1e6d3d8b8d174c85a3d44ca6d642b7ff0bd6a6a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2922822 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#908913} NOKEYCHECK=True GitOrigin-RevId: 85cc8a596f183487b395a59e80b2f654f241ab2c
2021-08-03[Zucchini] Disassemblers: Fix abs32 width for ELF; cleanup Traits template ↵Samuel Huang
param. Previously DisassemblerElfIntel<TRAITS>::ParseExecSection() passes a hard-coded 4 to Abs32GapFinder's |abs32_width| CTOR param. This is wrong for X64, which has abs32 pointer width of 8 bytes. This can lead to lower quality rel32 extraction. This CL fixes the above by replacing 4 with Traits::kVAWidth, and also cleans up TRAITS / Traits template parameter for Disassembler: * For template param, "template <class TRAITS>" is used throughout. * This means function params needs to use TRAITS. * For usage, each Disassembler class with TRAITS declares using Traits = TRAITS; (and variant) and uses Traits in the body of all functions. Reason: Specialized derive classes won't have TRAITS available , so: * Function params can use DisassemblerBase::Traits. * Function bodies can use Traits. * For consistency, even if TRAITS is available, still use Traits. Bug: 1233831 Change-Id: Ie796c867fb238eca462b2fb6b4e68a965996c25a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3063919 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#908261} NOKEYCHECK=True GitOrigin-RevId: 294860c47cd3678c46422ce57da366724e1dc629
2021-07-29Fix some instances of -Wdeprecated-copy: components/Peter Kasting
Bug: 1213098 Change-Id: Ib769095b1d2cd110f8d458bc95a62afecc070cce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3056862 Auto-Submit: Peter Kasting <pkasting@chromium.org> Commit-Queue: Cait Phillips <caitkp@chromium.org> Reviewed-by: Cait Phillips <caitkp@chromium.org> Cr-Commit-Position: refs/heads/master@{#906817} NOKEYCHECK=True GitOrigin-RevId: f1dcb7053e7f86ce4821f71fc9da98ce59d37035
2021-07-28[automated] Drop needless <vector> includes in /components/zucchiniVictor Hugo Vianna Silva
This is among the most costful includes for the Chromium build. https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html This batch of CLs attempts to detect and remove leftover includes with a heuristic: choose files which don't contain 'std::vector' or 'push_back'. This doesn't really guarantee that std::vector is not being used, as shown by the snippets below, so please review carefully. ``` auto v = GetVector(); MyVectorAlias v = GetVector(); my_vector_ = GetVector(); ``` This CL was uploaded by git cl split. R=etiennep@chromium.org Bug: 1233968 Change-Id: I4f84f26bfdf81c3997cc939c3d8a692e17ddde9a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3059580 Auto-Submit: Victor Vianna <victorvianna@google.com> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#906383} NOKEYCHECK=True GitOrigin-RevId: 9057c66a34aedd20d4eced2562f80c8e50e8771e
2021-07-25[Zucchini] Cleanup before adding ARM support for ELF files.Samuel Huang
This CL performs some code cleanup to prepare for main CL that adds ARM support for ELF files (https://crrev.com/c/2922822): * Rename ARM32 / Arm32 to AArch32. * Replace DISALLOW_COPY_AND_ASSIGN for affected files. Bug: 918867 Change-Id: I0e96b66fb29e9d1a35f9d7fac65755fbeda4831f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3044420 Commit-Queue: Samuel Huang <huangs@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#904357} NOKEYCHECK=True GitOrigin-RevId: 33679d241940ef6221b68d3e5daef606d7dd767d
2021-07-25Remove unneeded includes of optional.h from headers.Lei Zhang
Headers that do not reference absl::optional do not need to include third_party/abseil-cpp/absl/types/optional.h. Bug: 1227131 Change-Id: Ibe634116da4a61260936be5b624fb1b9895505cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3036368 Reviewed-by: Nico Weber <thakis@chromium.org> Owners-Override: Nico Weber <thakis@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#903283} NOKEYCHECK=True GitOrigin-RevId: 4f52073ed256dfeffdaca25c90dcc4c2145d78a1
2021-07-25More IWYU fixes in advance of removing #includesPeter Kasting
Bug: 242216 Change-Id: I4ef4609a62af06cf5e0bc519e761d8c87579bf2f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3014801 Commit-Queue: Peter Kasting <pkasting@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Auto-Submit: Peter Kasting <pkasting@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Owners-Override: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#899554} NOKEYCHECK=True GitOrigin-RevId: f2279caeb3f716287cddf465d9ee9ecf52853de9
2021-07-25Revert "Remove some unnecessary #includes."Findit
This reverts commit e91c91c3e6471923fd83dbce0a44f7317f07393c. Reason for revert: Note: It is reported that sheriffs cannot submit CL created by Findit (crbug.com/1187426). A workaround in the mean time is to abandon this CL and create another revert CL. Findit (https://goo.gl/kROfz5) identified CL at revision 898977 as the culprit for failures in the build cycles as shown on: https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2U5MWM5MWMzZTY0NzE5MjNmZDgzZGJjZTBhNDRmNzMxN2YwNzM5M2MM Sample Failed Build: https://ci.chromium.org/b/8842407444966732864 Sample Failed Step: compile Original change's description: > Remove some unnecessary #includes. > > According to > https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html > these were responsible for 1,460,113,428 bytes of input to the compiler, > or roughly 0.58% of the input used to build Chrome. > > Bug: 242216 > Change-Id: I1dd0a5fd3fcceb2da9bcf3dbae40e18590faf145 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009975 > Auto-Submit: Peter Kasting <pkasting@chromium.org> > Reviewed-by: danakj <danakj@chromium.org> > Owners-Override: danakj <danakj@chromium.org> > Commit-Queue: Peter Kasting <pkasting@chromium.org> > Cr-Commit-Position: refs/heads/master@{#898977} Change-Id: I54080e564838f77ce45de045f1487a6695f46647 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 242216 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3010718 Reviewed-by: Maggie Cai <mxcai@chromium.org> Owners-Override: Maggie Cai <mxcai@chromium.org> Commit-Queue: Maggie Cai <mxcai@chromium.org> Cr-Commit-Position: refs/heads/master@{#898979} NOKEYCHECK=True GitOrigin-RevId: 53dea79d16778f8fc1bfe54ac8f450e5dc146dac
2021-07-25Remove some unnecessary #includes.Peter Kasting
According to https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html these were responsible for 1,460,113,428 bytes of input to the compiler, or roughly 0.58% of the input used to build Chrome. Bug: 242216 Change-Id: I1dd0a5fd3fcceb2da9bcf3dbae40e18590faf145 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009975 Auto-Submit: Peter Kasting <pkasting@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Owners-Override: danakj <danakj@chromium.org> Commit-Queue: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#898977} NOKEYCHECK=True GitOrigin-RevId: e91c91c3e6471923fd83dbce0a44f7317f07393c
2021-07-25Swap from base/stl_util.h to cxx20_erase.h in components/.Lei Zhang
base::Erase() and base::EraseIf() have been moved to base/containers/cxx20_erase.h, so .cc files that use these functions, but no other function from base/stl_util.h, can directly include cxx20_erase.h and not stl_util.h. Bug: 1211125 Change-Id: Ia8f213f1136ac4c5278cd096b1270002884b556d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2994779 Reviewed-by: Colin Blundell <blundell@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#897400} NOKEYCHECK=True GitOrigin-RevId: a6fa14833a6d44c3a3171696f5dbd229d6fdf006
2021-07-25Fix -Wc++11-narrowing: /components/zucchiniPeter Kasting
This CL was uploaded by git cl split. R=wfh@chromium.org Bug: 1216696 Change-Id: I78d558e20d5e4056b4470ff6a9b9395f72a61631 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2975779 Auto-Submit: Peter Kasting <pkasting@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Commit-Queue: Will Harris <wfh@chromium.org> Cr-Commit-Position: refs/heads/master@{#894795} NOKEYCHECK=True GitOrigin-RevId: 3a9b13d917c7dc2de170fdbd22fa19ac376daa8d
2021-07-25Add explicit type conversions where necessary: components/Peter Kasting
These are cases that are implicitly narrowing today, and must do so explicitly in order to enable -Wc++11-narrowing. No behavior change intended. Bug: 1216696 Change-Id: Ic8f194bb0ab9a247d3e84cc59a687285cdb96d48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2947886 Auto-Submit: Peter Kasting <pkasting@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#890878} NOKEYCHECK=True GitOrigin-RevId: 379c52be13901beae4f773fe9e8054ad42a186c4
2021-07-25[Zucchini] Simplify Abs32GapFinder and Rel32Finder.Samuel Huang
Previously, using Abs32GapFinder / Rel32Finder to visit gaps / rel32 references involves calling a getter that returns an optional<> value whose emptiness indicates end of iteration. The code to use this looks like: for (auto value = finder.GetNext(); value; value = finder.GetNext()) { ... } This CL abandons optional<> usage and caches the results in Finders, thereby removing repetition in iteration code: while (finder.FindNext() { auto value = finder.GetValue(); ... } Additional changes: * Incorporate AddressTranslator into Rel32Finder to offload translation work from callers. * Add tests to integrate Abs32GapFinder with Rel32Finder. * Stylize test data to better show overlap between abs32 references with disassembled test data. Bug: 918867 Change-Id: Id044b67550f81c3f46ab383c5b6200906f56ca4e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2918113 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#888049} NOKEYCHECK=True GitOrigin-RevId: 89023e1c511e599e6aeaf0b8d80e3efa2e730b5b
2021-07-25Swap from base/stl_util.h to cxx17_backports.h in components/ .cc files.Lei Zhang
base::size() has been moved to base/cxx17_backports.h, so .cc files that use base::size(), but no other function from base/stl_util.h, can directly include base/cxx17_backports.h and not base/stl_util.h. Bug: 1210983 Change-Id: I445378492ab1193ea76ca0c0b9958e9cb9c4ca0f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2915464 Reviewed-by: Colin Blundell <blundell@chromium.org> Reviewed-by: Greg Kerr <kerrnel@chromium.org> Commit-Queue: Greg Kerr <kerrnel@chromium.org> Auto-Submit: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#886365} NOKEYCHECK=True GitOrigin-RevId: d073f65fc063f417cfabba9d5f5fbe4632320e05
2021-07-25build: Convert components/zucchini/fuzzers/BUILD.gn to py3Nico Weber
Bug: 1205597 Change-Id: I19c9513db7587d843a4cc8edc9b7267992f65a2c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897540 Auto-Submit: Nico Weber <thakis@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#883586} NOKEYCHECK=True GitOrigin-RevId: 27cc62076c62d78f6d67edaa93453aebd667d130
2021-07-25components: Replace base::Optional and friends with absl counterpartsAnton Bikineev
This replaces: - base::Optional -> absl::optional - include "base/optional.h" -> include "third_party/abseil-cpp/absl/types/optional.h" - base::nullopt -> absl::nullopt - base::make_optional -> absl::make_optional Bug: 1202909 Change-Id: If697b7bf69b199c1796f873eedca3359cdb48c64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897151 Commit-Queue: Anton Bikineev <bikineev@chromium.org> Owners-Override: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#883296} NOKEYCHECK=True GitOrigin-RevId: 1156b5f891de178171e71b9221a96bef1ced3d3b
2021-07-25Remove unneeded base/files/file_path.h includes in headers.Lei Zhang
Headers that do not reference base::FilePath do not need to include base/files/file_path.h. This reduces the amount of data necessary to build the chrome target by 175 MB. Bug: 242216 Change-Id: I7abd8d9fc1862a2dca11292719ab5b9146ab04d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2878909 Reviewed-by: Peter Boström <pbos@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Owners-Override: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#880501} NOKEYCHECK=True GitOrigin-RevId: 12341b14c8ec39ae08af60a9d40cfeb0b9e748db
2021-07-25Delete unused STL includes from components/ headers.Lei Zhang
Headers that do not contain "std::" do not need STL includes. This CL is mechanically generated as follows: INCL="algorithm|array|list|map|memory|queue|set|string|utility|vector" git ls-files components | grep '\.h$' | xargs grep -L std:: | \ xargs grep -El "#include <($INCL)>$" > to_process.txt INCL_ESCAPED="$(echo $INCL|sed 's/|/\\|/g')" cat to_process.txt | xargs sed -i "/^#include <\($INCL_ESCAPED\)>$/d" cat to_process.txt | xargs sed -i '/^$/N;/^\n$/D' Bug: 1200833 Change-Id: I3dd65ac6d5b7d2542df285d752af0bd7a9bd965d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2845086 Reviewed-by: Colin Blundell <blundell@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#877818} NOKEYCHECK=True GitOrigin-RevId: 0bf0ff5b03feb5f59c0dddefdb18ac1a9f764aef
2021-07-25Remove unneeded base/strings/stringprintf.h includes.Lei Zhang
List of files to delete from generated using the following command: git grep -l base/strings/stringprintf.h | \ xargs grep -L 'StringPrint[fV]' | xargs grep -L StringAppend | \ grep -E '(cc|mm|h)$' Change-Id: Ibc72245f08730b4d25283e2d966235b61513c7ae Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2849392 Reviewed-by: Peter Boström <pbos@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Owners-Override: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#876365} NOKEYCHECK=True GitOrigin-RevId: b49a213e324277a5539cc808e46cfa982502a81d
2021-07-25[zucchini] Use deque to store rel32_locations.Etienne Pierre-doray
An optimization to reduce zucchini peak memory footprint. MakeReadRel32 bring peak memory unnecessarily high due to std::vector allocation heuristic, along with shrink_to_fit which temporarily forces additional allocation: in the order of 32MB+19MB while only 19MB was needed. deque puts less memory pressure than vector since it doesn't have contiguous requirement and shrink_to_fit can be done in-place. deque Zucchini.PeakPagefileUsage 738876 KiB Zucchini.PeakPagefileUsageChange 717436 KiB Zucchini.PeakWorkingSetSize 632284 KiB Zucchini.PeakWorkingSetSizeChange 623464 KiB Zucchini.TotalTime 9.40955 s vector Zucchini.PeakPagefileUsage 755252 KiB Zucchini.PeakPagefileUsageChange 733820 KiB Zucchini.PeakWorkingSetSize 632660 KiB Zucchini.PeakWorkingSetSizeChange 624616 KiB Zucchini.TotalTime 10.3224 s Bug: 1194281 Change-Id: Ic5a7f529d4465241990dbe27a485a67b32ab44b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830864 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#873383} NOKEYCHECK=True GitOrigin-RevId: 52f908bb699f8d106a1c43e10257759cce90500d
2021-07-25Added DIR_METADATA files to a batch of subfolders in //components/v…,Norman Rosas
//components/w…, and//components/z.., also removed duplicated metadata from OWNERS files Bug: 1113033 Change-Id: I2ebce402c335ad9d8f54120ba41860832eeef621 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570554 Auto-Submit: Norman Rosas <normando@google.com> Commit-Queue: Mike Pinkerton <pinkerton@chromium.org> Reviewed-by: Mike Pinkerton <pinkerton@chromium.org> Cr-Commit-Position: refs/heads/master@{#833755} NOKEYCHECK=True GitOrigin-RevId: 6df3edc1ab58a848e3127589abe05e794625304e
2021-07-25Rename includes from bind_helpers.h to callback_helpers.hdanakj
R=dcheng@chromium.org NOPRESUBMIT=true TBR= NOTRY=true Change-Id: I93bc6a9360997fae7adeab8c01f56e08fc025dd2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523543 Commit-Queue: danakj <danakj@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#826289} NOKEYCHECK=True GitOrigin-RevId: db9ae7941adc1d95c943accce9e0151d265fd640
2021-07-25Change actions to python2_actions as needed.Dirk Pranke
As a prelude to starting to move the build fully over to Python 3, this CL changes all of the GN `action` and `action_foreach` targets that appear to require Python 2 over to `python2_action` and `python2_action_foreach`. This CL by itself should produce no functional change since we'll still be using Python 2 by default, and the new templates are passthroughs in that config. To start using Python3, you can run `gn gen --script-executable=python3 //out/Default` on Unix; on Python3 you need to point to an actual python3.exe and not the python3.bat wrapper in depot_tools; once we can roll GN forward to a version that contains https://gn-review.googlesource.com/c/gn/+/10560 (which will hopefully happen in the next day or two), that won't be necessary. The Fuchsia build will not work until http://fxrev.dev/446479 lands and is rolled in. No-Presubmit: true Bug: 1112471 AX-Relnotes: n/a Change-Id: I891155502e0940a8075cf26d675f54b803d91242 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510878 Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Dirk Pranke <dpranke@google.com> Cr-Commit-Position: refs/heads/master@{#824216} NOKEYCHECK=True GitOrigin-RevId: ca35ab2022b017562b9ad3d12fea3f149d18cf87
2021-07-25Refactor OS_LINUX preprocessor directive for LaCrOS effort.Sean McAllister
Currently, ChromeOS defines the OS_LINUX directive as well as OS_CHROMEOS. We're working to separate these two, so we're making the fact that OS_LINUX == OS_LINUX || OS_CHROMEOS explicit. Bug: 1110266 Change-Id: I88dc82e3b48bd1d63189d3e57ed0f3fe3351279b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352024 Commit-Queue: Sean McAllister <smcallis@google.com> Reviewed-by: Jonathan Backer <backer@chromium.org> Reviewed-by: Carlos IL <carlosil@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#799690} NOKEYCHECK=True GitOrigin-RevId: 74bfcb4cd5469b0b9a4b265a6c5d9f92051ed973
2021-07-25Use FLAG_SHARE_DELETE when opening files in the installer.Greg Thompson
This CL adds FLAG_SHARE_DELETE to many file operations in Chrome's installer; including in delta patch processing and archive extraction utilities. This allows processing on files that are held open to be deleted by another entity so that we can eventually hold temporary files open with FILE_FLAG_DELETE_ON_CLOSE. BUG=516207 Change-Id: I1cd03f6360dfcd61fcd2f09797f0923331076415 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302109 Reviewed-by: Will Harris <wfh@chromium.org> Commit-Queue: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#789702} NOKEYCHECK=True GitOrigin-RevId: f176eba36c20d3f315e507eea7f306da3b58c2e4
2021-07-25Switch to 1-parameter version of base::DeleteFile() in components/.Lei Zhang
The 1-parameter version is simpler, and the 2-parameter version is deprecated. Bug: 1009837 Change-Id: I567afd7824ff7c10d442ae576d694eb0af4d7259 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285468 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/master@{#786434} NOKEYCHECK=True GitOrigin-RevId: e6e8c132890eb04e7a33a5d3f588bdb406625cf6
2021-07-25Remove/replace unnecessary includes of logging.h (components/)Hans Wennborg
If the file just needs the CHECK/CHECK_OP/NOTREACHED macros, use the appropriate header for that instead. Or if logging.h is not needed at all, remove it. This is both a nice cleanup (logging.h is a big header, and including it unnecessarily has compile-time costs), and part of the final step towards making logging.h no longer include check.h and the others. Bug: 1031540 Change-Id: Ibeb7cc26e331161c5a1490b84ef5a59ecd122413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2254029 Auto-Submit: Hans Wennborg <hans@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/master@{#781841} NOKEYCHECK=True GitOrigin-RevId: 29c74d3fa1a05f3de62c3017b70c4e9e0d7fbbca
2021-07-25Include-what-you-use related to logging.h (components)Hans Wennborg
Add direct includes for things provided transitively by logging.h (or by other headers including logging.h). This is in preparation for cleaning up unnecessary includes of logging.h in header files (so if something depends on logging.h, it needs include it explicitly), and for when logging.h no longer includes check.h, check_op.h, and notreached.h. Bug: 1031540 Change-Id: I0ff3ce30d29dd57837e3c156940d11247a46d661 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248688 Commit-Queue: Hans Wennborg <hans@chromium.org> Auto-Submit: Hans Wennborg <hans@chromium.org> Reviewed-by: Ted Choc <tedchoc@chromium.org> Cr-Commit-Position: refs/heads/master@{#779725} NOKEYCHECK=True GitOrigin-RevId: 5bafbb92230ad5f59e1fc6e1d3f5d638c34b9dad
2021-07-25Remove/replace unnecessary logging.h includes in .cc files (components)Hans Wennborg
CHECK, CHECK_EQ etc., and NOTREACHED/NOTIMPLEMENTED have moved to the much smaller headers check.h, check_op.h, and notreached.h, respectively. This CL updates .cc files to use those headers instead when possible, with the purpose of saving compile time. (Split out from https://crrev.com/c/2164525 which also has notes on how the change was generated.) Bug: 1031540 Change-Id: I1c0c8450be6320577ebebe39a2cb1abc692fe8b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164613 Commit-Queue: Hans Wennborg <hans@chromium.org> Auto-Submit: Hans Wennborg <hans@chromium.org> Reviewed-by: Ted Choc <tedchoc@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#763287} NOKEYCHECK=True GitOrigin-RevId: df87046cb8ae4dbd62cda6e56d317016a6fa02c7
2021-07-25logging.h related include-what-you-use (components/)Hans Wennborg
Fix code that was implicitly depending on logging.h or its dependencies. For example, code that uses DISALLOW_COPY_AND_ASSIGN should include base/macros.h, but it currently happens to work if it pulls in logging.h directly or through some dependency. This is part of refactoring the codebase to use check.h/check_op.h for the CHECK and CHECK_op macro instead of logging.h. Bug: 1031540 Change-Id: Ibdaee90f6af0e9e2cb304274e6a326ea789613c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2156947 Auto-Submit: Hans Wennborg <hans@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/master@{#760922} NOKEYCHECK=True GitOrigin-RevId: 628c19e0b15abdbfb3a3c3b4cd9dcd80886c5fb9
2021-07-25fix: add missing data dependency to zucchini_integration_testRichard Townsend
Our Windows on Arm testing setup relies on using GN to extract the runtime_deps of each test suite. Adding testdata ensures that it's appropriately packaged. All tests pass once this is added. Change-Id: I239fd4b3ec4c044cdc7f40070d45e5155e278217 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107554 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Richard Townsend <richard.townsend@arm.com> Cr-Commit-Position: refs/heads/master@{#751455} NOKEYCHECK=True GitOrigin-RevId: 94ededfee45710990d8e55a4d62b7481999bedbd
2021-07-25[Zucchini] Fix 64-bit ELF reloc code failing to reject references that ↵Samuel Huang
straddle EOF. RelocReaderElf is supposed to reject relocs that refers to an abs32 reference that lies outside the image. This should include references whose offset is in the image, but whose body "straddles" image boundary. Turns out the reference width for this check was hard-coded to 4, and on ELF64, this allows 8-byte wide references to sneak by the check (which leads to check failure down the road). This CL fixes the above, while adding new unit tests (with refactoring). Meanwhile, Win32 reloc extraction works a little differently, and already handles the above issue. Bug: 1028892 Change-Id: I746c1a2d8114a429f74d9c0605f50044e05d76be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013463 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#734488} NOKEYCHECK=True GitOrigin-RevId: 0b8add5192efb2b283f381fcd9a590e655df2f35
2021-07-25[Zucchini] Fix checked_cast failureckitagawa
This fixes a case where 32-bit Zucchini with size being 32-bit will crash when handling a 64-bit ELF file if there is a segment that extends beyond the image bounds. This is a quick fix, but there is a larger issue at play here. See the bug to discuss options. Bug: 1035603 Change-Id: I74887b8c6b8779642910de1bc31dccfcdc0d1bec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008356 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#733625} NOKEYCHECK=True GitOrigin-RevId: f3ba433da667d8cda30ac4db8402a9137c281ee1
2021-07-25Reformat all gn files in /components/zucchini.Nico Weber
`gn format` recently changed its formatting behavior for deps, source, and a few other elements when they are assigned (with =) single-element lists to be consistent with the formatting of updates (with +=) with single-element. Now that we've rolled in a GN binary with the change, reformat all files so that people don't get presubmit warnings due to this. This CL was uploaded by git cl split. R=wfh@chromium.org Bug: 1041419 Change-Id: Iabb4b3262df63e346520bce93cc00ce6538f76fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1997802 Auto-Submit: Nico Weber <thakis@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Commit-Queue: Will Harris <wfh@chromium.org> Cr-Commit-Position: refs/heads/master@{#730667} NOKEYCHECK=True GitOrigin-RevId: 5366f1719d82185483bbc3fe35725653d384e1ea
2021-07-25[Zucchini] Fix fuzzer checked_cast issuesckitagawa
The fuzzer for the disassembler_elf found a couple of ways to trigger checked_cast failures in the ParseHeader function. Other disassemblers handle such failures by cleanly exiting as opposed to crashing due to a CHECK. This turned out to be a problem with numeric overflow in JudgeSection. Bug: 1029405 Change-Id: Idae395f74a43a1de4793db6222d7786e57e9ad30 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1967070 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#725225} NOKEYCHECK=True GitOrigin-RevId: 925bb161e0dcd816510f616190a2ba24c0bea2bb
2021-07-25[Zucchini] Fix 4 DisassemblerElf bugs discovered by new fuzzer.Samuel Huang
This CL redoes section processing in DisassemblerElf to fix 4 bugs discovered by zucchini_disassembler_elf_fuzzer that ckitagawa@ recently added. These bugs all involve some malformed SHF_EXECINSTR section that sneaks past early checks to reach pointer extraction, then triggers another check. Summaries: * Issue 1023095: |sh_type == SHT_NOBITS| helps section bypass bound checks. DCHECK is triggered in Abs32GapFinder::Abs32GapFinder() because |sh_size| grossly exceeds bounds. * Issue 1023183: |sh_size == 0| and |sh_offset < image_.size()| makes section seem benign, but |sh_offset| is ignored when computing |offset_bound|. DCHECK is triggred in Abs32GapFinder() ctor because |sh_offset| > estimated image size (|offset_bound|). * Issue 1023203: ELF64. |sh_size == 0| and |sh_offset == 0| make section seem benign. However, |sh_addr| far exceeds 32-bit bound. In ParseExecSection(), |sh_addr| fails base::checked_cast(). * Issue 1023210: Section has vaid bounds, and |sh_addr == 0| makes section excluded (heuristically) from AddressTranslator. Section proceeds to ParseExecSection(), which finds a rel32 whose: * Location offset is assumed okay. * Location RVA, by optimization, is converted directly using section data, and is also okay. * Target RVA is validated by AddressTranslator. But in Rel32ReaderX86::GetNext(), location offset -> RVA now uses AddressTranslator, which by earlier exclusion, results in kInvalidOffset. This pollutes target RVA and target offset, and triggers DCHECK. The above shows mismatches among usage of sections for the following: * Location / RVA matching (AddressTranslator), * ELF image size estimation (|offset_bound|), * Pointer extraction, against bypasses due to |sh_type == SHT_NOBITS|, |sh_size == 0|, and |sh_addr == 0|. To fix the issues, this CL separates decision logic from enactment. Decision logic is moved to JudgeSections(), which takes a section and returns a "judgement" consisting of bit field defined from new enum SectionJudgement. The judgement is enacted in ParseHeader(), which chooses to invalidate the ELF, ignore the section, or use the section with greater discretion on applying pointer extraction. Additional fix: Ignore (non-fatal) sections with SHF_TLS bit, since these sections can have offset-RVA ranges that conflict with other section's. Without this fix, Zucchini on Ubuntu won't recognize itself as an ELF file! Bug: 1023095, 1023183, 1023203, 1023210, 1022538 Change-Id: Icc86f26db17a61bb41b432177ef6c3dc0dcd1a26 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933632 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#718809} NOKEYCHECK=True GitOrigin-RevId: f2e5fba3a476a96d5a412603385cf47116c51251
2021-07-25[Zucchini] Fix offset outside image caseckitagawa
The fuzzer found a pathological case when the section size is 0 but the offset is outside of image. This resulted in header parsing skipping the section since the size was 0; however, later processing creates a region of size 0 that is outside the image causing checks to fail. The solution here is to check if the offset is outside the image and the size is 0. This suggests that the data is ill formed and we should reject the image entirely. Bug: 1019271 Change-Id: If47d099aa4f919b097d4e15804048eaf64a59201 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903886 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#713572} NOKEYCHECK=True GitOrigin-RevId: 74eb15eee824427077620f88b2e4759c5bb2e221
2021-07-25[Zucchini] Reduce forgiveness of bounds checksckitagawa
The current code is too lax. It doesn't enforce bounds checks strongly enough. It claims to be for RVAs, but allows all sections through. This results in downstream code being unable to trust that the regions created are safely within the image resulting in issues when Fuzzing if the data is ill formed. To fix the fuzzers we should be remove this forgiveness. However, long term a better check for RVA forgiveness should maybe be investigated. Bug: 1013823, 1013842, 1013871, 1014124 Change-Id: Ic164fc76d687711c496f57b3bfe33ced6b8ad838 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863070 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/master@{#706511} NOKEYCHECK=True GitOrigin-RevId: 73089e0c2f9bc4c901c2e86e3d498e40dccb8172
2021-07-25[Zucchini] Add ELF fuzzerckitagawa
This CL introduces a fuzzer for the ELF disassemblers in Zucchini. I have already uploaded some corpus files to the clusterfuzz-corpus Google Storage bucket. Achieves ~700 exec/s locally. This is on-par with the DEX and Win32 disassemblers as it requires a largish representative file to serve as a test. (Recommendation is ~1000 exec/s). Brings up coverage of ELF related code from 0-30% to 80-100% I expect this will find quite a few crashes early on but should stabilize within a couple of weeks; est. 1-2 bugfixes per day based on how DEX and Win32 went. Mostly checked_casts and bounds issues. Bug: 1013641 Change-Id: I205135547cad2a95e59f99d7f040c13d72c45b59 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856624 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#705245} NOKEYCHECK=True GitOrigin-RevId: b00aaabae0e86b84d0007f76f7736fe2db397aaf
2021-07-25Support initializing logging with a file descriptor rather than a path.Robbie McElrath
This CL adds an optional file descriptor to LoggingSettings, which can be used to initialize logging to an already open file. Previously, logging to a file required passing a path and letting the logging system open() it for append. Passing a file-descriptor means that a process can be sandboxed to have no access to the log directory, but can still be passed a file-descriptor to log to. This is needed for the Network Service on ChromeOS, whose logging needs to be reinitialized to a new location after it's already started. Bug: 977415 Change-Id: I2d07dc13a7e9f0f57d0802e4816628c181f183cd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1699477 Commit-Queue: Robbie McElrath <rmcelrath@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Reviewed-by: Wez <wez@chromium.org> Cr-Commit-Position: refs/heads/master@{#688754} NOKEYCHECK=True GitOrigin-RevId: 8bf4984f3ad0fb5fc8981f02ce9b96078a98632f
2021-07-25[logging] Add LOG_TO_STDERR logging destinationSharon Yang
* Separate LOG_TO_SYSTEM_DEBUG_LOG into two cases, LOG_TO_STDERR and LOG_TO_SYSTEM_DEBUG_LOG as before. * Provide the option to only write to system specific logs, write to stderr or both, reducing redundant logs for systems which have log services, such as with Fuchsia. * For all systems, logs with severity ERROR and above will continue to be written to stderr. * All systems except Fuchsia have the same behaviour and defaults as before. * Update default logging destination for Fuchsia to system logs only. Bug: 960882 Change-Id: Ib0f27d194226ac5584609a3e8e4bc561828deed8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601467 Commit-Queue: Sharon Yang <yangsharon@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#661446} NOKEYCHECK=True GitOrigin-RevId: 7cb919a9b3f78d642f8a98e8a81140ef13e2fec2