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

arm64_task/pthread_start: Convert the C / inline ASM code to assembly #13429

Merged
merged 1 commit into from
Sep 21, 2024

Conversation

pussuw
Copy link
Contributor

@pussuw pussuw commented Sep 13, 2024

Summary

The aforementioned functions can/will fail if the C compiler decides to use the stack for the incoming entrypt/etc. parameters.

Fix this issue by converting the jump to user part into pure assembly, ensuring the stack is NOT used for the parameters.

Impact

Fix system crash when user process enters userspace

Testing

QEMU + IMX9 with kernel mode

@pussuw
Copy link
Contributor Author

pussuw commented Sep 13, 2024

Second attempt at this. The original fix can break due to the C compiler pushing the incoming arguments to stack (for no reason, but it CAN do it so it will happen). Fix the issue by removing the C compiler from the equation by implementing the whole thing in assembly.

@pussuw pussuw marked this pull request as draft September 13, 2024 11:38
@github-actions github-actions bot added the Size: S The size of the change in this PR is small label Sep 20, 2024
@pussuw pussuw marked this pull request as ready for review September 20, 2024 12:12
The aforementioned functions can/will fail if the C compiler decides
to use the stack for the incoming entrypt/etc. parameters.

Fix this issue by converting the jump to user part into pure assembly,
ensuring the stack is NOT used for the parameters.
@pussuw
Copy link
Contributor Author

pussuw commented Sep 21, 2024

@acassis (or someone) could you please help me here by re-starting the CI tests:

/usr/bin/bash: line 1: arm-nuttx-eabi-gcc: command not found
Disabling CONFIG_ARM_TOOLCHAIN_BUILDROOT
Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
Building NuttX...
make[1]: *** No rule to make target '/github/workspace/sources/nuttx/.config'.
make[1]: Failed to remake makefile '/github/workspace/sources/nuttx/.config'.
make: *** [tools/Unix.mk:273: tools/cnvwindeps] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory

I don't think this has anything to do with my patches

@xiaoxiang781216 xiaoxiang781216 merged commit 10b40ab into apache:master Sep 21, 2024
29 checks passed
@pussuw pussuw deleted the arm64_task_start_fix2 branch September 21, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants