Skip to content

Commit 394f4c3

Browse files
committed
Re-add tun/tap to default device rules
Since v1.2.0 was released, a number of users complained that the removal of tun/tap device access from the default device ruleset is causing a regression in their workloads. Additionally, it seems that some upper-level orchestration tools (Docker Swarm, Kubernetes) makes it either impossible or cumbersome to supply additional device rules. While it's probably not quite right to have /dev/net/tun in a default device list, it was there from the very beginning, and users rely on it. Let's keep it there for the sake of backward compatibility. This reverts commit 2ce40b6. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 28b65d3 commit 394f4c3

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

libcontainer/cgroups/devices/devicefilter_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,21 @@ block-8:
120120
51: MovImm32 dst: r0 imm: 1
121121
52: Exit
122122
block-9:
123-
// /dev/pts (c, 136, wildcard, rwm, true)
123+
// tuntap (c, 10, 200, rwm, true)
124124
53: JNEImm dst: r2 off: -1 imm: 2 <block-10>
125-
54: JNEImm dst: r4 off: -1 imm: 136 <block-10>
126-
55: MovImm32 dst: r0 imm: 1
127-
56: Exit
125+
54: JNEImm dst: r4 off: -1 imm: 10 <block-10>
126+
55: JNEImm dst: r5 off: -1 imm: 200 <block-10>
127+
56: MovImm32 dst: r0 imm: 1
128+
57: Exit
128129
block-10:
129-
57: MovImm32 dst: r0 imm: 0
130-
58: Exit
130+
// /dev/pts (c, 136, wildcard, rwm, true)
131+
58: JNEImm dst: r2 off: -1 imm: 2 <block-11>
132+
59: JNEImm dst: r4 off: -1 imm: 136 <block-11>
133+
60: MovImm32 dst: r0 imm: 1
134+
61: Exit
135+
block-11:
136+
62: MovImm32 dst: r0 imm: 0
137+
63: Exit
131138
`
132139
var devices []*devices.Rule
133140
for _, device := range specconv.AllowedDevices {

libcontainer/specconv/spec_linux.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,23 @@ var AllowedDevices = []*devices.Device{
315315
Allow: true,
316316
},
317317
},
318+
// The following entry for /dev/net/tun device was there from the
319+
// very early days of Docker, but got removed in runc 1.2.0-rc1,
320+
// causing a number of regressions for users (see
321+
// https://github.com/opencontainers/runc/pull/3468).
322+
//
323+
// Some upper-level orcherstration tools makes it either impossible
324+
// or cumbersome to supply additional device rules, so we have to
325+
// keep this for the sake of backward compatibility.
326+
{
327+
Rule: devices.Rule{
328+
Type: devices.CharDevice,
329+
Major: 10,
330+
Minor: 200,
331+
Permissions: "rwm",
332+
Allow: true,
333+
},
334+
},
318335
}
319336

320337
type CreateOpts struct {

0 commit comments

Comments
 (0)