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

spectest: reproduce segfault #50

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

spectest: reproduce segfault #50

wants to merge 14 commits into from

Conversation

evacchi
Copy link
Owner

@evacchi evacchi commented Feb 28, 2024

So this was definitely a journey :D This PR should fix ... for the old compiler, but really it addresses an issue that is unrelated to the file cache, or the compiler for that matter. It was indeed related to the finalizer, but it is much more articulated than you'd think.

Indeed, the problem is a lifecycle issue that involves finalizers, and it definitely relates to invoking code that is no longer mmapped; however, it was not due to a module being unmapped while executing, but it is a module doing a call_indirect on a module that was collected.

The spect tests generally do not fail because the GC is not performed at each iteration, but if we force it to collect at the end of each unit test (ab4f3d8) the spec tests will fail very predictably. In fact, by allowing a bit of output, we learn that one of the tests in linking.wast enters (->) a code segment with a given address (in this case 0x12aba0000) in assert_uninstantiable, then leaves it (<-), but then this segment is immediately released (!!), i.e. finalized. This is because

        === RUN   TestFileCache_compiler/spectest/linking.wast/assert_uninstantiable/line:371
        2024/02/28 16:54:11 -> 12aba0000
        2024/02/28 16:54:11 <- 12aba0000
        2024/02/28 16:54:11 !! 12aba0000
        === RUN   TestFileCache_compiler/spectest/linking.wast/assert_return/line:387
        2024/02/28 16:54:11 -> 12ab90000
        2024/02/28 16:54:11 <- 12ab90000
        === RUN   TestFileCache_compiler/spectest/linking.wast/assert_return/line:388
        2024/02/28 16:54:11 -> 12ab90000
        unexpected fault address 0x12aba0000
        fatal error: fault
        [signal SIGSEGV: segmentation violation code=0x2 addr=0x12aba0000 pc=0x12aba0000]

Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
…e` to avoid auto-close"

This reverts commit 5ddc150.

Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
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