diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c index f272eeea1efb..403cbb12a6e9 100644 --- a/fs/proc/cmdline.c +++ b/fs/proc/cmdline.c @@ -3,14 +3,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_puts(m, new_command_line); - seq_putc(m, '\n'); + seq_printf(m, "%s\n", saved_command_line); return 0; } @@ -26,39 +22,8 @@ static const struct file_operations cmdline_proc_fops = { .release = single_release, }; -static void patch_flag(char *cmd, const char *flag, const char *val) -{ - size_t flag_len, val_len; - char *start, *end; - - start = strstr(cmd, flag); - if (!start) - return; - - flag_len = strlen(flag); - val_len = strlen(val); - end = start + flag_len + strcspn(start + flag_len, " "); - memmove(start + flag_len + val_len, end, strlen(end) + 1); - memcpy(start + flag_len, val, val_len); -} - -static void patch_safetynet_flags(char *cmd) -{ - patch_flag(cmd, "androidboot.verifiedbootstate=", "green"); - patch_flag(cmd, "androidboot.veritymode=", "enforcing"); - patch_flag(cmd, "androidboot.vbmeta.device_state=", "locked"); -} - static int __init proc_cmdline_init(void) { - strcpy(new_command_line, saved_command_line); - - /* - * Patch various flags from command line seen by userspace in order to - * pass SafetyNet checks. - */ - patch_safetynet_flags(new_command_line); - proc_create("cmdline", 0, NULL, &cmdline_proc_fops); return 0; }