Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add tun/tap to default device rules #4555

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions libcontainer/cgroups/devices/devicefilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,21 @@ block-8:
51: MovImm32 dst: r0 imm: 1
52: Exit
block-9:
// /dev/pts (c, 136, wildcard, rwm, true)
// tuntap (c, 10, 200, rwm, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment line to describe the background of this revert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean here, in the test file?

I don't think it's needed here in the test -- in here we just check that the eBPF generated is as expected, and since we've re-added tuntap, we have to modify the expected program.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it should be in spec_linux.go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added; PTAL

53: JNEImm dst: r2 off: -1 imm: 2 <block-10>
54: JNEImm dst: r4 off: -1 imm: 136 <block-10>
55: MovImm32 dst: r0 imm: 1
56: Exit
54: JNEImm dst: r4 off: -1 imm: 10 <block-10>
55: JNEImm dst: r5 off: -1 imm: 200 <block-10>
56: MovImm32 dst: r0 imm: 1
57: Exit
block-10:
57: MovImm32 dst: r0 imm: 0
58: Exit
// /dev/pts (c, 136, wildcard, rwm, true)
58: JNEImm dst: r2 off: -1 imm: 2 <block-11>
59: JNEImm dst: r4 off: -1 imm: 136 <block-11>
60: MovImm32 dst: r0 imm: 1
61: Exit
block-11:
62: MovImm32 dst: r0 imm: 0
63: Exit
`
var devices []*devices.Rule
for _, device := range specconv.AllowedDevices {
Expand Down
17 changes: 17 additions & 0 deletions libcontainer/specconv/spec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,23 @@ var AllowedDevices = []*devices.Device{
Allow: true,
},
},
// The following entry for /dev/net/tun device was there from the
// very early days of Docker, but got removed in runc 1.2.0-rc1,
// causing a number of regressions for users (see
// https://github.com/opencontainers/runc/pull/3468).
//
// Some upper-level orcherstration tools makes it either impossible
// or cumbersome to supply additional device rules, so we have to
// keep this for the sake of backward compatibility.
{
Rule: devices.Rule{
Type: devices.CharDevice,
Major: 10,
Minor: 200,
Permissions: "rwm",
Allow: true,
},
},
}

type CreateOpts struct {
Expand Down
Loading