kernel: Preserve TLS key in kernel_reset() after force-rewind#12
Open
JoyciAkira wants to merge 1 commit intookuoku:masterfrom
Open
kernel: Preserve TLS key in kernel_reset() after force-rewind#12JoyciAkira wants to merge 1 commit intookuoku:masterfrom
JoyciAkira wants to merge 1 commit intookuoku:masterfrom
Conversation
Update lkl-wasm submodule to include fix for kernel_reset() preserving TLS key after Asyncify force-rewind. Fixes ENOMEM (-12) errors on all syscalls after force-rewind. Signed-off-by: Daniele Corrao <danielecorrao@users.noreply.github.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix critical bug where
kernel_reset()was destroying the TLS key created bysyscalls_init()during Asyncify force-rewind, causing all subsequent syscalls to fail with ENOMEM (-12).Problem
After Asyncify force-rewind, the kernel becomes unusable:
tls_get()returns NULLnew_host_task()failsRoot Cause
init()→syscalls_init()→tls_alloc()(Key Prepare website #1)kernel_reset()frees Key Prepare website #1 and allocates Key Syscall porting is incomplete #2tls_get()returns NULL, breaking all syscallsSolution
task_keyinstead of freeing itidle_host_task_loopif already existshost0and set TLS on existing keyTesting
Tested with Zeronode project (https://github.com/zeronode/zeronode):
Impact
Code Changes
arch/lkl/kernel/syscalls.c: Modifiedkernel_reset()functiontls_free(task_key)callidle_host_task_loopcreationReferences
Co-authored-by: Daniele Corrao danicorrao87@gmail.com
Signed-off-by: Daniele Corrao danicorrao87@gmail.com