From 34c53e1824c06b29b200cf57814023647196c29b 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 2d024066e27b..cac0d7dcfa69 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -214,6 +214,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 b4bfe3e3ff22..57eec065b628 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1014,6 +1014,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: