diff --git a/src/basic/limits-util.c b/src/basic/limits-util.c index dc0a2a6c94..9597c4c41c 100644 --- a/src/basic/limits-util.c +++ b/src/basic/limits-util.c @@ -156,8 +156,11 @@ uint64_t system_tasks_max(void) { if (r < 0) log_debug_errno(r, "Failed to determine cgroup root path, ignoring: %m"); else { + /* We'll have the "pids.max" attribute on the our root cgroup only if we are in a + * CLONE_NEWCGROUP namespace. On the top-level namespace this attribute is missing, hence + * suppress any message about that */ r = cg_get_attribute_as_uint64("pids", root, "pids.max", &c); - if (r < 0) + if (r < 0 && r != -ENODATA) log_debug_errno(r, "Failed to read pids.max attribute of root cgroup, ignoring: %m"); } diff --git a/src/core/bpf-lsm.c b/src/core/bpf-lsm.c index 5f614ead04..22200bd939 100644 --- a/src/core/bpf-lsm.c +++ b/src/core/bpf-lsm.c @@ -228,11 +228,14 @@ int lsm_bpf_cleanup(const Unit *u) { if (!u->manager->restrict_fs) return 0; + if (u->cgroup_id == 0) + return 0; + int fd = sym_bpf_map__fd(u->manager->restrict_fs->maps.cgroup_hash); if (fd < 0) return log_unit_error_errno(u, errno, "bpf-lsm: Failed to get BPF map fd: %m"); - if (sym_bpf_map_delete_elem(fd, &u->cgroup_id) != 0) + if (sym_bpf_map_delete_elem(fd, &u->cgroup_id) != 0 && errno != ENOENT) return log_unit_debug_errno(u, errno, "bpf-lsm: Failed to delete cgroup entry from LSM BPF map: %m"); return 0; diff --git a/src/shared/fdset.c b/src/shared/fdset.c index f5dcdce218..b62f15c649 100644 --- a/src/shared/fdset.c +++ b/src/shared/fdset.c @@ -54,6 +54,8 @@ void fdset_close(FDSet *s) { void *p; while ((p = set_steal_first(MAKE_SET(s)))) { + int fd = PTR_TO_FD(p); + /* Valgrind's fd might have ended up in this set here, due to fdset_new_fill(). We'll ignore * all failures here, so that the EBADFD that valgrind will return us on close() doesn't * influence us */ @@ -62,8 +64,14 @@ void fdset_close(FDSet *s) { * which has no effect at all, since they are only duplicates. So don't be surprised about * these log messages. */ - log_debug("Closing set fd %i", PTR_TO_FD(p)); - (void) close_nointr(PTR_TO_FD(p)); + if (DEBUG_LOGGING) { + _cleanup_free_ char *path = NULL; + + (void) fd_get_path(fd, &path); + log_debug("Closing set fd %i (%s)", fd, strna(path)); + } + + (void) close_nointr(fd); } } diff --git a/src/shared/killall.c b/src/shared/killall.c index 1011cd83d3..ef715dbdfe 100644 --- a/src/shared/killall.c +++ b/src/shared/killall.c @@ -60,7 +60,7 @@ static bool is_survivor_cgroup(pid_t pid) { /* user xattr support was added to kernel v5.7, try with the trusted namespace as a fallback */ if (ERRNO_IS_NEG_XATTR_ABSENT(r)) r = cg_get_xattr_bool(cgroup_path, "trusted.survive_final_kill_signal"); - if (r < 0) + if (r < 0 && !ERRNO_IS_NEG_XATTR_ABSENT(r)) log_debug_errno(r, "Failed to get survive_final_kill_signal xattr of %s, ignoring: %m", cgroup_path);