aboutsummaryrefslogtreecommitdiff
path: root/element_detection.cc
AgeCommit message (Collapse)Author
2021-11-17[Zucchini] Move version info to a separate file.Samuel Huang
This CL moves zucchini::{kMajorVersion, kMinorVersion, kInvalidVersion} to a standalone file version_info.h. The location should remain stable. Stability is important so that: * External tools can determine Zucchini versoin from source, i.e., the file serves as an implicit API. * Running 'git log' on version_info.h will point to CLs that implement or enable patch break changes. Bug: 1231882 Change-Id: I13243a5627870a31d8789d3579f1a50cc0e52bd5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3287124 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/main@{#942645} NOKEYCHECK=True GitOrigin-RevId: 0b4473c4e1683729ac9f81257ba48e1d3e34418f
2021-10-28[Zucchini]: Add patch version.Etienne Pierre-doray
This is a breaking change to zucchini patch format: Zucchini 1.0, see changelog. Add major/minor patch-wide version, and element version. Also add VerifyPatch() API and command line option to verify patch compatibility. Design: go/zucchini-versions Bug: 1231882 Change-Id: I19f1fbe2ee866c23f0814ffe6a912fb72812edbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3140224 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Cr-Commit-Position: refs/heads/main@{#936096} NOKEYCHECK=True GitOrigin-RevId: 559d77a9741428a48add017d389d104e431e6de7
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-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/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-25[Zucchini] Cleanup before adding ARM support.Samuel Huang
Update includes and comments, and remove some unused code. In particular, remove TODO comments for figuring out whether ARM abs32 references can be 4 bytes long: Turns out ARM absolute references are 8 bytes long. It's rel32 refereneces that can be 4 bytes long. Change-Id: I02dc905885f6cb5ff929efe0fb1f9a6593ee05a8 Reviewed-on: https://chromium-review.googlesource.com/c/1327559 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#606612} NOKEYCHECK=True GitOrigin-RevId: 9076fc4939ced233b85e5f8942ba947b6143aba3
2021-07-25[Zucchini] Create elf disassembler.Etienne Pierre-doray
Creates Disassembler that recognises and parses ELF format. For now, it only supports Intel architeture. Support for Arm will be added in follow-up CLs. Change-Id: Ibdcf113b573f22844b6a1611c5ff6df46829b9b3 Reviewed-on: https://chromium-review.googlesource.com/1136841 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#582233} NOKEYCHECK=True GitOrigin-RevId: 3c64e078fea9f23e44939c25ca02cf05b72b2c40
2021-07-23[Zucchini] ZTF (text) disassemblerCalder Kitagawa
A Zucchini text format (ZTF) disassembler for validating and debugging Zucchini using special text files. This is intended to be primarily used for easier validation of the core Zucchini algorithm. It is also useful for fuzzing reference projection as it is a lighter weight disassembler than other executable formats. References are encoded in an ASCII plain-text format to be human-readable and easier to debug. See the disassembler_ztf.h file for a complete outline of the file format. Which is referred to as Zucchini Text Format (ZTF) throughout the code. The design is meant to be highly flexible and non-redundant so a fair amount of templating/overloading is used. The overall design is: Shared: - ZtfConfig: To handle metadata for different types of references. - ZtfTranslator: Translate text references into offsets and back. Read: - ZtfParser: Find references in the file. - ZtfReferenceReader: Drive ZtfParser through the file and use it with ZtfTranslator to translate between offsets and references. Write: - ZtfWriter: The counterpart to parser for writing a reference to a location. - ZtfReferenceWriter: Compose ZtfWriter and ZtfTranslator together and write references to an image. Bug: 834904 Change-Id: Iec62c67eab6bd3e7e95b79798417035a4873360a Reviewed-on: https://chromium-review.googlesource.com/1056147 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#561140} NOKEYCHECK=True GitOrigin-RevId: d2c5be5844c12d2585bde53ba891154ffed2ca62
2021-07-23[Zucchini] Buildflag control of architecturesCalder Kitagawa
Allows Zucchini to be built with only a subset of architectures enabled this saves on binary size at the cost of flexibility. The idea is that only the desired architectures would be compiled for a particular usecases. For example the Windows setup.exe only needs Windows support. Expected savings as a percent of total binary size at present (868.5 kB non-debug): - Remove DEX 3.13% (841.3 kB) - Remove Win 6.00% (816.4 kB) - Only Raw 9.13% (789.2 kB) Note that in the case of Raw saving could be made significantly higher by entirely removing the dependence on references and reference projection. However, at present the additional messiness of the additional buildflags all over the codebase is not worth the maintenance costs. Bug: 835007 Change-Id: I091cb9d76e8473340374be1a33a5df48137a3067 Reviewed-on: https://chromium-review.googlesource.com/1037922 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#556802} NOKEYCHECK=True GitOrigin-RevId: f0545bf20576afb65f9bbc493ea9b4d5d42c4738
2021-07-23[Zucchini] Create dex disassembler.Etienne Pierre-Doray
Creates Disassembler that recognises and parses DEX format. For now, it doesn't extract any type reference, so it is equivalent to DisassemblerNoOp. Extraction of various types of reference will be added in a follow-up CL. BufferView::covers_array() and unittests were also added. Change-Id: I08756244e9af899cf0f40dabd2b0059e1749328e Reviewed-on: https://chromium-review.googlesource.com/967603 Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#546807} NOKEYCHECK=True GitOrigin-RevId: d214e2cf9e23bf055f0e0655e9564761d50206ad
2021-07-23[Zucchini] Move Zucchini from /chrome/installer/ to /components/.Samuel Huang
(Use "git log --follow" to see older revisions of files). /components/ is the most logical place to put Zucchini, which only depends on /base and /testing/gtest. This move also enables Zucchini to be used by the Component Updater. Details: - Move all files; run the following to change deps and guards: sed 's/chrome\/installer/components/' *.cc *.h -i sed 's/CHROME_INSTALLER/COMPONENTS/' *.cc *.h -i - Sorting works out pretty well! - Change all 'chrome/installer/zucchini' to 'components/zucchini' throughout other parts of the repo; sort if necessary. - Fix 6 'git cl lint' errors. - Change 1 Bind() usage to BindRepeated(). - Update OWNER. Bug: 729154 Change-Id: I50c5a7d411ea85f707b5994ab319dfb2a1acccf7 Reviewed-on: https://chromium-review.googlesource.com/954923 Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542857} NOKEYCHECK=True GitOrigin-RevId: 577ef6c435e8d43be6e3e60ccbcbd1881780f4ec