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

Miscellaneous syscalls to support running Tor #1075

Merged
merged 10 commits into from Feb 9, 2021
Merged

Miscellaneous syscalls to support running Tor #1075

merged 10 commits into from Feb 9, 2021

Conversation

robgjansen
Copy link
Member

No description provided.

@robgjansen robgjansen self-assigned this Jan 28, 2021
@robgjansen robgjansen added Component: Main Composing the core Shadow executable Type: Enhancement New functionality or improved design labels Jan 28, 2021
@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Merging #1075 (a1f71da) into dev (2448c17) will decrease coverage by 0.05%.
The diff coverage is 41.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1075      +/-   ##
==========================================
- Coverage   55.04%   54.98%   -0.06%     
==========================================
  Files         130      133       +3     
  Lines       19586    19772     +186     
  Branches     4676     4711      +35     
==========================================
+ Hits        10781    10872      +91     
- Misses       6045     6111      +66     
- Partials     2760     2789      +29     
Flag Coverage Δ
tests 54.98% <41.01%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/syscall/sysinfo.c 0.00% <0.00%> (ø)
src/test/signal/test_signal.c 18.18% <11.76%> (ø)
src/shim/preload_syscalls.c 47.61% <25.00%> (-0.40%) ⬇️
src/main/host/syscall/process.c 31.57% <25.71%> (-68.43%) ⬇️
src/main/host/syscall/futex.c 63.09% <37.50%> (-2.70%) ⬇️
src/main/host/process.c 73.51% <57.14%> (-0.50%) ⬇️
src/main/host/host.c 67.85% <63.63%> (-0.16%) ⬇️
src/main/host/syscall/signal.c 65.38% <65.38%> (ø)
src/main/host/syscall_handler.c 55.45% <75.00%> (+1.64%) ⬆️
.../main/core/scheduler/scheduler_policy_host_steal.c 81.67% <0.00%> (-0.39%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2448c17...6d2bdc7. Read the comment docs.

@robgjansen robgjansen marked this pull request as ready for review January 28, 2021 02:08
@robgjansen
Copy link
Member Author

Oh I see I should enable the test_getpid_kill test in src/test/unistd/test_unistd.rs now that kill is supported.

Copy link
Contributor

@stevenengler stevenengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

During a meeting we discussed a few limitations of the signal support. The plan is just to document these for now.

  1. There's a minor issue of causality when using the native Linux signal functionality rather than implementing signals as events/tasks, but this shouldn't be important since only one process/thread per host can be running at once.
  2. If the plugin uses the SIGSTOP or SIGCONT signals, it could cause issues for ptrace mode.
  3. In preload mode, this could cause issues for plugins that have syscall handlers. If process A sends a signal to process B, process B which is not currently running (and is waiting on a syscall) will receive the signal and start running the signal handler. The signal handler may make a syscall which gets intercepted by Shadow, and Shadow will try to make a second syscall while it's already processing the first one and will result in an error/crash.
  4. In preload mode, even if there is no signal handler registered, if the shim is waiting for a message from a Shadow worker (the shim is waiting on the semaphore), a signal will interrupt the wait and Shadow will continue as if the semaphore wait has finished when it hasn't.

src/main/host/process.h Outdated Show resolved Hide resolved
src/main/host/syscall/process.c Outdated Show resolved Hide resolved
src/main/host/syscall/process.c Outdated Show resolved Hide resolved
src/main/host/syscall/sysinfo.c Outdated Show resolved Hide resolved
src/main/host/syscall/sysinfo.c Outdated Show resolved Hide resolved
src/main/host/syscall/signal.c Show resolved Hide resolved
@robgjansen
Copy link
Member Author

Another option for dealing with signals is to only allow processes to send signals to themselves, which is the approach taken in the "Reproducible Containers" paper.

@robgjansen robgjansen merged commit d6a9ec6 into shadow:dev Feb 9, 2021
@robgjansen robgjansen deleted the syscall-misc2 branch February 9, 2021 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Main Composing the core Shadow executable Type: Enhancement New functionality or improved design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants