Skip to content

Commit

Permalink
ebpf cgroupdev program: fix device permission check issue
Browse files Browse the repository at this point in the history
Related to:
NVIDIA#227

Signed-off-by: Raphael <oOraph@users.noreply.github.com>
  • Loading branch information
oOraph committed Nov 7, 2023
1 parent 1eb5a30 commit 28375fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 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
// if (R3 & bpfAccess != R3 /* 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),
asm.JNE.Reg32(asm.R2, asm.R3, nextBlockSym),
)
}
if hasMajor {
Expand Down

0 comments on commit 28375fe

Please sign in to comment.