aboutsummaryrefslogtreecommitdiff
path: root/equivalence_map.cc
AgeCommit message (Collapse)Author
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-25[Zucchini]: Fix OffsetMapper implicit conversion.Etienne Pierre-doray
Fix compile error with -Wshorten-64-to-32. Image size is new stored as an offset_t to avoid implicit conversion. Bug: 881008 Change-Id: I82b12ce17d8368f05d6a5537fd1734ee32b37dbe Reviewed-on: https://chromium-review.googlesource.com/1213549 Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#589938} NOKEYCHECK=True GitOrigin-RevId: 5946dbfa3f684d8f4960bb413b5e8322ebddcee3
2021-07-25Use base::Erase(), base::EraseIf() in components/Jdragon
This patch is just a code simplification. It's much easier to write: base::Erase(container, value); base::EraseIf(container, ...); than: container.erase(std::remove(container.begin(), container.end(), value), container.end()); container.erase(std::remove_if(container.begin(), container.end(), ...), container.end()); Bug: 875665 Change-Id: I4eb9f77b58befd58c6c978eb7ce591b5d95bd613 Reviewed-on: https://chromium-review.googlesource.com/1181483 Reviewed-by: Jinho Bang <jinho.bang@samsung.com> Reviewed-by: Varun Khaneja <vakh@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Commit-Queue: Jinho Bang <jinho.bang@samsung.com> Cr-Commit-Position: refs/heads/master@{#585811} NOKEYCHECK=True GitOrigin-RevId: a248d5c3e929268bae58e3f5b1a39371a2a6c5f8
2021-07-25[Zucchini]: Remove IndirectReference.Etienne Pierre-doray
IndirectReference brings complexity conceptually. The purpose of IndirectReference was to speed-up look-ups. Turns out that there is no significant impact on patching time when using direct references. Furthermore, this reduces coupling between TargetPool and ReferenceSet. Change-Id: Ic50dbf59e483a7fa1480c8eb37f4b1d01a53401a Reviewed-on: https://chromium-review.googlesource.com/1136578 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#582653} NOKEYCHECK=True GitOrigin-RevId: 0434f5b4a564c6295e62a3996826f8627b8aa617
2021-07-25[Zucchini] Fix O(n^2) in pathological caseCalder Kitagawa
In pathological cases, such as those provided in the relevant bug, Zucchini could exhibit O(n^2) behavior during seed selection. To remedy this, this CL adds a quota to limit the total number of bytes covered in seed selection search. However, as demonstrated in CL: https://chromium-review.googlesource.com/c/chromium/src/+/1115710 this is insufficient. haungs@ determined that if this is the only limitation then the ExtendEquivalenceBackward method will perform a linear time extension resulting in O(n) behvior which when applied over O(n) offsets results in O(n^2) behavior again. To limit this he proposed limiting the distance ExtendEquivalenceBackward can search which is also implemented in this CL. These parameters are tuned such that they have no noticeable impact when patching chrome.7z for Windows. For the pathological testcases in the bug the results are significantly better (refer to the bug for exact improvements). This solution results in linear time performance on the pathological cases. We could get these numbers down even smaller by reducing the limit on backward extension. However, this had a small, but noticeable ~5 kiB increase in patches for chrome.7z. Bug: 849471 Change-Id: If7e857884b00daeeae7a4a29b1236c749f0b84e4 Reviewed-on: https://chromium-review.googlesource.com/1117273 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#571134} NOKEYCHECK=True GitOrigin-RevId: 94722d4e926dee2b8557c8b4abb881a4bf1e77f0
2021-07-25[Zucchini] Fix underflow / overflow for extended forward-projection.Samuel Huang
Forward-projection is how Zucchini uses the equivalence map to create estimated "new" targets from "old" targets. Extended forward-projection is defined to transform non-covered offsets: Given an offset, it finds the equivalence unit with nearest "old" block, then applies the "old"-to-"new" displacement to the offset. However, this makes it possible to map an "old" offset to an offset outside "new" image. Another issue is that Zucchini uses "dangling targets" that use "fake offsets" outside the image file to represent .bss data. These targets also undergo forward-projection, and should be properly handled. This CL fixes the existing behavior, where underflow / overflow go unchecked (although these values are rendered benign downstream, since the nearest actual "new" target is found). The updated extended forward-projection specifies: - For "old" targets with real offsets: Take nearest equivalence unit, clamp output to be inside [0, "new" image size). - For "old" dangling targets with fake offsets: Use difference in file size as displacement. The main impact w.r.t. patch is to reduce possible variance in patch sizes -- dangling targets are now handled better. Extensive unit tests are also added. Bug: 832572 Change-Id: I41fea175e4c13585d14a97a712a191afc2fcc6d6 Reviewed-on: https://chromium-review.googlesource.com/1111467 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#570401} NOKEYCHECK=True GitOrigin-RevId: ad7a5c086f00de62997714b84d6d6b5817ccc9d8
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