New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 834904 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Zucchini: Create new "Disassembler Mock" architecture for patching algorithm

Project Member Reported by hua...@chromium.org, Apr 19 2018

Issue description

Currently the end-to-end flow of Zucchini is mainly tested using actual executables, which are generated from known-good tool chains.

To better stress-test Zucchini-gen and Zucchini-apply system, we'd like to create a "mock" architecture that can be easily created manually, to communicate examples and specify test cases. Some nice properties to have:
- Everything is text-based, including reference bodies.
- Multiple reference pools and types are present.

Some early ideas:
- Make this a regular text file, but '(...)' and '[...]' are used to specify references (at location).
- There should be no special target label.
- Perhaps '...' can simply specify line and column numbers (1-based by convention?) in a text file.
- Can also use unary '+' and '-' to create relative address -> different type, same pool.
- Might need to pad '0' to create const number of digits, to maintain the assumption that reference bodies of the same type have the same length. The mock will in fact be useful for debugging, if/when we want to add support for reference types with variable length. 

 
Owner: ckitagawa@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d2c5be5844c12d2585bde53ba891154ffed2ca62

commit d2c5be5844c12d2585bde53ba891154ffed2ca62
Author: Calder Kitagawa <ckitagawa@google.com>
Date: Wed May 23 17:30:51 2018

[Zucchini] ZTF (text) disassembler

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}
[modify] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/BUILD.gn
[add] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/disassembler_ztf.cc
[add] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/disassembler_ztf.h
[add] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/disassembler_ztf_unittest.cc
[modify] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/element_detection.cc
[modify] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/image_utils.h
[add] https://crrev.com/d2c5be5844c12d2585bde53ba891154ffed2ca62/components/zucchini/type_ztf.h

Status: Fixed (was: Assigned)

Sign in to add a comment