From d97598551f2f9afffb3e7a659364f8600b5b751b Mon Sep 17 00:00:00 2001 From: Khusika Dhamar Gusti Date: Fri, 9 Jul 2021 07:16:13 +0700 Subject: [PATCH] Revert "proc: Remove SafetyNet flags from /proc/cmdline" This reverts commit 72b4c7dd57776bccad5a4bf466b0df9e4957a3a5. Signed-off-by: Khusika Dhamar Gusti --- fs/proc/cmdline.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c index c8568498bfbf..cbd82dff7e81 100644 --- a/fs/proc/cmdline.c +++ b/fs/proc/cmdline.c @@ -2,13 +2,10 @@ #include #include #include -#include - -static char new_command_line[COMMAND_LINE_SIZE]; static int cmdline_proc_show(struct seq_file *m, void *v) { - seq_printf(m, "%s\n", new_command_line); + seq_printf(m, "%s\n", saved_command_line); return 0; } @@ -24,36 +21,8 @@ static const struct file_operations cmdline_proc_fops = { .release = single_release, }; -static void remove_flag(char *cmd, const char *flag) -{ - char *start_addr, *end_addr; - - /* Ensure all instances of a flag are removed */ - while ((start_addr = strstr(cmd, flag))) { - end_addr = strchr(start_addr, ' '); - if (end_addr) - memmove(start_addr, end_addr + 1, strlen(end_addr)); - else - *(max(cmd, start_addr - 1)) = '\0'; - } -} - -static void remove_safetynet_flags(char *cmd) -{ - remove_flag(cmd, "androidboot.verifiedbootstate="); - remove_flag(cmd, "androidboot.veritymode="); -} - static int __init proc_cmdline_init(void) { - strcpy(new_command_line, saved_command_line); - - /* - * Remove various flags from command line seen by userspace in order to - * pass SafetyNet CTS check. - */ - remove_safetynet_flags(new_command_line); - proc_create("cmdline", 0, NULL, &cmdline_proc_fops); return 0; }