Skip to content

Commit f329913

Browse files
committed
features-linux: Expose idmap information
High level container runtimes sometimes need to know if the OCI runtime supports idmap mounts or not, as the OCI runtime silently ignores unknown fields. This means that if it doesn't support idmap mounts, a container with userns will be started, without idmap mounts, and the files created on the volumes will have a "garbage" owner/group. Furthermore, as the userns mapping is not guaranteed to be stable over time, it will be completely unusable. Let's expose idmap support in the features subcommand, so high level container runtimes use the feature safely. Signed-off-by: Rodrigo Campos <[email protected]>
1 parent e8c4134 commit f329913

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

features-linux.md

+19
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,22 @@ Irrelevant to the availability of Intel RDT on the host operating system.
209209
"enabled": true
210210
}
211211
```
212+
213+
## <a name="linuxFeaturesMountExtensions" />MountExtensions
214+
215+
**`mountExtensions`** (object, OPTIONAL) represents whether the runtime supports certain mount features, irrespective of the availability of the features on the host operating system.
216+
217+
* **`idmap`** (object, OPTIONAL) represents whether the runtime supports idmap mounts using the `uidMappings` and `gidMappings` properties of the mount.
218+
* **`enabled`** (bool, OPTIONAL) represents whether the runtime parses and attempts to use the `uidMappings` and `gidMappings` properties of mounts if provided.
219+
Note that it is possible for runtimes to have partial implementations of id-mapped mounts support (such as only allowing mounts which have mappings matching the container's user namespace, or only allowing the id-mapped bind-mounts).
220+
In such cases, runtimes MUST still set this value to `true`, to indicate that the runtime recognises the `uidMappings` and `gidMappings` properties.
221+
222+
### Example
223+
224+
```json
225+
"mountExtensions": {
226+
"idmap":{
227+
"enabled": true
228+
}
229+
}
230+
```

schema/features-linux.json

+13
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@
9797
"type": "boolean"
9898
}
9999
}
100+
},
101+
"mountExtensions": {
102+
"type": "object",
103+
"properties": {
104+
"idmap": {
105+
"type": "object",
106+
"properties": {
107+
"enabled": {
108+
"type": "boolean"
109+
}
110+
}
111+
}
112+
}
100113
}
101114
}
102115
}

specs-go/features/features.go

+19-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ type Linux struct {
3636
// Nil value means "unknown", not "no support for any capability".
3737
Capabilities []string `json:"capabilities,omitempty"`
3838

39-
Cgroup *Cgroup `json:"cgroup,omitempty"`
40-
Seccomp *Seccomp `json:"seccomp,omitempty"`
41-
Apparmor *Apparmor `json:"apparmor,omitempty"`
42-
Selinux *Selinux `json:"selinux,omitempty"`
43-
IntelRdt *IntelRdt `json:"intelRdt,omitempty"`
39+
Cgroup *Cgroup `json:"cgroup,omitempty"`
40+
Seccomp *Seccomp `json:"seccomp,omitempty"`
41+
Apparmor *Apparmor `json:"apparmor,omitempty"`
42+
Selinux *Selinux `json:"selinux,omitempty"`
43+
IntelRdt *IntelRdt `json:"intelRdt,omitempty"`
44+
MountExtensions *MountExtensions `json:"mountExtensions,omitempty"`
4445
}
4546

4647
// Cgroup represents the "cgroup" field.
@@ -123,3 +124,16 @@ type IntelRdt struct {
123124
// Nil value means "unknown", not "false".
124125
Enabled *bool `json:"enabled,omitempty"`
125126
}
127+
128+
// MountExtensions represents the "mountExtensions" field.
129+
type MountExtensions struct {
130+
// IDMap represents the status of idmap mounts support.
131+
IDMap *IDMap `json:"idmap,omitempty"`
132+
}
133+
134+
type IDMap struct {
135+
// Enabled represents whether idmap mounts supports is compiled in.
136+
// Unrelated to whether the host supports it or not.
137+
// Nil value means "unknown", not "false".
138+
Enabled *bool `json:"enabled,omitempty"`
139+
}

0 commit comments

Comments
 (0)