Skip to content

Commit

Permalink
Fix device permission check when using cgroupv2
Browse files Browse the repository at this point in the history
Related to:
NVIDIA#227

Signed-off-by: Raphael Glon <18661780-oOraph@users.noreply.gitlab.com>
  • Loading branch information
oOraph authored and Raphael Glon committed Nov 15, 2023
1 parent 1eb5a30 commit 580c009
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/nvcgo/internal/cgroup/ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ func (p *program) appendDevice(dev specs.LinuxDeviceCgroup, labelPrefix string)
}
if hasAccess {
p.insts = append(p.insts,
// if (R3 & bpfAccess == 0 /* use R2 as a temp var */) goto next
asm.Mov.Reg32(asm.R2, asm.R3),
asm.And.Imm32(asm.R2, bpfAccess),
asm.JEq.Imm(asm.R2, 0, nextBlockSym),
// if (R3 & bpfAccess != R3 /* use R6 as a temp var */) goto next
asm.Mov.Reg32(asm.R6, asm.R3),
asm.And.Imm32(asm.R6, bpfAccess),
asm.JNE.Reg(asm.R6, asm.R3, nextBlockSym),
)
}
if hasMajor {
Expand Down

0 comments on commit 580c009

Please sign in to comment.