Repository navigation
cri: should not follow log file - #14293
Conversation
There was a problem hiding this comment.
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_NOFOLLOWwhen 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.
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]>
75002fd to
4b0a074
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
also no idea on the windows side what the correct approach is, so fine for a follow-up IMO
|
/cherry-pick release/2.4 |
|
@samuelkarp: new pull request created: #14299 DetailsIn response to this:
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: new pull request created: #14300 DetailsIn response to this:
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: new pull request created: #14301 DetailsIn response to this:
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: new pull request created: #14302 DetailsIn response to this:
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. |

Test it in local kubernetes cluster and it passes.