diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-22 22:08:48 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-22 22:52:38 +0100 |
commit | eb14b993bb426b67553babb48de75bec30063a4c (patch) | |
tree | 06b7610962c1bf604528054677c5a332e4a47c0a /src/basic | |
parent | link README.logs from tmpfiles.d/legacy.conf only if available (diff) | |
download | systemd-eb14b993bb426b67553babb48de75bec30063a4c.tar.xz systemd-eb14b993bb426b67553babb48de75bec30063a4c.zip |
namespace-util: handle -ENOSPC by userns_acquire() gracefully in is_idmapping_supported()
Follow-up for edae62120f13b24d51812d1d7c0ab24acb420305.
Fixes #35311.
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/namespace-util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c index 2c61506149..1d566f59e8 100644 --- a/src/basic/namespace-util.c +++ b/src/basic/namespace-util.c @@ -531,6 +531,10 @@ int is_idmapping_supported(const char *path) { userns_fd = userns_acquire(uid_map, gid_map); if (ERRNO_IS_NEG_NOT_SUPPORTED(userns_fd) || ERRNO_IS_NEG_PRIVILEGE(userns_fd)) return false; + if (userns_fd == -ENOSPC) { + log_debug_errno(userns_fd, "Failed to acquire new user namespace, user.max_user_namespaces seems to be exhausted or maybe even zero, assuming ID-mapping is not supported: %m"); + return false; + } if (userns_fd < 0) return log_debug_errno(userns_fd, "ID-mapping supported namespace acquire failed for '%s' : %m", path); |