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

os/StartProcess #4377

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from
Open

os/StartProcess #4377

wants to merge 24 commits into from

Conversation

leongross
Copy link
Contributor

This is a rework of #4323 (based on that branch) to move the Execve and Fork wrappers to the os package to circumvent the goroot overrides.

@leongross leongross force-pushed the os/StartProcessOs branch 6 times, most recently from 43fcf8f to 8cce6c2 Compare August 2, 2024 12:06
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick initial (incomplete) review

src/os/osexec.go Outdated Show resolved Hide resolved
src/os/osexec.go Outdated Show resolved Hide resolved
src/os/exec_other.go Show resolved Hide resolved
src/os/exec_linux.go Outdated Show resolved Hide resolved
@leongross
Copy link
Contributor Author

leongross commented Aug 5, 2024

main_test.go:394: /home/runner/work/tinygo/tinygo/src/os/osexec.go:14:23: undefined: syscall.Syscall

ci fails with undefined syscall.Syscall. I thought since it is just a package the compiler would pick that up when building it. @aykevl

EDIT: it looks like this is only happening on architectures that the createRawSyscall function does not target, which makes sense, namely EmulatedCortexM3 : cortex-m-qemu and EmulatedRISCV : riscv-qemu. Anyways, this should not happen.
https://github.com/tinygo-org/tinygo/blob/dev/main_test.go#L522

Anyhow the smoke tests fail without any further information of what went wrong on linux, windows and mac. the smoke test cannot be removed, it is not clear though why it wasn't build in the first place

rm: cannot remove 'smoke.test': No such file or directory

@leongross leongross marked this pull request as ready for review August 6, 2024 12:39
@leongross
Copy link
Contributor Author

leongross commented Aug 8, 2024

Not sure if something like #4398 would fix this? @aykevl

@aykevl
Copy link
Member

aykevl commented Aug 8, 2024

Not sure if something like #4398 would fix this? @aykevl

No, that's the wrong approach. If syscall.Syscall fails on baremetal systems, then the solution is not to implement these syscalls (because they're baremetal, so there is no OS to call into), but rather to figure out why these calls are made.

src/os/osexec.go Outdated Show resolved Hide resolved
@leongross leongross requested a review from aykevl August 8, 2024 14:57
@leongross leongross force-pushed the os/StartProcessOs branch 3 times, most recently from e369ae7 to bf011fe Compare August 9, 2024 10:19
@leongross leongross force-pushed the os/StartProcessOs branch 5 times, most recently from bbf1159 to ffa5a87 Compare August 22, 2024 10:41
src/os/tempfile.go Outdated Show resolved Hide resolved
@leongross
Copy link
Contributor Author

@deadprogram @dgryski @aykevl build and tests finally succeed, would appreciate another review.

@leongross leongross changed the title [rework] os/SartProcess os/SartProcess Aug 28, 2024
@leongross
Copy link
Contributor Author

@aykevl @deadprogram @dgryski would someone mind reviewing?

src/os/osexec.go Outdated Show resolved Hide resolved
@deadprogram deadprogram changed the title os/SartProcess os/StartProcess Sep 6, 2024
remove old comments, replace explicit syscall numbers with named
variants, undo tempfile seed generation, remove old // +build tags,
improve StartProcess documentation, remove custom syscall number
definitions.

Signed-off-by: leongross <[email protected]>
aarch64 has no support for the fork ssycall. for now exclude it.

Signed-off-by: leongross <[email protected]>
Signed-off-by: leongross <[email protected]>
@leongross
Copy link
Contributor Author

@aykevl

src/os/exec_linux.go Outdated Show resolved Hide resolved
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small things, otherwise this PR seems ready for merging.

return 0, errors.New("exec: no argv")
}

if len(argv) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: with this check, the previous check is unnecessary. len(argv) of a nil slice is always 0.

src/os/os.test Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file needs to be removed.

@@ -0,0 +1,18 @@
//go:build linux && !baremetal && !darwin && !tinygo.wasm && aarch64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aarch64 is not a valid Go build tag.

I think this file can be removed entirely now, since these things are implemented in osexec.go?

src/os/osexec.go Outdated
//go:build linux && !baremetal && !tinygo.wasm

// arm64 does not have a fork syscall, so ignore it for now
// TODO: add support for arm64 with clone or use musl implementation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to be updated or removed since it is outdated.

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.

4 participants