Skip to content

Commit 2ce40b6

Browse files
committed
Remove tun/tap from the default device rules
Looking through git blame, this was added by commit 9fac183 aka "Initial commit of runc binary", most probably by mistake. Obviously, a container should not have access to tun/tap device, unless it is explicitly specified in configuration. Now, removing this might create a compatibility issue, but I see no other choice. Aside from the obvious misconfiguration, this should also fix the annoying > Apr 26 03:46:56 foo.bar systemd[1]: Couldn't stat device /dev/char/10:200: No such file or directory messages from systemd on every container start, when runc uses systemd cgroup driver, and the system runs an old (< v240) version of systemd (the message was presumably eliminated by [1]). [1] systemd/systemd@d5aecba Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent da6f3b0 commit 2ce40b6

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

libcontainer/cgroups/ebpf/devicefilter/devicefilter_test.go

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

libcontainer/specconv/spec_linux.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,6 @@ var AllowedDevices = []*devices.Device{
302302
Allow: true,
303303
},
304304
},
305-
// tuntap
306-
{
307-
Rule: devices.Rule{
308-
Type: devices.CharDevice,
309-
Major: 10,
310-
Minor: 200,
311-
Permissions: "rwm",
312-
Allow: true,
313-
},
314-
},
315305
}
316306

317307
type CreateOpts struct {

0 commit comments

Comments
 (0)