ANDROID: signal: Add vendor hook for memory reaping

Add vendor hook to determine if the memory of a process that received
the SIGKILL can be reaped.

Bug: 189803002
Change-Id: Ie6802b9bf93ddffb0ceef615d7cca40c23219e57
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
Charan Teja Reddy
2021-06-02 17:33:03 +05:30
committed by Suren Baghdasaryan
parent 3f491d10dc
commit 3bcdb496f4
5 changed files with 47 additions and 7 deletions

View File

@@ -46,6 +46,7 @@
#include <linux/livepatch.h>
#include <linux/cgroup.h>
#include <linux/audit.h>
#include <linux/oom.h>
#define CREATE_TRACE_POINTS
#include <trace/events/signal.h>
@@ -1413,8 +1414,16 @@ int group_send_sig_info(int sig, struct kernel_siginfo *info,
ret = check_kill_permission(sig, info, p);
rcu_read_unlock();
if (!ret && sig)
if (!ret && sig) {
ret = do_send_sig_info(sig, info, p, type);
if (!ret && sig == SIGKILL) {
bool reap = false;
trace_android_vh_process_killed(current, &reap);
if (reap)
add_to_oom_reaper(p);
}
}
return ret;
}