Skip to content

Commit a91b446

Browse files
committed
LoongArch: Fix arch_dup_task_struct() for CONFIG_RANDSTRUCT
Now the optimized version of arch_dup_task_struct() for LoongArch assumes 'thread' is the last member of 'task_struct'. But this is not true if CONFIG_RANDSTRUCT is enabled after Linux-6.16. So fix the arch_dup_task_struct() function for CONFIG_RANDSTRUCT by copying the whole 'task_struct'. Cc: stable@vger.kernel.org # 6.16+ Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 3c250ae commit a91b446

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

arch/loongarch/kernel/process.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
130130

131131
preempt_enable();
132132

133+
if (IS_ENABLED(CONFIG_RANDSTRUCT)) {
134+
memcpy(dst, src, sizeof(struct task_struct));
135+
return 0;
136+
}
137+
133138
if (!used_math())
134139
memcpy(dst, src, offsetof(struct task_struct, thread.fpu.fpr));
135140
else

0 commit comments

Comments
 (0)