Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cri: pull in updated /dev/shm fix #2506

Conversation

dweomer
Copy link
Contributor

@dweomer dweomer commented Nov 11, 2020

Proposed Changes

Do not relabel container /dev/shm when it is host /dev/shm.

Types of Changes

bugfix

Verification

kubectl run envoy --image=envoyproxy/envoy:v1.14.1
pod/envoy created
# after some seconds, should get a running pod:
kubectl get pod
NAME    READY   STATUS    RESTARTS   AGE
envoy   1/1     Running   0          18s

Additionally, with HostIPC=true:

kubectl run envoy --image=envoyproxy/envoy:v1.14.1 --overrides='{ "apiVersion": "v1", "spec": { "hostIPC" : true} }'
pod/envoy created
# after some seconds, should get a running pod:
kubectl get pod
NAME    READY   STATUS    RESTARTS   AGE
envoy   1/1     Running   0          18s

And a directory listing of /dev/shm should look like:

ls -alZ /dev/shm/
drwxrwxrwt. root root system_u:object_r:tmpfs_t:s0     .
drwxr-xr-x. root root system_u:object_r:device_t:s0    ..
-rw-------. root root system_u:object_r:container_file_t:s0 envoy_shared_memory_0

Specifically, /dev/shm should NOT have the container_file_t context label.

Linked Issues

#2240

Further Comments

cherry-picked from containerd/cri#1605

Do not relabel container /dev/shm when it is host /dev/shm.

Signed-off-by: Jacob Blain Christen <[email protected]>
@dweomer dweomer requested a review from a team as a code owner November 11, 2020 23:34
Copy link
Contributor

@galal-hussein galal-hussein left a comment

Choose a reason for hiding this comment

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

LGTM

@davidnuzik
Copy link
Contributor

@ShylajaDevadiga to test once it's merged into master. @ShylajaDevadiga I'm not privy to the LOE to test seems small but it can wait until tomorrow morning. If needed, we should just do it first thing tomorrow. There will also be backports fyi to come in later (but I think we are okay with just a check in master unless @dweomer believes otherwise.

@dweomer dweomer merged commit 2c666af into k3s-io:master Nov 12, 2020
@ShylajaDevadiga
Copy link
Contributor

Validated the fix using commit 2c666af on rhel 7.8 as well rhel 8.2
selinux Enforced mode
hostIPC set to true
Updated in issue #2240

briandowns pushed a commit to briandowns/k3s that referenced this pull request Jan 14, 2021
Do not relabel container /dev/shm when it is host /dev/shm.

Signed-off-by: Jacob Blain Christen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants