]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
cgrulesengd: Do not ignore changes of short-lived processes
authorMichal Koutný <mkoutny@suse.com>
Tue, 11 Jun 2019 07:05:59 +0000 (09:05 +0200)
committerDhaval Giani <dhaval.giani@gmail.com>
Wed, 12 Jun 2019 15:13:27 +0000 (08:13 -0700)
commit251eb85aee82b49407a5f214872b1d8aa852caec
tree577738f0b388dd9ce9d21e5d3e6c9e62258c8397
parent19dd6bb0f3d50e74e750994fdd7001c7d9ccef25
cgrulesengd: Do not ignore changes of short-lived processes

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>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
src/daemon/cgrulesengd.c