Skip to content

shim_seccomp: stop allowing sched_yield#3023

Merged
sporksmith merged 2 commits intoshadow:mainfrom
sporksmith:stop-allowing-schedyield
Jun 13, 2023
Merged

shim_seccomp: stop allowing sched_yield#3023
sporksmith merged 2 commits intoshadow:mainfrom
sporksmith:stop-allowing-schedyield

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith commented Jun 13, 2023

We needed this exception before to avoid recursive syscall interception in our spinlock implementation. Now that we're allowing direct syscalls from the shim's whole .text segment, we don't need to allow sched_yield by syscall number.

Fixes #2681: Removing this exception allows us to intercept direct sched_yield syscalls that aren't made from the shim itself, thereby letting us escape spin loops that use them.

Progress on #2790: asan has such spin loops in its thread-creation wrappers.

@sporksmith sporksmith self-assigned this Jun 13, 2023
@github-actions github-actions bot added Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging labels Jun 13, 2023
We needed this exception before to avoid recursive syscall interception
in our spinlock implementation. Now that we're allowing direct syscalls
from the shim's whole `.text` segment, we don't need to allow
`sched_yield` by syscall number.

Fixes shadow#2681:
Removing this exception allows us to intercept direct `sched_yield`
syscalls that *aren't* made from the shim itself, thereby letting us
escape spin loops that use them.

Progress on shadow#2790:
asan has such spin loops in its thread-creatio wrappers.
@sporksmith sporksmith force-pushed the stop-allowing-schedyield branch from 5482bb2 to bd2c8eb Compare June 13, 2023 13:58
@sporksmith sporksmith requested a review from stevenengler June 13, 2023 13:59
@github-actions github-actions bot added Component: Build Build/install tools and dependencies Component: Testing Unit and integration tests and frameworks labels Jun 13, 2023
@sporksmith sporksmith enabled auto-merge June 13, 2023 14:07
@sporksmith sporksmith merged commit 7ec56f7 into shadow:main Jun 13, 2023
@sporksmith
Copy link
Copy Markdown
Contributor Author

Oh, I should've just used Rustix's sched_yield in that test. I should've read the coding guidelines about which crate to use when ;P

@sporksmith sporksmith deleted the stop-allowing-schedyield branch June 13, 2023 14:17
@sporksmith
Copy link
Copy Markdown
Contributor Author

actually maybe it's just as well to use linux_api here, since we want to be very sure of what's happening underneath

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: Testing Unit and integration tests and frameworks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We don't escape sched_yield busy loops with use_preload_libc=false (or if the code makes a direct syscall)

2 participants