Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(go): updates wazero to 1.0.0-pre.7 #3355

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Jan 1, 2023

Description

This updates to wazero v1.0.0-pre.7 which fixes a GOARCH=386 compilation problem in v1.0.0-pre.6.

wazero 1.0.0-pre.6 includes the following notable changes:

  • improves module compilation and initialization performance

The following features are new and not currently used in Trivy, but might be relevant for future work:

  • adds writefs.NewDirFS which lets you add new files.
    • path_open O_CREAT flags, path_remove_directory path_rename path_unlink_file
  • adds NewFilesystemLoggingListenerFactory with dramatically improved logging.

This also includes changes described in 1.0.0-pre.5. Notably, context param was removed from memory functions as it was never used due to the scope being very narrow, and adds overhead to propagate.

@codefromthecrypt
Copy link
Contributor Author

@knqyf263 do I understand trivy builds for linux_386 as in 32-bit linux? We are currently failing to build for that architecture, as we aren't testing it. I guess we could in a future version, stub it out? wdyt?

 # github.com/tetratelabs/wazero/internal/platform
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:9: cannot use atime.Sec (variable of type int32) as type int64 in return statement
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:20: cannot use atime.Nsec (variable of type int32) as type int64 in return statement
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:32: cannot use mtime.Sec (variable of type int32) as type int64 in return statement
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:43: cannot use mtime.Nsec (variable of type int32) as type int64 in return statement
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:55: cannot use ctime.Sec (variable of type int32) as type int64 in return statement
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/platform/stat_linux.go:13:66: cannot use ctime.Nsec (variable of type int32) as type int64 in return statement
# github.com/tetratelabs/wazero/internal/syscallfs
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/syscallfs/dirfs.go:92:9: cannot use atimeSec (variable of type int64) as type int32 in struct literal
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/syscallfs/dirfs.go:92:25: cannot use atimeNsec (variable of type int64) as type int32 in struct literal
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/syscallfs/dirfs.go:93:9: cannot use mtimeSec (variable of type int64) as type int32 in struct literal
Error: ../../../go/pkg/mod/github.com/tetratelabs/wazero@v1.0.0-pre.6/internal/syscallfs/dirfs.go:93:25: cannot use mtimeNsec (variable of type int64) as type int32 in struct literal

cc @mathetake

@codefromthecrypt
Copy link
Contributor Author

tetratelabs/wazero#996

@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 2, 2023

Doesn't the wazero intepretor work on Linux 32 bit?

This updates to wazero v1.0.0-pre.7 which fixes a `GOARCH=386`
compilation problem in v1.0.0-pre.6.

This updates [wazero](https://wazero.io/) to [v1.0.0-pre.6](https://github.com/tetratelabs/wazero/releases/tag/v1.0.0-pre.6).

Notably, v1.0.0-pre.6:
* improves module compilation and initialization performance
* adds `writefs.NewDirFS` which lets you add new files.
  * `path_open` `O_CREAT` flags, `path_remove_directory` `path_rename` `path_unlink_file`
* adds `NewFilesystemLoggingListenerFactory` with dramatically improved logging.

This also includes changes described in [v1.0.0-pre.5](https://github.com/tetratelabs/wazero/releases/tag/v1.0.0-pre.5). Notably, context param was removed from memory functions as it was never used due to the scope being very narrow, and adds overhead to propagate.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@mathetake
Copy link
Contributor

Interpreter itself should work for sure, just that we don't test it and maybe some platform specific thing in WASI might need some fix

@codefromthecrypt
Copy link
Contributor Author

Doesn't the wazero intepretor work on Linux 32 bit?

Recently, we are completing filesystem write support, which is independent of the wasm core which is only about the engine (interpreter vs compiler). In this PR we noticed we didn't have a build check to ensure 386 builds. Mainly I was curious about if this is actually a runtime of trivy, or if it was something just there to avail all things.

In any case, when looking at the impact of the filesystem if 386 it was easy enough to work around for now. Anyway, the main issue was we weren't testing on compilation of 386 and so didn't notice until this PR anyone was depending on that.

We won't be doing runtime tests on the cartesian product of all possible GOOS GOARCH, probably for the same reason you don't. For now, we have to assume that 386 platform works if you can compile it.

Anyway I cut a patch release for 386 so this PR should be good to go, now!

@codefromthecrypt codefromthecrypt changed the title chore(go): updates wazero to 1.0.0-pre.6 chore(go): updates wazero to 1.0.0-pre.7 Jan 2, 2023
@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 3, 2023

Mainly I was curious about if this is actually a runtime of trivy, or if it was something just there to avail all things.

There are not so many users, but not zero. It would be better to keep providing these binaries.

$ curl -s https://api.github.com/repos/aquasecurity/trivy/releases | jq '.[1].assets[] | select(.name == "trivy_0.35.0_Linux-32bit.tar.gz").download_count'
93

We won't be doing runtime tests on the cartesian product of all possible GOOS GOARCH, probably for the same reason you don't. For now, we have to assume that 386 platform works if you can compile it.

Fair enough. Let's see how it goes.

Anyway I cut a patch release for 386 so this PR should be good to go, now!

Thanks👍

@knqyf263 knqyf263 merged commit 5b944d2 into aquasecurity:main Jan 3, 2023
@codefromthecrypt codefromthecrypt deleted the wazero-1.0.0-pre.6 branch January 4, 2023 01:21
umax pushed a commit to umax/trivy that referenced this pull request Jan 4, 2023
Signed-off-by: Adrian Cole <adrian@tetrate.io>
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.

3 participants