Stream: git-wasmtime

Topic: wasmtime / PR #9356 Allow alignments that eat the remaini...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 21:10):

elliottt opened PR #9356 from elliottt:trevor/null-allocation-adapter to bytecodealliance:main:

The preview1 adapter has an implementation of cabi_realloc that facilitates calling component imports that return dynamically allocated results, like lists and strings. However, when returning a zero-length value to a buffer that's been allocated with zero bytes available, a trap will occur. This is because the alignment check requires that there is space left over after alignment has been added to the base pointer, which in the case of an empty buffer, will not be possible.

This PR fixes the issue by relaxing the alignment check to require that the amount required to align the base does not exceed the length of the buffer, but may consume the entire allocation.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 21:10):

elliottt requested wasmtime-core-reviewers for a review on PR #9356.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 21:10):

elliottt requested fitzgen for a review on PR #9356.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 21:10):

elliottt requested alexcrichton for a review on PR #9356.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 21:24):

alexcrichton commented on PR #9356:

Would it be possible to add a test for this as well? Or is that out-of-scope in the WASI APIs we have bound?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 22:34):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 23:47):

elliottt updated PR #9356.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 23:48):

elliottt updated PR #9356.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2024 at 23:56):

elliottt commented on PR #9356:

Would it be possible to add a test for this as well? Or is that out-of-scope in the WASI APIs we have bound?

The test added fails when the change to the align_to function is reverted, triggering the original issue in the adapter.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2024 at 00:13):

elliottt merged PR #9356.


Last updated: Dec 23 2024 at 12:05 UTC