Skip to content

thread_preload: use seccomp to interpose all syscalls#1452

Merged
sporksmith merged 4 commits intoshadow:mainfrom
sporksmith:preload-seccomp
Jun 21, 2021
Merged

thread_preload: use seccomp to interpose all syscalls#1452
sporksmith merged 4 commits intoshadow:mainfrom
sporksmith:preload-seccomp

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith commented Jun 17, 2021

Installs a seccomp filter from the shim in preload-mode, which catches any syscalls that would otherwise be missed. The filter allows syscalls that originate from the shim itself. Other syscalls cause a SIGSYS; in the SIGSYS handler we can process the syscall as appropriate (e.g. emulate it via Shadow). Can disable with --use-seccomp=false

Semi-fixes #1168. This is a somewhat different approach than described there, but if this approach works out, then we probably don't need the one described in #1168.

Recompiled libc no longer needed to interpose remaining syscalls, fixing #892

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 17, 2021

Codecov Report

Merging #1452 (7395337) into main (7faa1ca) will decrease coverage by 0.26%.
The diff coverage is 14.28%.

❗ Current head 7395337 differs from pull request most recent head 9e53769. Consider uploading reports for the commit 9e53769 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1452      +/-   ##
==========================================
- Coverage   53.98%   53.72%   -0.27%     
==========================================
  Files         137      137              
  Lines       20415    20538     +123     
  Branches     5167     5196      +29     
==========================================
+ Hits        11022    11034      +12     
- Misses       6495     6601     +106     
- Partials     2898     2903       +5     
Flag Coverage Δ
tests 53.72% <14.28%> (-0.27%) ⬇️

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

Impacted Files Coverage Δ
src/main/host/thread_preload.c 0.00% <0.00%> (ø)
src/shim/shim.c 33.75% <0.00%> (-7.16%) ⬇️
src/shim/shim_syscall.c 54.71% <0.00%> (+1.01%) ⬆️
src/main/host/syscall/signal.c 29.92% <5.33%> (-35.47%) ⬇️
src/shim/preload_syscall.c 22.68% <46.66%> (+1.80%) ⬆️
src/main/host/shimipc.c 66.66% <100.00%> (+16.66%) ⬆️
src/main/host/syscall_handler.c 54.16% <100.00%> (ø)
src/main/host/status_listener.c 68.00% <0.00%> (-2.00%) ⬇️
src/main/host/descriptor/descriptor.c 73.52% <0.00%> (-1.48%) ⬇️
src/main/host/syscall/unistd.c 49.26% <0.00%> (-0.50%) ⬇️
... and 5 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 7faa1ca...9e53769. Read the comment docs.

@sporksmith sporksmith force-pushed the preload-seccomp branch 2 times, most recently from 0bb5608 to 5505f5e Compare June 18, 2021 00:03
@sporksmith sporksmith changed the title Preload seccomp thread_preload: use seccomp to interpose all syscalls Jun 18, 2021
@sporksmith sporksmith marked this pull request as ready for review June 18, 2021 00:16
@sporksmith sporksmith requested a review from stevenengler June 18, 2021 00:16
@sporksmith sporksmith requested a review from stevenengler June 21, 2021 21:53
Installs a seccomp filter from the shim, which catches any syscalls that
would otherwise be missed. The filter allows syscalls that originate
from the shim itself. Other syscalls cause a SIGSYS; in the SIGSYS
handler we can process the syscall as appropriate (e.g. emulate it via
Shadow).
@sporksmith sporksmith enabled auto-merge June 21, 2021 22:51
@sporksmith sporksmith merged commit 6b78e41 into shadow:main Jun 21, 2021
@sporksmith sporksmith deleted the preload-seccomp branch June 21, 2021 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hybrid mode via seccomp

2 participants