From a2f67957845c522a6a381f9041e545cdd94dbe76 Mon Sep 17 00:00:00 2001 From: Maria Yu Date: Wed, 24 Nov 2021 15:30:05 +0800 Subject: [PATCH] ANDROID: init_task: Init android vendor and oem data Without initialization, it will be random data and hard for vendor hook to decide. Bug: 207739506 Change-Id: I278772d87eea38c03a40d4f0bef20ac8644e2ecd Signed-off-by: Maria Yu (cherry picked from commit 898e7ec950c168e37ce8c27f6ca1d2cdea66b078) --- init/init_task.c | 2 ++ kernel/fork.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/init/init_task.c b/init/init_task.c index 73cc8f03511a..17d923808119 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -209,6 +209,8 @@ struct task_struct init_task #ifdef CONFIG_SECCOMP_FILTER .seccomp = { .filter_count = ATOMIC_INIT(0) }, #endif + .android_vendor_data1 = {0, }, + .android_oem_data1 = {0, }, }; EXPORT_SYMBOL(init_task); diff --git a/kernel/fork.c b/kernel/fork.c index b6c7fb3a0602..c32d3ee441fb 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1054,6 +1054,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) #ifdef CONFIG_MEMCG tsk->active_memcg = NULL; #endif + memset(&tsk->android_vendor_data1, 0, sizeof(tsk->android_vendor_data1)); + memset(&tsk->android_oem_data1, 0, sizeof(tsk->android_oem_data1)); return tsk; free_stack: