mirror of
https://github.com/systemd/systemd.git
synced 2026-11-07 22:07:14 +00:00
core: tolerate kernels without POSIX mqueue support
PrivateIPC= sets up a private mqueue mount for the service. When CONFIG_POSIX_MQUEUE is disabled, mounting mqueue fails with ENODEV and prevents the service from starting. Treat ENODEV as an unavailable optional kernel feature while preserving the private IPC namespace. Keep all other mount errors fatal. Add coverage verifying that PrivateIPC= still creates a separate IPC namespace when POSIX message queues are unavailable. Fixes #42582 (cherry picked from commit9d217e051b) (cherry picked from commit104bbafc9a)
This commit is contained in:
1 parent
799c747255
commit
5bfb8d2585
2 files changed
+13
No files matched your search
@@ -1641,6 +1641,8 @@ static int mount_mqueuefs(const MountEntry *m) {
|
||||
(void) umount_recursive(entry_path, 0);
|
||||
|
||||
r = mount_nofollow_verbose(LOG_DEBUG, "mqueue", entry_path, "mqueue", m->flags, mount_entry_options(m));
|
||||
if (r == -ENODEV) /* POSIX message queues may be disabled in the kernel. */
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
# Verify PrivateIPC= works and creates a separate IPC namespace even if POSIX
|
||||
# message queues are not supported.
|
||||
host_ipcns=$(readlink /proc/self/ns/ipc)
|
||||
private_ipcns=$(systemd-run --quiet --wait --pipe -p PrivateIPC=yes readlink /proc/self/ns/ipc)
|
||||
[[ "$private_ipcns" != "$host_ipcns" ]]
|
||||
|
||||
if [[ ! -d /proc/sys/fs/mqueue ]]; then
|
||||
echo "POSIX message queues are not supported, skipping ownership checks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Verify ownership attributes are applied to message queues
|
||||
|
||||
# Select arbitrary non-default attributes to apply to the queue.
|
||||
|
||||
Reference in new issue
Block a user