Skip to content

Commit

Permalink
test runc exec with RLIMIT_NOFILE
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <[email protected]>
  • Loading branch information
lifubang committed May 3, 2024
1 parent b5c3d30 commit db890b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ task:
systemctl restart sshd
host_info_script: |
uname -a
ulimit -a
ulimit -aH
# -----
/usr/local/go/bin/go version
# -----
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
load helpers

function setup() {
[ $EUID -eq 0 ] && prlimit --nofile=1024:1048576 -p $$
setup_busybox
}

Expand Down Expand Up @@ -476,3 +477,21 @@ EOF
[ "$status" -eq 0 ]
[[ "${lines[0]}" == "Cpus_allowed_list: $all_cpus" ]]
}

@test "runc exec with RLIMIT_NOFILE" {
update_config '.process.capabilities.bounding = ["CAP_SYS_RESOURCE"]'
update_config '.process.rlimits = [{"type": "RLIMIT_NOFILE", "hard": 65536, "soft": 65536}]'

runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]

update_config '.process.args = ["/bin/sh", "-c", "ulimit -n"]'
[ "$status" -eq 0 ]
runc run test_ulimit
[[ "${output}" == "65536" ]]

# issue: https://github.com/opencontainers/runc/issues/4195
runc exec test_busybox /bin/sh -c "ulimit -n"
[ "$status" -eq 0 ]
[[ "${output}" == "65536" ]]
}

0 comments on commit db890b6

Please sign in to comment.