From 552bacfeff676ff401592007f6ba4d5230b2381d 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 [added libperfmgr 1.2 in case some ROMs use wahoo powerhal] Signed-off-by: Volodymyr Zhdanov --- include/linux/binfmts.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 576e4639ca60..7a09535c8ec3 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -120,4 +120,16 @@ extern void install_exec_creds(struct linux_binprm *bprm); extern void set_binfmt(struct linux_binfmt *new); extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); +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.2-servi") || + !strcmp(comm, "power@1.3-servi") || + !strcmp(comm, "perf@1.0-servic") || + !strcmp(comm, "init.qcom.post_"); +} + #endif /* _LINUX_BINFMTS_H */ -- 2.11.0