Skip to content

cri: should not follow log file - #14293

Merged
samuelkarp merged 1 commit into
containerd:mainfrom
fuweid:no-follow-on-log
Oct 6, 2026
Merged

samuelkarp merged 1 commit into
containerd:mainfrom
fuweid:no-follow-on-log

Conversation

@fuweid

@fuweid fuweid commented Oct 6, 2026

Copy link
Copy Markdown
Member

Test it in local kubernetes cluster and it passes.

apiVersion: v1
kind: Pod
metadata:
  name: reopen-log-test
  labels:
    app: reopen-log-test
spec:
  restartPolicy: Never
  terminationGracePeriodSeconds: 0
  containers:
    - name: logger
      image: busybox:1.36
      imagePullPolicy: IfNotPresent
      command:
        - /bin/sh
        - -c
        - |
          while true; do
            dd if=/dev/zero bs=1024 count=1024 2>/dev/null | tr '\000' x
            printf '\n'
            sleep 0.5
          done

Copilot AI balanced review requested due to automatic review settings October 6, 2026 01:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused Linux change is correct and directly covered by an appropriate regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Prevents Linux CRI log opening from following symbolic links.

Changes:

  • Adds O_NOFOLLOW when opening container logs.
  • Adds coverage for regular files and symlink rejection.
File Description
internal/​cri/​server/​helpers_linux.go Opens logs without following final-component symlinks.
internal/​cri/​server/​helpers_linux_test.go Tests successful creation and ELOOP for symlinks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@samuelkarp samuelkarp added cherry-pick/2.0.x Change to be cherry picked to release/2.0 branch cherry-pick/2.2.x Change to be cherry picked to release/2.2 branch cherry-pick/2.3.x Change to be cherry picked to release/2.3 cherry-pick/2.4.x Change to be cherry picked to release/2.4 labels Oct 6, 2026
Comment thread internal/cri/server/helpers_linux.go Resolved
Test it in local kubernetes cluster and it passes.

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: reopen-log-test
  labels:
    app: reopen-log-test
spec:
  restartPolicy: Never
  terminationGracePeriodSeconds: 0
  containers:
    - name: logger
      image: busybox:1.36
      imagePullPolicy: IfNotPresent
      command:
        - /bin/sh
        - -c
        - |
          while true; do
            dd if=/dev/zero bs=1024 count=1024 2>/dev/null | tr '\000' x
            printf '\n'
            sleep 0.5
          done
```

Signed-off-by: Wei Fu <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 14:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Windows CRI implementation still follows linked log paths.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Comment thread internal/cri/server/helpers_linux.go Resolved

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

also no idea on the windows side what the correct approach is, so fine for a follow-up IMO

@samuelkarp
samuelkarp added this pull request to the merge queue Oct 6, 2026
Merged via the queue into containerd:main with commit e851c87 Oct 6, 2026
89 of 90 checks passed
@samuelkarp

Copy link
Copy Markdown
Member

/cherry-pick release/2.4
/cherry-pick release/2.3
/cherry-pick release/2.2
/cherry-pick release/2.0

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@samuelkarp: new pull request created: #14299

Details

In response to this:

/cherry-pick release/2.4
/cherry-pick release/2.3
/cherry-pick release/2.2
/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@samuelkarp: new pull request created: #14300

Details

In response to this:

/cherry-pick release/2.4
/cherry-pick release/2.3
/cherry-pick release/2.2
/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@samuelkarp: new pull request created: #14301

Details

In response to this:

/cherry-pick release/2.4
/cherry-pick release/2.3
/cherry-pick release/2.2
/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@samuelkarp: new pull request created: #14302

Details

In response to this:

/cherry-pick release/2.4
/cherry-pick release/2.3
/cherry-pick release/2.2
/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@samuelkarp samuelkarp added cherry-picked/2.4.x PR commits are cherry picked into release/2.4 branch cherry-picked/2.2.x PR commits are cherry-picked into release/2.2 branch cherry-picked/2.0.x PR commits are cherry picked into the release/2.0 branch cherry-picked/2.3.x PR commits are cherry picked into release/2.3 branch and removed cherry-pick/2.4.x Change to be cherry picked to release/2.4 cherry-pick/2.2.x Change to be cherry picked to release/2.2 branch cherry-pick/2.0.x Change to be cherry picked to release/2.0 branch cherry-pick/2.3.x Change to be cherry picked to release/2.3 labels Oct 6, 2026
@fuweid
fuweid deleted the no-follow-on-log branch October 8, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/2.0.x PR commits are cherry picked into the release/2.0 branch cherry-picked/2.2.x PR commits are cherry-picked into release/2.2 branch cherry-picked/2.3.x PR commits are cherry picked into release/2.3 branch cherry-picked/2.4.x PR commits are cherry picked into release/2.4 branch size/M

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants