You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config.md
+66-1Lines changed: 66 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -400,6 +400,11 @@ For POSIX platforms, the configuration structure supports `hooks` for configurin
400
400
* Entries in the array have the same schema as `createRuntime` entries.
401
401
* The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace).
402
402
* The `createContainer` hooks MUST be executed in the [container namespace](glossary.md#container-namespace).
403
+
***`sendSeccompFd`** (array of objects, OPTIONAL) is an array of [`sendSeccompFd` hooks](#sendseccompfd).
404
+
* Entries in the array have the same schema as `createRuntime` entries.
405
+
* The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace).
406
+
* The `sendSeccompFd` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace).
407
+
* The data passed over stdin is the [seccomp state](#seccompstate).
403
408
***`startContainer`** (array of objects, OPTIONAL) is an array of [`startContainer` hooks](#startContainer-hooks).
404
409
* Entries in the array have the same schema as `createRuntime` entries.
405
410
* The value of `path` MUST resolve in the [container namespace](glossary.md#container-namespace).
@@ -415,7 +420,8 @@ For POSIX platforms, the configuration structure supports `hooks` for configurin
415
420
416
421
Hooks allow users to specify programs to run before or after various lifecycle events.
417
422
Hooks MUST be called in the listed order.
418
-
The [state](runtime.md#state) of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.
423
+
All hooks MUST be passed a data structure over stdin so that they may do work appropriately.
424
+
Exect when specified otherwise above, the data structure is the [state](runtime.md#state) of the container.
419
425
420
426
### <aname="configHooksPrestart" />Prestart
421
427
@@ -452,6 +458,57 @@ For example, on Linux this would happen before the `pivot_root` operation is exe
452
458
453
459
The definition of `createContainer` hooks is currently underspecified and hooks authors, should only expect from the runtime that the mount namespace and different mounts will be setup. Other operations such as cgroups and SELinux/AppArmor labels might not have been performed by the runtime.
The `sendSeccompFd` hooks MUST only be called if the seccomp policy contains `SCMP_ACT_NOTIFY`.
464
+
465
+
The `sendSeccompFd` hooks MUST be called after the [`start`](runtime.md#start) operation is called and after the seccomp policy is installed but [before the user-specified program command is executed](runtime.md#lifecycle).
466
+
The `sendSeccompFd` hooks MAY additionally be called while the container is in the [`running` state](runtime.md#runtimeState), for example during an `exec` operation.
467
+
The goal of this hook is to pass the seccomp file descriptor to a seccomp agent.
468
+
469
+
The `sendSeccompFd` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace).
470
+
The `sendSeccompFd` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace).
471
+
472
+
### <aname="seccompstate" />The Seccomp State
473
+
474
+
The seccomp state is a data structure passed via stdin to the SendSeccompFd hooks.
475
+
It includes the following properties:
476
+
477
+
***`ociVersion`** (string, REQUIRED) is version of the Open Container Initiative Runtime Specification with which the seccomp state complies.
478
+
***`phase`** (string, REQUIRED) is the phase at which the seccomp file descriptor is created.
479
+
The value MAY be one of:
480
+
481
+
*`start`: the seccomp filter is created following the [`start`](runtime.md#start) command
482
+
*`exec`: the seccomp filter is created following an `exec` command
483
+
484
+
Additional values MAY be defined by the runtime, however, they MUST be used to represent new values not defined above.
485
+
***`seccompFd`** (int, REQUIRED) is the file descriptor for Seccomp User Notification passed via process inheritance to the SendSeccompFd hooks.
486
+
***`pid`** (int, REQUIRED) is the process ID on which the seccomp filter is applied. In the `start` phase, this is the same as `state.pid`. In the `exec` phase, this is a different pid than `state.pid`.
487
+
***`pidFd`** (int, OPTIONAL) is a pidfd for the process on which the seccomp filter is applied. This file descriptor is also passed via process inheritance to the SendSeccompFd hooks.
488
+
***`state`** (map, REQUIRED) is the [state](runtime.md#state) of the container.
489
+
490
+
When serialized in JSON, the format MUST adhere to the following pattern:
The `startContainer` hooks MUST be called [before the user-specified process is executed](runtime.md#lifecycle) as part of the [`start`](runtime.md#start) operation.
@@ -485,6 +542,7 @@ See the below table for a summary of hooks and when they are called:
485
542
|`prestart` (Deprecated) | runtime | After the start operation is called but before the user-specified program command is executed. |
486
543
|`createRuntime`| runtime | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. |
487
544
|`createContainer`| container | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. |
545
+
|`sendSeccompFd`| runtime | After the start operation is called but before the user-specified program command is executed. |
488
546
|`startContainer`| container | After the start operation is called but before the user-specified program command is executed. |
489
547
|`poststart`| runtime | After the user-specified process is executed but before the start operation returns. |
490
548
|`poststop`| runtime | After the container is deleted but before the delete operation returns. |
@@ -520,6 +578,13 @@ See the below table for a summary of hooks and when they are called:
0 commit comments