Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit eb8e5359f6c0a5deccb1a17a6fa130c042479519
- Author: Juhyung Park <qkrwngud825@gmail.com>
- Date: Sun Sep 19 02:56:25 2021 +0900
- exec: add a hack to disable lmkd reloading props
- /vendor/etc/perf/perfconfigstore.xml enables ro.lmk.enable_userspace_lmk,
- and when the lmkd properties are re-read, lmkd tries to honor it and ignores
- the presence of in-kernel lmk and exits repeatedly, which causes init to
- trigger a reboot.
- Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
- diff --git a/fs/exec.c b/fs/exec.c
- index d713797fab9aa..be1e483b093a3 100644
- --- a/fs/exec.c
- +++ b/fs/exec.c
- @@ -1724,6 +1724,27 @@ static int exec_binprm(struct linux_binprm *bprm)
- return ret;
- }
- +static noinline bool is_lmkd_reinit(struct user_arg_ptr *argv)
- +{
- + const char __user *str;
- + char buf[10];
- + int len;
- +
- + str = get_user_arg_ptr(*argv, 1);
- + if (IS_ERR(str))
- + return false;
- +
- + // strnlen_user() counts NULL terminator
- + len = strnlen_user(str, MAX_ARG_STRLEN);
- + if (len != 9)
- + return false;
- +
- + if (copy_from_user(buf, str, len))
- + return false;
- +
- + return !strcmp(buf, "--reinit");
- +}
- +
- /*
- * sys_execve() executes a new program.
- */
- @@ -1828,6 +1849,15 @@ static int __do_execve_file(int fd, struct filename *filename,
- if (retval < 0)
- goto out;
- + // Super nasty hack to disable lmkd reloading props
- + if (unlikely(strcmp(bprm.filename, "/system/bin/lmkd") == 0)) {
- + if (is_lmkd_reinit(&argv)) {
- + pr_info("sys_execve(): prevented /system/bin/lmkd --reinit\n");
- + retval = -ENOENT;
- + goto out;
- + }
- + }
- +
- retval = exec_binprm(&bprm);
- if (retval < 0)
- goto out;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement