Proto commits in google/nsjail

These commits are when the Protocol Buffers files have changed: (only the last 100 relevant commits are shown)

Commit:86679ca
Author:Robert Swiecki

config.proto: reflow field numbering

The documentation is generated from this commit.

Commit:29f0a5b
Author:Robert Swiecki

Makefile: indent .proto with the same cmd as *.cc *.h

Commit:c7c0adf
Author:Robert Swiecki

config.prot: document disable_tsc

Commit:12df56b
Author:Andrew Haberlandt
Committer:Andrew Haberlandt

Setup cgroup.subtree_control controllers when necessary in cgroupsv2 This commit adds extra setup when cgroupsv2 is enabled. In particular, we make sure that the root namespace has setup cgroup.subtree_control with the controllers we need. If the necessary controller are not listed, we have to move all processes out of the root namespace before we can change this (the 'no internal processes' rule: https://unix.stackexchange.com/a/713343). Currently we only handle the case where the nsjail process is the only process in the cgroup. It seems like this would be relatively rare, but since nsjail is frequently the root process in a Docker container (e.g. for hosting CTF challenges), I think this case is common enough to make it worth implementing. This also adds `--detect_cgroupv2`, which will attempt to detect whether `--cgroupv2_mount` is a valid cgroupv2 mount, and if so it will set `use_cgroupv2`. This is useful in containerized environments where you may not know the kernel version ahead of time. References: https://github.com/redpwn/jail/blob/master/internal/cgroup/cgroup2.go

Commit:df21a97
Author:Patrick Steinhardt
Committer:Patrick Steinhardt

nsjail: Optionally forward fatal signals Currently, we always kill children by sending them a SIGKILL signal in case we've got a fatal signal. This is rather inflexible and forbids some usecases where e.g. child process listen for specific signals to shut down gracefully. Add a new command configuration `--forward_signals` that allows the user to opt-in to forwarding fatal signals to the child process.

Commit:16b4416
Author:MichaƂ Kowalczyk

Add `disable_tsc` option Implemented via prctl(PR_SET_TSC, PR_TSC_SIGSEGV, ...).

Commit:bf93e8a
Author:Philip
Committer:happyCoder92

cgroup2: use cgroup_mem_swap_max and cgroup_mem_memsw_max

Commit:29a5560
Author:Johan Kartiwa
Committer:happyCoder92

Add support for setting cgroup memory.memsw.limit_in_bytes

Commit:d6b9357
Author:Robert Swiecki

config.proto: renumerate fields

Commit:8e13a76
Author:Wiktor Garbacz

Fix duplicate field number

Commit:95e112c
Author:Wiktor Garbacz

Fix formatting

Commit:4136dd5
Author:Wiktor Garbacz

Merge branch 'use_switchroot'

Commit:7aace9b
Author:Eli Zrihen

rtprio, msgqueue - defaulting to 'soft'

Commit:b83d6f7
Author:Eli Zrihen

Renaming use_switchroot option with no_pivotroot

Commit:9f4b4f4
Author:Eli Zrihen

Consistentency with RLIMIT_* constant name

Commit:0f903ba
Author:Eli Zrihen

Added rt, memlock & msgq limits

Commit:dab1713
Author:Eli Zrihen

Added use_switchroot option

Commit:5c8b383
Author:Eli Zrihen

MACVLAN modes support

Commit:d1f332b
Author:Robert Swiecki

Enable support for clone3() and for CLONE_NEWTIME

Commit:056809e
Author:Robert Swiecki

Initial support for CLONE_NEWTIME

Commit:32f2287
Author:Philip Papurt

net: add support for max_conns

Commit:7ca0657
Author:Robert Swiecki

config.proto: make indent

Commit:0a5a529
Author:Robert Swiecki

config.proto: renumerate config fields

Commit:5d103e5
Author:Disconnect3d
Committer:GitHub

Fixes #146: cgroups_mem_max unit in config.proto This commit fixes the incorrect cgroups_mem_max unit described in a config.proto comment. We do not perform any calculations on this value and we don't specify the values unit (k/M/G) when writing to memory cgroup controller files, so the value is specified in bytes.

Commit:a2d5b07
Author:Robert Swiecki

config: remove deprecated config options

Commit:7f9ed1b
Author:Disconnect3d
Committer:GitHub

Fix default rlimit_stack value The default `rlimit_stack` value was set to 1048576. However, this value is in MiB and so is later multiplied by 1024*1024 in https://github.com/google/nsjail/blob/b3d544d155f5d1543dce1bd3e5327ef41583815a/config.cc#L161-L162 and it ends up as a limit of 1 TB for the stack size. This PR changes it to 8 MB which is a more sane default or, at least I took it from my virtual machine's ulimits: ``` $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 31175 max locked memory (kbytes, -l) 16384 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 31175 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited ```

Commit:b3d544d
Author:Robert Swiecki

config: simplify log/logfd setting

Commit:0bc5750
Author:Lukasz Milewski

Fix typo in config.proto: s/lofs/logs/

Commit:e2c5c59
Author:Robert Swiecki

standardize on envar vs envvar

Commit:fe762a3
Author:Robert Swiecki

config.proto: move disable_rl higher

Commit:86293b0
Author:Jay Lees

Add flag to disable rlimits

Commit:b120acd
Author:Robert Swiecki

make indent depend

Commit:08f62b6
Author:Jay Lees

[cgroup-v2] support cgroup v2 for mem, cpu and pids

Commit:494a5f6
Author:Robert Swiecki

Add nice_level to cmd-line/config options

Commit:317555b
Author:Robert Swiecki

user: don't fail on setgroup() if not groups were specified

Commit:1f022a2
Author:Robert Swiecki

config.proto: Exe.path is required

Commit:2b1bad6
Author:Robert Swiecki

cmdline: allow to override config cmdline with cmdline cmdline

Commit:9fe225d
Author:Robert Swiecki

mnt: use /run/usr/<uid> first when mounting dirs

Commit:8059747
Author:Robert Swiecki

subproc: save/restore errno when printing error message twice

Commit:9b8d91b
Author:Robert Swiecki

incrase the default RLIMIT_AS limit to 4GiB. 512MiB is not enough for many payloas, and cgroups should be used for memory limiting anyway

Commit:432c38a
Author:Robert Swiecki

cmdline: clarify cgroup_cpu_ms_per_sec

Commit:ddd515e
Author:Robert Swiecki

config.proto: renumber the fields

Commit:625e36f
Author:Robert Swiecki

config.proto: comments

Commit:c7dd18c
Author:Robert Swiecki

cmdline: add ability to passthrough current envvars

Commit:7fe87b4
Author:Wiktor Garbacz

code formatting

Commit:303f7ab
Author:Micky Del Favero

Remove duplicate code Signed-off-by: Micky Del Favero <micky@BeeCloudy.net>

Commit:233a729
Author:Micky Del Favero

Added --macvlan_vs_ma switch to be able to set macvlan's mac-address. Signed-off-by: Micky Del Favero <micky@BeeCloudy.net>

Commit:760350d
Author:Disconnect3d
Committer:GitHub

Update config.proto

Commit:755626f
Author:Disconnect3d
Committer:GitHub

Update config.proto

Commit:ba14675
Author:Wiktor Garbacz
Committer:Wiktor Garbacz

mnt: added nosuid/nodev/noexec flags to config Closes #70

Commit:272a854
Author:Robert Swiecki

config: Implement --stderr_to_null

Commit:1114815
Author:Robert Swiecki

config: add --iface_own to the proto config

Commit:48e8634
Author:Robert Swiecki

config: add support for seccomp_log

Commit:0e4f623
Author:Robert Swiecki

config.proto: deprecated --chroot and friends

Commit:5a35f00
Author:Robert Swiecki

mnt: move mnt_t to std::string

Commit:3ee825c
Author:Robert Swiecki

cgroups: add support for CPU cgroup

Commit:e2f96f6
Author:Robert Swiecki

config.proto: comment on skip_setsid

Commit:3734b88
Author:Robert Swiecki

cmdline/config: make --enable_clone_newcgroup obsolete by enabling CLONE_NEWCGROUP by default. This can be disabled by flags/config

Commit:659bbd1
Author:Robert Swiecki

config.proto: reflow field numbering

Commit:082b382
Author:Robert Swiecki

Makefile/indent: add clang-format for proto

Commit:315b383
Author:YAMAMOTO Masaya

Support cgroup net_cls subsystem

Commit:9c2f19b
Author:Robert Swiecki

cmdline: add option --execute_fd and support for it, in order to use execveat()

Commit:c56ec49
Author:Robert Swiecki

config.proto: reflow numbering of fields

Commit:a5c3a18
Author:Robert Swiecki

config.proto: comments

Commit:25c6272
Author:Robert Swiecki

config: indent

Commit:dbc6fab
Author:Robert Swiecki

config: allow to use soft/hard/inf limits for rlimits

Commit:88703c9
Author:Robert Swiecki

config: make defaults work correctly

Commit:374f6cc
Author:Robert Swiecki
Committer:Robert Swiecki

config: Initial work on converting config.c to c++ protobuf lib config: Initial work on converting config.c to c++ protobuf lib #2 config: Initial work on converting config.c to c++ protobuf lib #3 config: Initial work on converting config.c to c++ protobuf lib #4 config: Initial work on converting config.c to c++ protobuf lib #5 config: Initial work on converting config.c to c++ protobuf lib #6

Commit:7226893
Author:Robert Swiecki

config: bind caps

Commit:39ce9d2
Author:Robert Swiecki

caps: just local caps

Commit:54a5223
Author:Robert Swiecki

caps: simplify capability operations

Commit:e86598c
Author:Robert Swiecki

config.proto: reflow field numbering to make it sequential

Commit:e4aba73
Author:Robert Swiecki

Allow to create symlinks

Commit:69783dc
Author:Robert Swiecki

config: max_cpu_num -> max_cpus

Commit:ceaed43
Author:Robert Swiecki

config: implement max_cpu_num in PB

Commit:f203669
Author:Robert Swiecki

config: give ability to override argv[0]

Commit:3e30c8e
Author:Robert Swiecki

config.proto: clang-format

Commit:63e4059
Author:Robert Swiecki

Slight fixes to log_fd

Commit:c55dc8c
Author:Tony Young
Committer:Tony Young

Add an extra log_fd argument to specify an FD to log to. In some situations, setting --log to /proc/self/fd/# is not sufficient to log out to a different FD. For instance, if a master process passes its stderr to the child nsjail process as fd 3, the nsjail child may not always be able to log to /proc/self/fd/3, e.g. if the master process is running under systemd, whose /proc/self/fd/2 is actually a socket and not a pipe. However, having nsjail write to fd 3 directly is fine and there's no other good way to handle this situation.

Commit:0271586
Author:Robert Swiecki

Get rid of pivot_root_only - achieve the same in different way

Commit:9db01ec
Author:Robert Swiecki

config: implement keep caps

Commit:7b2fc9c
Author:Robert Swiecki

add configs/firefox-with-cloned-net.cfg

Commit:a2bbe66
Author:Robert Swiecki

config: switch is_ro to rw

Commit:e68acd6
Author:Robert Swiecki

Support envvars on mount path definitions

Commit:b712afa
Author:Robert Swiecki

config: add name and description

Commit:7158819
Author:Robert Swiecki

config: smaller fixes (logging/comments)

Commit:840f39b
Author:Robert Swiecki

config: indent

Commit:ec50c13
Author:Robert Swiecki

mount: nonmandatory mounts

Commit:f0cb243
Author:Robert Swiecki

config: allow skipping arguments in mount points

Commit:d7a805e
Author:Robert Swiecki

config: support for envvars

Commit:fc6680d
Author:Robert Swiecki

clang-format on config.proto

Commit:1788ac7
Author:Robert Swiecki

config: description

Commit:4dadc15
Author:Robert Swiecki

config: description

Commit:33f597a
Author:Robert Swiecki

config: description

Commit:e11548b
Author:Robert Swiecki

config: description

Commit:03e8578
Author:Robert Swiecki

config: executable in config

Commit:4ba9555
Author:Robert Swiecki

config: presumably all options

Commit:0acd615
Author:Robert Swiecki

config: support seccomp filters

Commit:b5e37a6
Author:Robert Swiecki

config: support mounts

Commit:20633b1
Author:Robert Swiecki

config: compact-ize uid/gid map options