Skip to content

Commit f30a9f4

Browse files
committed
Merge branch 'dev/fix_ebpf_permissions' into 'main'
Fix device permission check when using cgroupv2 See merge request nvidia/container-toolkit/libnvidia-container!236
2 parents 1eb5a30 + dcb0ac1 commit f30a9f4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# NVIDIA Container Toolkit Library and CLI Changelog
22

3+
* Fix device permission check when using cgroupv2 (fixes #227)
4+
35
## 1.14.1
46
* Use libelf.so on RPM-based systems due to removed mageia repositories hosting pmake and bmake.
57

src/nvcgo/internal/cgroup/ebpf.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ func (p *program) appendDevice(dev specs.LinuxDeviceCgroup, labelPrefix string)
136136
}
137137
if hasAccess {
138138
p.insts = append(p.insts,
139-
// if (R3 & bpfAccess == 0 /* use R2 as a temp var */) goto next
140-
asm.Mov.Reg32(asm.R2, asm.R3),
141-
asm.And.Imm32(asm.R2, bpfAccess),
142-
asm.JEq.Imm(asm.R2, 0, nextBlockSym),
139+
// if (R3 & bpfAccess != R3 /* use R6 as a temp var */) goto next
140+
asm.Mov.Reg32(asm.R6, asm.R3),
141+
asm.And.Imm32(asm.R6, bpfAccess),
142+
asm.JNE.Reg(asm.R6, asm.R3, nextBlockSym),
143143
)
144144
}
145145
if hasMajor {

0 commit comments

Comments
 (0)