Skip to content

Commit

Permalink
Merge pull request #3493 from cyphar/1.1-ns_last_pid
Browse files Browse the repository at this point in the history
[1.1] Allow mounting of /proc/sys/kernel/ns_last_pid
  • Loading branch information
AkihiroSuda authored May 27, 2022
2 parents 9d00472 + 51649a7 commit 131222d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions libcontainer/rootfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ func checkProcMount(rootfs, dest, source string) error {
"/proc/loadavg",
"/proc/slabinfo",
"/proc/net/dev",
"/proc/sys/kernel/ns_last_pid",
}
for _, valid := range validProcMounts {
path, err := filepath.Rel(filepath.Join(rootfs, valid), dest)
Expand Down
8 changes: 8 additions & 0 deletions libcontainer/rootfs_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ func TestCheckMountDestFalsePositive(t *testing.T) {
}
}

func TestCheckMountDestNsLastPid(t *testing.T) {
dest := "/rootfs/proc/sys/kernel/ns_last_pid"
err := checkProcMount("/rootfs", dest, "/proc")
if err != nil {
t.Fatal("/proc/sys/kernel/ns_last_pid should not return an error")
}
}

func TestNeedsSetupDev(t *testing.T) {
config := &configs.Config{
Mounts: []*configs.Mount{
Expand Down

0 comments on commit 131222d

Please sign in to comment.