Skip to content
Draft
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
2 changes: 1 addition & 1 deletion src/nvcgo/internal/cgroup/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *cgroupv2) AddDeviceRules(cgroupPath string, rules []DeviceRule) error {
// If no existing programs found, create a new program with just our device filter.
var newProgs []*ebpf.Program
if len(oldProgs) == 0 {
oldInsts := asm.Instructions{asm.Return()}
oldInsts := asm.Instructions{asm.Mov.Imm32(asm.R0, 1), asm.Return()}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

iiuc the return here is the no-match fallthrough (default rule).
Given we are doing a whitelist filter here, the default rule should be 0 (deny).

@tariq1890 tariq1890 Jul 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I tried it with 0 initially. That led to a container create failed: open /dev/null: Operation not permitted

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that sounds incomplete whitelist. default with 1 essentially means no filter at all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that makes me wonder if a race condition exists here since it's runc/crun who should have already whitelisted the common devices such as /dev/null. so in theory we shouldn't hit this code branch.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Got it. Right now, I've been testing this on an environment that uses cri-o and crun. Let me restart this cluster with cri-o+ runc instead.


newProg, err := generateNewProgram(rules, oldInsts)
if err != nil {
Expand Down