From ce392dfd954959ff087f164befb048eaa252cafa Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sun, 4 Aug 2019 03:40:30 +0000 Subject: [PATCH] exec: Add node tampering blacklist function We'll be adding checks to block writes from processes which tamper with values that we control from within the kernel, especially ones that userspace writes to for boosting. Add a central function to perform the process check to reduce code duplication. This blacklists the following processes which are known to tamper with such values: - init - libperfmgr (power@1.3-servi and NodeLooperThrea) - perfd (perf@1.0-servic) - init.qcom.post_boot.sh (init.qcom.post_) Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- include/linux/binfmts.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index b0abe21d6cc9..3151e935a37c 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -148,4 +148,15 @@ extern int do_execveat(int, struct filename *, const char __user * const __user *, int); +static inline bool task_is_booster(struct task_struct *tsk) +{ + char comm[sizeof(tsk->comm)]; + + get_task_comm(comm, tsk); + return !strcmp(comm, "init") || !strcmp(comm, "NodeLooperThrea") || + !strcmp(comm, "power@1.3-servi") || + !strcmp(comm, "perf@1.0-servic") || + !strcmp(comm, "init.qcom.post_"); +} + #endif /* _LINUX_BINFMTS_H */