Skip to content

Conversation

@qianxichen233
Copy link
Contributor

This PR is splited from PR #164

This PR focuses on spliting out the fix for __clone_internal_fallback function.

This could probably better be an issue rather a PR.

There is a weird bug on __clone_internal_fallback: when compiling some large applications, the generated wasm binary code at __clone_internal_fallback is incorrect and made the entire wasm binary unable to run. I currently havn't figured out if this is a bug from clang or it's due to something else. This is a very brutal temporary solution that directly removed the body of this function, this workaround at least made the compiled binary be able to run.

@rennergade
Copy link
Contributor

Lets leave this PR up for now and open up an issue.

At the very least if we do merge we need to add comments saying that we removed this and why.

@rennergade
Copy link
Contributor

I looked further into this and I think its fine to remove the function if its doing weird things when compiling, its only there to support systems that don't do clone3 and we do.

It's only called once in spawni if clone3 returns ENOSYS, we should probably add some sort of panic there if we got into a situation where it was somehow called. We definitely need to add comments here explaining as well.

@qianxichen233
Copy link
Contributor Author

I looked further into this and I think its fine to remove the function if its doing weird things when compiling, its only there to support systems that don't do clone3 and we do.

It's only called once in spawni if clone3 returns ENOSYS, we should probably add some sort of panic there if we got into a situation where it was somehow called. We definitely need to add comments here explaining as well.

How are we supposed to trigger a panic here? One option is to use glibc’s assert, and another is to use our own debug_panic. I’d prefer debug_panic, but that raises another question: how do we propagate a debug_panic back to the host? One approach would be to define a new wasm import specifically, but I am not very sure if we all agree on this approach

@rennergade
Copy link
Contributor

I looked further into this and I think its fine to remove the function if its doing weird things when compiling, its only there to support systems that don't do clone3 and we do.
It's only called once in spawni if clone3 returns ENOSYS, we should probably add some sort of panic there if we got into a situation where it was somehow called. We definitely need to add comments here explaining as well.

How are we supposed to trigger a panic here? One option is to use glibc’s assert, and another is to use our own debug_panic. I’d prefer debug_panic, but that raises another question: how do we propagate a debug_panic back to the host? One approach would be to define a new wasm import specifically, but I am not very sure if we all agree on this approach

Importing debug panic probably makes sense

@Yaxuan-w
Copy link
Member

Yaxuan-w commented Dec 2, 2025

Could we call make_legacy_syscall/make_3i_syscall and panic in 3i?

@JustinCappos
Copy link
Member

JustinCappos commented Dec 2, 2025 via email

@rennergade
Copy link
Contributor

@Yaxuan-w @JustinCappos going to do quick recap here in case the discussion above is confusing.

  • On systems that don't support clone3 (we do support it) there is a fallback function that calls to clone()
  • this fallback function is causing compilation (not runtime) errors. We support clone3 so we're going to remove it and comment.
  • the scenario where it's called should never happen (since we support clone3) but I want to panic there if it does get hit somehow.
  • we haven't added a syscall here, so we don't trampoline into trusted to call lind_debug_panic even though that seems like an appropriate thing to call.
  • Qianxi suggested adding a hook to call lind_debug_panic from trusted code such as libc in situations where changes were made but its not a syscall addition

@JustinCappos
Copy link
Member

@Yaxuan-w @JustinCappos going to do quick recap here in case the discussion above is confusing.

  • On systems that don't support clone3 (we do support it) there is a fallback function that calls to clone()
  • this fallback function is causing compilation (not runtime) errors. We support clone3 so we're going to remove it and comment.
  • the scenario where it's called should never happen (since we support clone3) but I want to panic there if it does get hit somehow.
  • we haven't added a syscall here, so we don't trampoline into trusted to call lind_debug_panic even though that seems like an appropriate thing to call.
  • Qianxi suggested adding a hook to call lind_debug_panic from trusted code such as libc in situations where changes were made but its not a syscall addition

Thanks for the clear summary! Please make sure the comments are also clear about this.

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.

5 participants