arm64: remove unneeded BUILD_BUG_ON assertion
PATCH 1/1 arm64: remove unneeded BUILD_BUG_ON assertion
Since commit c02433dd6de3 ("arm64: split thread_info from task stack"), CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So remove this always-true assertion from arch_dup_task_struct.
--- arch/arm64/kernel/process.c | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/kernel/process.c +0 -3
@@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)fpsimd_preserve_current_state (); *dst = *src; -/* We rely on the above assignment to initialize dst's thread_flags: */ -BUILD_BUG_ON (!IS_ENABLED (CONFIG_THREAD_INFO_IN_TASK )); -/* * Detach src's sve_state (if any) from dst so that it does not * get erroneously used or freed prematurely. dst's copies
Signature · 7 lines
2.27.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 14 lines · Dawei Li
Since commit
c02433dd6de3("arm64: splitthread_infofrom task stack"),CONFIG_THREAD_INFO_IN_TASKis enabled unconditionally for arm64. So remove this always-true assertion fromarch_dup_task_struct.Signed-off-by Dawei Li <[email protected]>--- arch/arm64/kernel/process.c | 3 --- 1 file changed, 3 deletions(-)arch/arm64/kernel/process.c +0
-0
arch/arm64/kernel/process.c int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · line 295
Quoted 6 lines
arch/arm64/kernel/process.c +0
-3@@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)fpsimd_preserve_current_state (); *dst = *src; -/* We rely on the above assignment to initialize dst's thread_flags: */ -BUILD_BUG_ON (!IS_ENABLED (CONFIG_THREAD_INFO_IN_TASK )); -
Does the above cause any problem today, or is this patch just a cleanup?
For the benefit of other reviewers, the assertion and comment were added in commit:
4585fc59c0e8 ("arm64/sve: Fix wrong free for task->thread.sve_state")
... back in 2019, 3 years after commit:
c02433dd6de3 ("arm64: split thread_info from task stack")
The comment and assertion were a safety-net for backports, since commit 4585fc59c0e8 was a fix which dependend upon the thread_info being contained within task_struct, and couldn't be backported to kernels without CONFIG_THREAD_INFO_IN_TASK.
I'm sure that we currently have plenty of other code with a similar (but undocumented) dependency. Given we've unconditionally selected CONFIG_THREAD_INFO_IN_TASK since v4.10, and the oldest longterm stable kernel is v4.19 (with v4.14 having EOL'd last month), I think it makes sense to delete the assertion and comment.
So FWIW:
Mark.
Hi Mark,
Thanks for reviewing.
Quoted 18 lines · Mark Rutland
Quoted 17 lines · Dawei Li
Since commit
c02433dd6de3("arm64: splitthread_infofrom task stack"),CONFIG_THREAD_INFO_IN_TASKis enabled unconditionally for arm64. So remove this always-true assertion fromarch_dup_task_struct.Signed-off-by Dawei Li <[email protected]>--- arch/arm64/kernel/process.c | 3 --- 1 file changed, 3 deletions(-)arch/arm64/kernel/process.c +0
-0@@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)fpsimd_preserve_current_state (); *dst = *src;
Quoted 5 lines
arch/arm64/kernel/process.c int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · line 295
Quoted 3 lines
arch/arm64/kernel/process.c +0
-3-/* We rely on the above assignment to initialize dst's thread_flags: */ -BUILD_BUG_ON (!IS_ENABLED (CONFIG_THREAD_INFO_IN_TASK )); -Does the above cause any problem today, or is this patch just a cleanup?
It's just a cleanup patch.
Quoted 6 lines
For the benefit of other reviewers, the assertion and comment were added in commit:
4585fc59c0e8("arm64/sve: Fix wrong free fortask->thread.sve_state")
Quoted 8 lines
.. back in 2019, 3 years after commit:
c02433dd6de3("arm64: splitthread_infofrom task stack")The comment and assertion were a safety-net for backports, since commit
4585fc59c0e8was a fix which dependend upon thethread_infobeing contained withintask_struct, and couldn't be backported to kernels withoutCONFIG_THREAD_INFO_IN_TASK.
Thanks for the update! It helps.
Quoted 3 lines
I'm sure that we currently have plenty of other code with a similar (but undocumented) dependency. Given we've unconditionally selected
Totally agreed.
Quoted 10 lines
CONFIG_THREAD_INFO_IN_TASKsince v4.10, and the oldest longterm stable kernel is v4.19 (with v4.14 having EOL'd last month), I think it makes sense to delete the assertion and comment.So FWIW:
Acked-by Mark Rutland <[email protected]>Mark.
Thanks,
Dawei
Hi,
Quoted 5 lines · Dawei Li
Since commit
c02433dd6de3("arm64: splitthread_infofrom task stack"),CONFIG_THREAD_INFO_IN_TASKis enabled unconditionally for arm64. So remove this always-true assertion fromarch_dup_task_struct.Signed-off-by Dawei Li <[email protected]>
Just a gentle remainder:).
Thanks,
Dawei
Quoted 21 lines
--- arch/arm64/kernel/process.c | 3 --- 1 file changed, 3 deletions(-)arch/arm64/kernel/process.c +0
-3@@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)fpsimd_preserve_current_state (); *dst = *src; -/* We rely on the above assignment to initialize dst's thread_flags: */ -BUILD_BUG_ON (!IS_ENABLED (CONFIG_THREAD_INFO_IN_TASK )); -/* * Detach src's sve_state (if any) from dst so that it does not * get erroneously used or freed prematurely. dst's copies Signature · 1 line
2.27.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 5 lines · Dawei Li
Since commit
c02433dd6de3("arm64: splitthread_infofrom task stack"),CONFIG_THREAD_INFO_IN_TASKis enabled unconditionally for arm64. So remove this always-true assertion fromarch_dup_task_struct.
Applied to arm64 (for-next/misc), thanks!
[1/1] arm64: remove unneeded BUILD_BUG_ON assertion
https://git.kernel.org/arm64/c/bce79b0c8097
Signature · 1 line
Catalin