Skip to content

Commit 75fdf82

Browse files
brooniewilldeacon
authored andcommitted
arm64/gcs: Don't call gcs_free() when releasing task_struct
Currently we call gcs_free() when releasing task_struct but this is redundant, it attempts to deallocate any kernel managed userspace GCS which should no longer be relevant and resets values in the struct we're in the process of freeing. By the time arch_release_task_struct() is called the mm will have been disassociated from the task so the check for a mm in gcs_free() will always be false, for threads that are exiting leaving the mm active deactivate_mm() will have been called previously and freed any kernel managed GCS. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 344b658 commit 75fdf82

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

arch/arm64/kernel/process.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ void flush_thread(void)
339339
void arch_release_task_struct(struct task_struct *tsk)
340340
{
341341
fpsimd_release_task(tsk);
342-
gcs_free(tsk);
343342
}
344343

345344
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)

arch/arm64/mm/gcs.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ void gcs_free(struct task_struct *task)
157157
if (!system_supports_gcs())
158158
return;
159159

160-
/*
161-
* When fork() with CLONE_VM fails, the child (tsk) already
162-
* has a GCS allocated, and exit_thread() calls this function
163-
* to free it. In this case the parent (current) and the
164-
* child share the same mm struct.
165-
*/
166160
if (!task->mm || task->mm != current->mm)
167161
return;
168162

0 commit comments

Comments
 (0)