• Kubernetes Submit Queue's avatar
    Merge pull request #58174 from filbranden/ipcs1 · 84408378
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Fixes for HostIPC tests to work when Docker has SELinux support enabled.
    
    **What this PR does / why we need it**:
    
    Fixes for HostIPC tests to work when Docker has SELinux support enabled.
    
    **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
    
    N/A
    
    **Special notes for your reviewer**:
    
    The core of the matter is to use `ipcs` from util-linux rather than the one from busybox. The typical SELinux policy has enough to allow Docker containers (running under svirt_lxc_net_t SELinux type) to access IPC information by reading the contents of the files under /proc/sysvipc/, but not by using the shmctl etc. syscalls.
    
    The `ipcs` implementation in busybox will use `shmctl(0, SHM_INFO, ...)` to detect whether it can read IPC info (see source code [here](https://git.busybox.net/busybox/tree/util-linux/ipcs.c?h=1_28_0#n138)), while the one in util-linux will prefer to read from the /proc files directly if they are available (see source code [here](https://github.com/karelzak/util-linux/blob/v2.27.1/sys-utils/ipcutils.c#L108)).
    
    It turns out the SELinux policy doesn't allow the shmctl syscalls in an unprivileged container, while access to it through the /proc interface is fine. (One could argue this is a bug in the SELinux policy, but getting it fixed on stable OSs is hard, and it's not that hard for us to test it with an util-linux `ipcs`, so I propose we do so.)
    
    This PR also contains a refactor of the code setting IpcMode, since setting it in the "common options" function is misleading, as on containers other than the sandbox, it ends up always getting overwritten, so let's only set it to "host" in the Sandbox.
    
    It also has a minor fix for the `ipcmk` call, since support for size suffix was only introduced in recent versions of it.
    
    **Release note**:
    
    ```release-note
    NONE
    ```
    84408378
Name
Last commit
Last update
..
clusterapi-tester Loading commit data...
cuda-vector-add Loading commit data...
dnsutils Loading commit data...
entrypoint-tester Loading commit data...
fakegitserver Loading commit data...
goproxy Loading commit data...
hostexec Loading commit data...
ipc-utils Loading commit data...
iperf Loading commit data...
jessie-dnsutils Loading commit data...
kitten Loading commit data...
liveness Loading commit data...
logs-generator Loading commit data...
mounttest Loading commit data...
mounttest-user Loading commit data...
n-way-http Loading commit data...
nautilus Loading commit data...
net Loading commit data...
netexec Loading commit data...
nettest Loading commit data...
no-snat-test Loading commit data...
no-snat-test-proxy Loading commit data...
nonewprivs Loading commit data...
pets Loading commit data...
port-forward-tester Loading commit data...
porter Loading commit data...
redis Loading commit data...
resource-consumer Loading commit data...
serve-hostname Loading commit data...
test-webserver Loading commit data...
volumes-tester Loading commit data...
webhook Loading commit data...
BUILD Loading commit data...
Makefile Loading commit data...
OWNERS Loading commit data...
image-util.sh Loading commit data...