Skip to content

Commit a5ed2b7

Browse files
committed
update docs with details about resource limits
Signed-off-by: Luminita Voicu <[email protected]>
1 parent e3aa07a commit a5ed2b7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
connections on the guest.
2525
- Added `GET` request on `/vm/config` that provides full microVM configuration
2626
as a JSON HTTP response.
27+
- Added `--resource-limit` flag to jailer to limit resources such as: number of
28+
file descriptors allowed at a time (with a default value of 2048) and maximum
29+
size of files created by the process.
2730

2831
### Changed
2932

docs/jailer.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jailer --id <id> \
1818
[--cgroup <cgroup>]
1919
[--chroot-base-dir <chroot_base>]
2020
[--netns <netns>]
21+
[--resource-limit <resource=value>]
2122
[--daemonize]
2223
[--new-pid-ns]
2324
[--...extra arguments for Firecracker]
@@ -44,6 +45,21 @@ jailer --id <id> \
4445
default is `/srv/jailer`.
4546
- `netns` represents the path to a network namespace handle. If present, the
4647
jailer will use this to join the associated network namespace.
48+
- For extra security and control over resource usage, `resource-limit` can be
49+
used to set bounds to the process resources. The `--resource-limit` argument
50+
must follow this format: `<resource>=<value>` (e.g `no-file=1024`) and can be
51+
used multiple times to set multiple bounds. Current available resources that
52+
can be limited using this argument are:
53+
- `fsize`: The maximum size in bytes for files created by the process.
54+
- `no-file`: Specifies a value one greater than the maximum file descriptor
55+
number that can be opened by this process.
56+
57+
Here is an example on how to set multiple resource limits using this argument:
58+
59+
```bash
60+
--resource-limit fsize=250000000 --resource-limit no-file=1024
61+
```
62+
4763
- When present, the `--daemonize` flag causes the jailer to cal `setsid()` and
4864
redirect all three standard I/O file descriptors to `/dev/null`.
4965
- When present, the `--new-pid-ns` flag causes the jailer to `fork()` and then
@@ -73,6 +89,10 @@ After starting, the Jailer goes through the following operations:
7389
exists (it should not, since `id` is supposed to be unique).
7490
- Copy `exec_file` to
7591
`<chroot_base>/<exec_file_name>/<id>/root/<exec_file_name>`.
92+
- Set resource bounds for current process and its children through
93+
`--resource-limit` argument, by calling `setrlimit()` system call with the
94+
specific resource argument. If no limits are provided, the jailer bounds
95+
`no-file` to a maximum default value of 2048.
7696
- Create the `cgroup` sub-folders. At the moment, the jailer uses `cgroup v1`.
7797
On most systems, this is mounted by default in `/sys/fs/cgroup`
7898
(should be mounted by the user otherwise). The jailer will parse

0 commit comments

Comments
 (0)