Enable creation of host tasks with new tgid in LKL. - #553
Merged
Conversation
Introduce a new LKL-specific syscall `new_thread_group_leader` which creates a new task_struct for the host thread with new tgid. This should be the very first LKL syscall invoked by a newly spawned thread which wants to be threat group leader. Upon return from the syscall LKL creates a new tast_struct with a new tgid for the calling thread. The parent of the thread invoking the syscall (as returned via `lkl_sys_getppid`) is equal to pid of the thread which spawned the child thread. The child thread is cloned from the parent using CLONE_VM, CLONE_FS, CLONE_FILES and CLONE_SIGHAND flags. Signed-off-by: Zi Fan Tan <zifantan@google.com> Signed-off-by: Eugene Rodionov <rodionov@google.com>
tavip
approved these changes
Jan 10, 2025
Member
|
LGTM, thanks for the patch ! |
thehajime
approved these changes
Jan 13, 2025
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.
Hi @tavip, @thehajime,
Here is a change by @abcSup which enables creation of new processes in LKL (tasks with new thread group leader id). At the moment in LKL all the host tasks share the same tgid field and, thus, are considered to be part of the same process. With this change it will be possible to "emulate" multiple processes running on top of LKL. These processes would still share the same virtual address space and file descriptor table but would have different thread group leaders.
This functionality is needed to enable Android Binder fuzzing which restricts threads to sending transactions to each other when they belong to the same process (i.e. share the same tgid).
The approach taken here is very similar to okuoku@3847b0a by @okuoku (context in #551 (comment))
Let us know what you think.
Thanks,
Eugene