Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Issue 2854113002: [Courgette] Reduce AssemblyProgram to reduce Courgette-apply RAM floor and disk churn. (Closed)

Created:
3 years, 7 months ago by huangs
Modified:
3 years, 7 months ago
CC:
chromium-reviews, wfh+watch_chromium.org, fuzzing_chromium.org, huangs+watch_chromium.org, chrisha
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Courgette] Reduce AssemblyProgram to reduce Courgette-apply RAM floor and disk churn. This is the main CL of the AssemblyProgram reduction effort, which makes Disassembler emit instructions directly to EncodedProgram, and bypass AssemblyProgram, which becomes a holder of LabelManager and Label Annotation. Another big change is that Disassembler usage is exposed to high-level flows (rather than having it hidden inside ParseDetectedExecutable*()). Details: - Remove ParseDetectedExecutable*() and expose DetectDisassembler(). - AssemblyProgram: Remove: - Entire Instruction class hierarchy. - Allocated instruction in the heap (including preallocated DEFBYTE instances). - enum OP {}, which duplicates EncodedProgram::OP. - InstructionVector of pointers, which takes 100's of MB on disk. - Encode() interface. - AssemblyProgram: Add: - AnnotateLabels() to generate Label Annotation directly from a generator (injected by Disassembler), using LabelReceptor template class for counting and storage. - PrepareEncodedProgram() to inject data needed (e.g., Label) to EncodedProgram. - Disassembler: Disassemble() is split into CreateProgram() and DisassembleAndEncode(). - EncodedProgram: Old AssemblyProgram::Encode() code now moved to InstructionStoreReceptor. New GenerateInstruction() is added to receive generator from Disassemblyprogram. - CourgetteFlow: Disassembler explicitly managed: - Remove ReadAssemblyProgramFromBuffer(). - Add ReadDisassemblerFromBuffer(). - Add CreateEncodedProgramFromDisassemblerAndAssemblyProgram(). - High-level flows in courgette_tool.cc, patch_generator_x86_32.h, patcher_x86_32.h: Using new more complex flow that involves Disassembler; using ASCII graphics in comment to illustrate. - Unit tests updates. Documentation update will be done in a follow-up. BUG=660980 Review-Url: https://codereview.chromium.org/2854113002 Cr-Commit-Position: refs/heads/master@{#472907} Committed: https://chromium.googlesource.com/chromium/src/+/88451332849bb3632182e4299f4c2b64a240b6c8

Patch Set 1 #

Patch Set 2 : Sync and merge. #

Total comments: 2

Patch Set 3 : Sync. #

Patch Set 4 : Update courgette_fuzzer in libfuzzer. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+332 lines, -661 lines) Patch
M courgette/adjustment_method_unittest.cc View 4 chunks +18 lines, -27 lines 0 comments Download
M courgette/assembly_program.h View 4 chunks +21 lines, -127 lines 0 comments Download
M courgette/assembly_program.cc View 3 chunks +37 lines, -362 lines 0 comments Download
M courgette/courgette_flow.h View 5 chunks +14 lines, -8 lines 0 comments Download
M courgette/courgette_flow.cc View 4 chunks +30 lines, -10 lines 0 comments Download
M courgette/courgette_tool.cc View 3 chunks +41 lines, -15 lines 0 comments Download
M courgette/disassembler.h View 2 chunks +8 lines, -3 lines 0 comments Download
M courgette/disassembler.cc View 3 chunks +15 lines, -6 lines 0 comments Download
M courgette/disassembler_elf_32_x86_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M courgette/encode_decode_unittest.cc View 3 chunks +10 lines, -5 lines 0 comments Download
M courgette/encoded_program.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M courgette/encoded_program.cc View 1 2 chunks +57 lines, -0 lines 0 comments Download
M courgette/encoded_program_fuzz_unittest.cc View 2 chunks +10 lines, -2 lines 0 comments Download
M courgette/instruction_utils.h View 1 chunk +14 lines, -0 lines 0 comments Download
M courgette/patch_generator_x86_32.h View 3 chunks +26 lines, -14 lines 0 comments Download
M courgette/patcher_x86_32.h View 2 chunks +10 lines, -7 lines 0 comments Download
M courgette/program_detector.h View 2 chunks +6 lines, -19 lines 0 comments Download
M courgette/program_detector.cc View 4 chunks +0 lines, -43 lines 0 comments Download
M testing/libfuzzer/fuzzers/courgette_fuzzer.cc View 1 2 3 1 chunk +9 lines, -12 lines 0 comments Download

Messages

Total messages: 39 (19 generated)
huangs
PTAL. But before committing this, I'm thinking of making a CL to better track peak ...
3 years, 7 months ago (2017-05-03 22:45:50 UTC) #3
Will Harris
I tried and failed to find something concrete to even nit on here. Very impressive ...
3 years, 7 months ago (2017-05-05 21:36:51 UTC) #4
Will Harris
forgot to publish, sorry https://codereview.chromium.org/2854113002/diff/20001/courgette/courgette_tool.cc File courgette/courgette_tool.cc (right): https://codereview.chromium.org/2854113002/diff/20001/courgette/courgette_tool.cc#newcode188 courgette/courgette_tool.cc:188: flow.DestroyDisassembler(flow.OLD); can these create and ...
3 years, 7 months ago (2017-05-05 22:26:22 UTC) #5
huangs
Thanks! To measure "disk churn" I made experiment CL http://crrev.com/2883773002/ that tracks TempMapping usage (vs. ...
3 years, 7 months ago (2017-05-14 04:27:56 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854113002/40001
3 years, 7 months ago (2017-05-15 21:26:55 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/454987)
3 years, 7 months ago (2017-05-15 22:13:14 UTC) #11
huangs
OWNER review to ochang@ for: testing/libfuzzer/fuzzers/courgette_fuzzer.cc PTAL. Thanks!
3 years, 7 months ago (2017-05-16 17:32:16 UTC) #17
huangs
Ping ochang@ for review.
3 years, 7 months ago (2017-05-17 19:46:29 UTC) #18
Oliver Chang (dont use)
lgtm
3 years, 7 months ago (2017-05-17 19:54:28 UTC) #20
huangs
Thanks. Committing!
3 years, 7 months ago (2017-05-17 20:14:53 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854113002/60001
3 years, 7 months ago (2017-05-17 20:16:43 UTC) #24
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/440224)
3 years, 7 months ago (2017-05-17 20:58:23 UTC) #26
Will Harris
ochang replied on the wrong account.
3 years, 7 months ago (2017-05-17 21:14:18 UTC) #27
Oliver Chang (dont use)
On 2017/05/17 21:14:18, Will Harris wrote: > ochang replied on the wrong account. woops, lgtm
3 years, 7 months ago (2017-05-18 03:50:19 UTC) #28
Oliver Chang
On 2017/05/18 03:50:19, Oliver Chang (dont use) wrote: > On 2017/05/17 21:14:18, Will Harris wrote: ...
3 years, 7 months ago (2017-05-18 03:50:56 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854113002/60001
3 years, 7 months ago (2017-05-18 14:59:12 UTC) #31
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/448583)
3 years, 7 months ago (2017-05-18 18:15:39 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854113002/60001
3 years, 7 months ago (2017-05-18 18:18:15 UTC) #35
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/chromium/src/+/88451332849bb3632182e4299f4c2b64a240b6c8
3 years, 7 months ago (2017-05-18 19:50:50 UTC) #38
Will Harris
3 years, 7 months ago (2017-05-18 21:46:50 UTC) #39
Message was sent while issue was closed.
🎆

Powered by Google App Engine
This is Rietveld 408576698