Re: [PATCH 3/4][PoC][RFC] Connect rlimit-events with process life cycle

From: Krzysztof Opasiak
Date: Thu Oct 19 2017 - 14:19:32 EST




On 10/19/2017 09:41 AM, Greg KH wrote:
On Wed, Oct 18, 2017 at 10:32:29PM +0200, Krzysztof Opasiak wrote:
Add rlimit-events call to process lifecycle to ensure that
we get notified whenever process dies (to cleanup our watch
levels) or forks (to implement watch levels inheritance).

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
kernel/exit.c | 4 ++++
kernel/fork.c | 16 +++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 516acdb0e0ec..c7e435ac4428 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -62,6 +62,7 @@
#include <linux/kcov.h>
#include <linux/random.h>
#include <linux/rcuwait.h>
+#include <linux/rlimit_noti.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
@@ -858,6 +859,9 @@ void __noreturn do_exit(long code)
if (group_dead)
tty_audit_exit();
audit_free(tsk);
+#ifdef CONFIG_RLIMIT_NOTIFICATION
+ rlimit_noti_task_exit(tsk);
+#endif

#ifdef should not be needed in a .c file :(


Yeah, I should have dropped them as it's solved in header by defining this function as empty when rlimit-events are disabled.

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics