Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions contrib/cmd/memfd-bind/memfd-bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
* limitations under the License.
*/

// memfd-bind is a command-line tool to construct a persistent
// sealed-memfd-copy of a binary, to allow administrators to amortise the cost
// of memfd cloning for runc. runc will not make its own copy of the binary if
// it detects that the binary is already a sealed-memfd-copy.
//
// Usage of this tool has a lot of caveats -- see this package's README for
// more details on what restrictions apply when using this tool.
//
// Deprecated: runc 1.2 and later use a different mechanism for protecting the
// runc binary that obviates the need for this tool. Unless you are on an old
// kernel or need to use an older runc version, this tool is no longer needed.
package main

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/linux/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Package linux provides minimal wrappers around Linux system calls, primarily
// to provide support for automatic EINTR-retries.
package linux
3 changes: 3 additions & 0 deletions libcontainer/apparmor/apparmor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Package apparmor provides a minimal set of helpers to configure the AppArmor
// profile of the current process, effectively acting as a very stripped-down
// version of libapparmor.
package apparmor

import "errors"
Expand Down
1 change: 1 addition & 0 deletions libcontainer/capabilities/capabilities.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//go:build linux

// Package capabilities provides helpers for managing Linux capabilities.
package capabilities

import (
Expand Down
4 changes: 4 additions & 0 deletions libcontainer/devices/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Package devices provides some helper functions for constructing device
// configurations for runc. These are exclusively used by higher-level runtimes
// that need to configure runc's device list based on existing devices.
package devices
3 changes: 3 additions & 0 deletions libcontainer/exeseal/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Package exeseal provides mechanisms for sealing /proc/self/exe and thus
// protecting the runc binary against CVE-2019-5736-style attacks.
package exeseal
2 changes: 1 addition & 1 deletion libcontainer/integration/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// integration is used for integration testing of libcontainer
// Package integration is used for integration testing of libcontainer.
package integration
2 changes: 2 additions & 0 deletions libcontainer/internal/userns/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package userns provides helpers for interacting with Linux user namespaces.
package userns
1 change: 1 addition & 0 deletions libcontainer/keys/keyctl.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package keys provides helpers for Linux keyrings.
package keys

import (
Expand Down
2 changes: 2 additions & 0 deletions libcontainer/logs/logs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package logs provides helpers for logging used within runc (specifically for
// forwarding logs from "runc init" to the main runc process).
package logs

import (
Expand Down
5 changes: 5 additions & 0 deletions libcontainer/nsenter/nsenter.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//go:build linux && !gccgo

// Package nsenter implements the namespace creation and joining logic of runc.
//
// This package registers a special CGo constructor that will run before the Go
// runtime boots in order to provide a mechanism for runc to operate on
// namespaces that require single-threaded program execution to work.
package nsenter

/*
Expand Down
7 changes: 3 additions & 4 deletions libcontainer/nsenter/test/escape.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Package escapetest is part of the escape_json_string unit test. It is in a
// separate package so cgo can be used together with go test. Do not use this
// package.
package escapetest

// This file is part of escape_json_string unit test.
// It is in a separate package so cgo can be used together
// with go test.

// #include <stdlib.h>
// extern char *escape_json_string(char *str);
// #cgo CFLAGS: -DESCAPE_TEST=1
Expand Down
3 changes: 3 additions & 0 deletions libcontainer/seccomp/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Package seccomp provides runc-specific helpers for loading and managing
// seccomp profiles.
package seccomp
3 changes: 3 additions & 0 deletions libcontainer/seccomp/patchbpf/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Package patchbpf provides utilities for patching libseccomp-generated cBPF
// programs in order to handle unknown syscalls and ENOSYS more gracefully.
package patchbpf
2 changes: 2 additions & 0 deletions libcontainer/system/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package system provides wrappers for Linux system operations.
package system
2 changes: 2 additions & 0 deletions libcontainer/system/kernelversion/kernel_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
https://github.com/containerd/containerd/blob/v1.7.5/contrib/seccomp/kernelversion/kernel_linux.go
*/

// Package kernelversion provides a method to check whether the running kernel
// version is at least a minimum kernel version.
package kernelversion

import (
Expand Down
2 changes: 2 additions & 0 deletions libcontainer/userns/userns_deprecated.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package userns provides tools for dealing with user namespaces.
//
// Deprecated: use github.com/moby/sys/userns
package userns
Comment on lines +1 to 4
Copy link
Contributor

Choose a reason for hiding this comment

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

This package was deprecated in v1.2, maybe it's time to remove it (for v1.4).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll open a separate PR for it.


Expand Down
1 change: 1 addition & 0 deletions libcontainer/utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package utils provides general helper utilities used in libcontainer.
package utils

import (
Expand Down
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// runc is a command line client for running applications packaged according to
// the Open Container Initiative (OCI) format and is a compliant implementation
// of the Open Container Initiative specification.
package main

import (
Expand Down Expand Up @@ -55,8 +58,8 @@ const (
usage = `Open Container Initiative runtime

runc is a command line client for running applications packaged according to
the Open Container Initiative (OCI) format and is a compliant implementation of the
Open Container Initiative specification.
the Open Container Initiative (OCI) format and is a compliant implementation of
the Open Container Initiative specification.

runc integrates well with existing process supervisors to provide a production
container runtime environment for applications. It can be used with your
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/fs-idmap/fs-idmap.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// fs-idmap is a command-line tool to detect if a filesystem associated with a
// given path supports id-mapped mounts.
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand Down
12 changes: 7 additions & 5 deletions tests/cmd/key_label/key_label.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// key_label is a simple program to print the current session keyring name and
// its security label, to be run inside container (see selinux.bats). Can be
// thought of poor man's keyctl. Written in Go so we can have a static binary
// (a program in C would require libkeyutils which is usually provided only as
// a dynamic library).
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand All @@ -7,11 +14,6 @@ import (
"golang.org/x/sys/unix"
)

// This is a simple program to print the current session keyring name and its
// security label, to be run inside container (see selinux.bats). Can be
// thought of poor man's keyctl. Written in Go so we can have a static binary
// (a program in C would require libkeyutils which is usually provided only as
// a dynamic library).
func main() {
id, err := unix.KeyctlGetKeyringID(unix.KEY_SPEC_SESSION_KEYRING, false)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/pidfd-kill/pidfd-kill.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// pidfd-kill is a command-line tool to send signals to processes using pidfds
// passed through a unix socket.
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand Down
8 changes: 8 additions & 0 deletions tests/cmd/recvtty/recvtty.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
* limitations under the License.
*/

// recvtty is a sample implementation of the consumer side of the
// --console-socket interface for runc. It supports forwarding console events
// to and from the container process, as well as acting like a /dev/null
// black-hole.
//
// This tool is only really intended to be used within runc's integration
// tests, but can be used as an example of how the --console-socket protocol
// works.
package main

import (
Expand Down
5 changes: 5 additions & 0 deletions tests/cmd/remap-rootfs/remap-rootfs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// remap-rootfs is a command-line tool to remap the ownership of an OCI
// bundle's rootfs to match the user namespace id-mapping of the bundle's
// config.json.
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/sd-helper/helper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// sd-helper is a command-line tool to provide some very minimal helpers to
// communicate with systemd.
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand Down
5 changes: 5 additions & 0 deletions tests/cmd/seccompagent/seccompagent.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//go:build linux && seccomp

// seccompagent is an example implementation of a seccomp-agent for the seccomp
// user notification feature. It intercepts a handful of system calls and
// emulates them.
//
// This tool is only intended to be used within runc's integration tests.
package main

import (
Expand Down
2 changes: 2 additions & 0 deletions types/events.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package types defines the types used for the cgroup-related events APIs
// provided by "runc events".
package types

import (
Expand Down