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 <lifubang@acmcoder.com>
  • Loading branch information
lifubang committed May 3, 2024
1 parent b5c3d30 commit d59fb11
Showing 1 changed file with 19 additions and 0 deletions.
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() {
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 d59fb11

Please sign in to comment.