Skip to content

oci: casext: walk: do not attempt to recurse into un-parseable blobs - #375

Merged
tych0 merged 2 commits into
opencontainers:masterfrom
cyphar:cas-workaround-expensive-close
Sep 1, 2021
Merged

tych0 merged 2 commits into
opencontainers:masterfrom
cyphar:cas-workaround-expensive-close

Conversation

@cyphar

@cyphar cyphar commented Aug 5, 2021

Copy link
Copy Markdown
Member

Since all of these blobs are not parseable, we won't be able to fetch
sub-descriptors from them, and thus there's no real point trying to
recurse into them. Before commit 4faf753 ("pkg: hardening: slurp
trailing bytes in VerifiedReadCloser.Close()") this wasn't too big of a
deal, but after that commit Close() is quite expensive for blobs you
don't use.

Reported-by: Tycho Andersen tycho@tycho.pizza
Signed-off-by: Aleksa Sarai cyphar@cyphar.com

@cyphar

cyphar commented Aug 5, 2021

Copy link
Copy Markdown
Member Author

@tych0 This should fix #373, can you try it out and see?

@tych0

tych0 commented Aug 9, 2021

Copy link
Copy Markdown
Member

[sorry for the delay, was in the woods for part of last week] Yep, I just tested this and it fixes things for me, thanks. Not sure what you want to do about CI, though. Should I just force-merge?

@cyphar

cyphar commented Aug 10, 2021

Copy link
Copy Markdown
Member Author

I'll forcefully fix up the CI this week and we can properly review things afterwards.

@tych0

tych0 commented Aug 25, 2021

Copy link
Copy Markdown
Member

ping :)

@cyphar

cyphar commented Sep 1, 2021

Copy link
Copy Markdown
Member Author

Thanks for the ping, I just managed to wrangle the CI into working under Github Actions -- I will need to push the fix directly to master though because you can't really PR-based-review a CI change like this one (it won't work until the CI config is on master).

@cyphar
cyphar force-pushed the cas-workaround-expensive-close branch from 2ab44a8 to 16a7a8d Compare September 1, 2021 08:31
With VerifiedReadCloser, users are in a situation where using GetBlob
for pure existence checks results in the entire blob being read from
disk on Close() even though they didn't read any bytes (meaning the
verification check isn't protecting against anything).

We can't make VerifiedReadCloser a no-op in the read-nothing case, but
it also seems that we should have a separate API for this anyway --
hence a stat-ish API that just does a "does this exist" check.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Since all of these blobs are not parseable, we won't be able to fetch
sub-descriptors from them, and thus there's no real point trying to
recurse into them. Before commit 4faf753 ("pkg: hardening: slurp
trailing bytes in VerifiedReadCloser.Close()") this wasn't too big of a
deal, but after that commit Close() is quite expensive for blobs you
don't use.

Reported-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
@cyphar
cyphar force-pushed the cas-workaround-expensive-close branch from 16a7a8d to 5adbd99 Compare September 1, 2021 09:28
@tych0
tych0 merged commit 8a1c8e7 into opencontainers:master Sep 1, 2021
@cyphar
cyphar deleted the cas-workaround-expensive-close branch September 2, 2021 08:47
rchincha pushed a commit to rchincha/zot that referenced this pull request Sep 23, 2021
There is a performance regression in umoci [1] which is fixed in [2].

References:
[1] opencontainers/umoci#373
[2] opencontainers/umoci#375

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
rchincha pushed a commit to project-zot/zot that referenced this pull request Sep 23, 2021
There is a performance regression in umoci [1] which is fixed in [2].

References:
[1] opencontainers/umoci#373
[2] opencontainers/umoci#375

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
adodon2go added a commit to adodon2go/zot that referenced this pull request Oct 12, 2021
* go.mod: update umoci dep

There is a performance regression in umoci [1] which is fixed in [2].

References:
[1] opencontainers/umoci#373
[2] opencontainers/umoci#375

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

* doc: add documentation for comparison with well-known registries

Add COMPARISON.md

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

* Update README.md

* Update README.md

* go.mod: update deps to address dependabot alerts

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

* search: added graphql api to return repository list with latest tag

* Update COMPARISON.md

* Added first tests on node exporter

* Added more tests on node exporter; refactored MetricsServer

* Fixed linter issues

* Added more tests for better code coverage

* Enable GH Actions on this branch

* Updated go.mod

* Fix sanity

* Prepare the fix before merging

Co-authored-by: Ramkumar Chinchani <rchincha@cisco.com>
Co-authored-by: Ramkumar Chinchani <45800463+rchincha@users.noreply.github.com>
Co-authored-by: Shivam Mishra <shimish2@cisco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

performance regression: GC() (or more generally, Walk()) now reads every blob off of disk and hashes it (twice)

2 participants

⌂ 换网址