Skip to content

Simplify thread#2328

Merged
sporksmith merged 9 commits intoshadow:mainfrom
sporksmith:simplify-thread
Aug 8, 2022
Merged

Simplify thread#2328
sporksmith merged 9 commits intoshadow:mainfrom
sporksmith:simplify-thread

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith commented Aug 6, 2022

This is work towards simplifying Thread, in preparation to port it to Rust.

  • Remove more dead ptrace-related code
  • Remove vtables
  • Rename ThreadPreload to ManagedThread, and refactor to reflect that it is specifically a proxy to the native thread.

There's a bit of strangeness now in how Thread and ManagedThread handle the syscall state. My tentative plan is to change ManagedThread's methods to not invoke the syscallhandler, and instead return to Thread when they get to a syscall, so that the syscall handling code can be consolidated there. For that to work well though, it's helpful to refactor SysCallResult to be a more proper tagged union. I have that ready, but it's a large refactor - better to split it into a follow-up PR.

@github-actions github-actions bot added Component: Build Build/install tools and dependencies Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable labels Aug 6, 2022
@sporksmith sporksmith marked this pull request as ready for review August 6, 2022 02:11
@sporksmith sporksmith requested a review from stevenengler August 6, 2022 02:11
We only have one Thread "subclass" now, so we no longer need a vtable.
Just call the threadpreload methods directly.
We already stopped supporting preload-mode without seccomp, and now we
no longer support ptrace-mode. We were essentially using this to check
whether we were in preload mode or ptrace mode; we no longer need it,
nor the associated ptrace-mode fallbacks.
@sporksmith sporksmith merged commit 6959b81 into shadow:main Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Build Build/install tools and dependencies Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants