kinvolk / seccompagent

agent for handling seccomp descriptors for container runtimes
Apache License 2.0
41 stars 10 forks source link

Initial code #1

Closed alban closed 3 years ago

alban commented 4 years ago

Demo of a Seccomp Agent that is able to handle a few syscalls on behalf of the container:

It can be deployed in Kubernetes with:

kubectl apply -f deploy/seccompagent.yaml

cc @mauriciovasquezbernal @iaguis

rata commented 4 years ago

I don't think this applies now as mount/mkdir can't return EINTR, but this is so scary that I want to point it out somewhere (should we create an issue?). A few minutes ago these emails were sent clarifying the seccomp_user_notif(2) manpage: https://lists.linuxfoundation.org/pipermail/containers/2020-November/042585.html https://lists.linuxfoundation.org/pipermail/containers/2020-November/042586.html

When implementing a generic logic to block on some syscalls (like to handle accept() for the target), if we don't remember this I guess debugging can be really painful.

Alban, let me know if this goes better in an issue or if this affects the current code (my guess is it doesn't, but haven't looked).

alban commented 3 years ago

[EINTR] Alban, let me know if this goes better in an issue or if this affects the current code (my guess is it doesn't, but haven't looked).

For mkdir and mount, it seems fine, but I don't know how to handle that properly in the general case... what happens if the target process was interrupted with EINTR but the seccomp agent has already done the action on behalf of the container. Can it cancel the action in a generic way? The target process would probably try again when it receives EINTR, but then the seccomp agent would run the action twice...