Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
libcgroup.14591
0001-cgrulesengd-Do-not-ignore-changes-of-short...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-cgrulesengd-Do-not-ignore-changes-of-short-lived-pro.patch of Package libcgroup.14591
From 66d6b77723b792a451f8943d4eaef0428d61db39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com> Date: Mon, 18 Mar 2019 18:07:24 +0100 Subject: [PATCH] cgrulesengd: Do not ignore changes of short-lived processes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a double-forking daemon spawns the shortlived forking process and we fail to classify it in time, the child does not inherit (the intended) cgroup membership. We could process all children after receiving PROC_EVENT_FORK to remedy this. But since we already have the timestamp logic introduced in 8953fc07c049 ("Changelog v2: * Use clock_gettime(2) for getting timestamp since a system boot. * Change parent_info's memory to dynamic allocation.") and it may be too much work for all fork(2) calls, we extend the usage of parent_info by assuming the parent would have changed its cgroup membership by our actions even if it terminated quickly. v2: Handle non-existent /proc/$PID/tasks as short-lived process too Use cgroup_get_last_errno() helper Signed-off-by: Michal Koutný <mkoutny@suse.com> --- src/daemon/cgrulesengd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c index 0d288f3ca916..0d90b8b114b8 100644 --- a/src/daemon/cgrulesengd.c +++ b/src/daemon/cgrulesengd.c @@ -477,9 +477,13 @@ int cgre_process_event(const struct proc_event *ev, const int type) } ret = cgroup_change_cgroup_flags(euid, egid, procname, pid, CGFLAG_USECACHE); - if ((ret == ECGOTHER) && (errno == ESRCH)) { - /* A process finished already and that is not a problem. */ - ret = 0; + if (ret == ECGOTHER) { + /* A process finished already but we may have missed changing it, + * make sure to apply to forked children. */ + if (cgroup_get_last_errno() == ESRCH || cgroup_get_last_errno() == ENOENT) + ret = cgre_store_parent_info(pid); + else + ret = 0; } else if (ret) { flog(LOG_WARNING, "Cgroup change for PID: %d, UID: %d, GID: %d, PROCNAME: %s FAILED! (Error Code: %d)\n", -- 2.21.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor