Skip to content

Commit d12d601

Browse files
authored
Merge branch 'main' into main
2 parents 885509a + a7651e0 commit d12d601

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ task:
1212
HOME: /root
1313
CIRRUS_WORKING_DIR: /home/runc
1414
GO_VER_PREFIX: "1.24."
15-
BATS_VERSION: "v1.11.0"
15+
BATS_VERSION: "v1.11.1"
1616
RPMS: gcc git-core iptables jq glibc-static libseccomp-devel make criu fuse-sshfs container-selinux
1717
# yamllint disable rule:key-duplicates
1818
matrix:

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
https://github.com/checkpoint-restore/criu.git ~/criu
9595
(cd ~/criu && sudo make -j $(nproc) install-criu)
9696
rm -rf ~/criu
97+
criu --version
9798
9899
- name: install go ${{ matrix.go-version }}
99100
uses: actions/setup-go@v6
@@ -107,7 +108,7 @@ jobs:
107108
- name: Setup Bats and bats libs
108109
uses: bats-core/[email protected]
109110
with:
110-
bats-version: 1.9.0
111+
bats-version: 1.11.1 # Known as BATS_VERSION in other places.
111112
support-install: false
112113
assert-install: false
113114
detik-install: false

.github/workflows/validate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ jobs:
4242
- uses: golangci/golangci-lint-action@v8
4343
with:
4444
version: v2.5
45-
# Extra linters, only checking new code from a pull request.
45+
# Extra linters, only checking new code from a pull request to main.
4646
- name: lint-extra
47-
if: github.event_name == 'pull_request'
47+
if: github.event_name == 'pull_request' && github.base_ref == 'main'
4848
run: |
4949
golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1
5050

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG GO_VERSION=1.24
2-
ARG BATS_VERSION=v1.11.0
2+
ARG BATS_VERSION=v1.11.1
33
ARG LIBSECCOMP_VERSION=2.5.6
44

55
FROM golang:${GO_VERSION}-bookworm

libcontainer/process_linux.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -352,31 +352,38 @@ func (p *setnsProcess) prepareCgroupFD() (*os.File, error) {
352352
return fd, nil
353353
}
354354

355-
func (p *setnsProcess) start() (retErr error) {
356-
defer p.comm.closeParent()
355+
// startWithCgroupFD starts a process via clone3 with CLONE_INTO_CGROUP,
356+
// with a fallback if it fails (e.g. not available).
357+
func (p *setnsProcess) startWithCgroupFD() error {
358+
// Close the child side of the pipes.
359+
defer p.comm.closeChild()
357360

358361
fd, err := p.prepareCgroupFD()
359362
if err != nil {
360363
return err
361364
}
362-
363-
// Get the "before" value of oom kill count.
364-
oom, _ := p.manager.OOMKillCount()
365-
366-
err = p.startWithCPUAffinity()
367365
if fd != nil {
368-
fd.Close()
366+
defer fd.Close()
369367
}
368+
369+
err = p.startWithCPUAffinity()
370370
if err != nil && p.cmd.SysProcAttr.UseCgroupFD {
371371
logrus.Debugf("exec with CLONE_INTO_CGROUP failed: %v; retrying without", err)
372372
// SysProcAttr.CgroupFD is never used when UseCgroupFD is unset.
373373
p.cmd.SysProcAttr.UseCgroupFD = false
374374
err = p.startWithCPUAffinity()
375375
}
376376

377-
// Close the child-side of the pipes (controlled by child).
378-
p.comm.closeChild()
379-
if err != nil {
377+
return err
378+
}
379+
380+
func (p *setnsProcess) start() (retErr error) {
381+
defer p.comm.closeParent()
382+
383+
// Get the "before" value of oom kill count.
384+
oom, _ := p.manager.OOMKillCount()
385+
386+
if err := p.startWithCgroupFD(); err != nil {
380387
return fmt.Errorf("error starting setns process: %w", err)
381388
}
382389

0 commit comments

Comments
 (0)