From nobody Tue Dec 30 09:58:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EE3AC54FB9 for ; Thu, 16 Nov 2023 13:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345159AbjKPNhY (ORCPT ); Thu, 16 Nov 2023 08:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbjKPNhV (ORCPT ); Thu, 16 Nov 2023 08:37:21 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF1D0B4 for ; Thu, 16 Nov 2023 05:37:17 -0800 (PST) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGDYf9J023843; Thu, 16 Nov 2023 13:36:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=pde1pdLboIN8W79lmwAN4H0erhMLSWfQpdyYFspntGs=; b=LfrB8Ubl2famq3uk0WtJPTfbX4FbwWCxeUcgTpv/kOlWtRDdz0AiOMUVZ1ufESLL2exX EAL/6G9Z8ZG278I/pYreXq38n7nByJF+rPKc2AgQ4+Bdqffz+gu/oUyiA3w/dqsxPOzC 7koTePUuK7jYauo0Yx1YI0Bcsjf7kMhQ3Ck0bp+pdm1D5ybr991USMH9Lm9a3yVYRxzs TzdKNMWio01KvflOebNwVS/js52Hnx49WdDAHSg2CejwddTifcM1dbqoNPp7arSO3PH7 9HxeTjxqRjNkYZBa8dCUoxsyPk/lfxTgZD/jmXL6id0IUIfA5/HzY1RqRJXNBhCKJqO3 bw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udm3381yg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:42 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AGDZCU6025730; Thu, 16 Nov 2023 13:36:42 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udm3381y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:42 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGBXwUV003431; Thu, 16 Nov 2023 13:36:41 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayq3ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:41 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AGDadk566519406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Nov 2023 13:36:39 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4600120040; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E32A2004B; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 16 Nov 2023 13:36:38 +0000 (GMT) From: Heiko Carstens To: Ard Biesheuvel , Arnd Bergmann , Andrew Morton , Michael Ellerman , Nicholas Piggin , Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/3] arch: remove ARCH_THREAD_STACK_ALLOCATOR Date: Thu, 16 Nov 2023 14:36:36 +0100 Message-Id: <20231116133638.1636277-2-hca@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231116133638.1636277-1-hca@linux.ibm.com> References: <20231116133638.1636277-1-hca@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: p6x4_xx8h73lxdulrHPylu-IJ4kPqT57 X-Proofpoint-ORIG-GUID: qBotvUq9bJCcFlayRp5dJ458tEk6APPZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_13,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 mlxscore=0 suspectscore=0 clxscore=1011 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 mlxlogscore=819 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311160105 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" IA-64 was the only architecture which selected ARCH_THREAD_STACK_ALLOCATOR. IA-64 was removed with commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture"). Therefore remove support for ARCH_THREAD_STACK_ALLOCATOR as well. Signed-off-by: Heiko Carstens Acked-by: Ard Biesheuvel Reviewed-by: Arnd Bergmann --- arch/Kconfig | 4 ---- kernel/fork.c | 20 -------------------- 2 files changed, 24 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index f4b210ab0612..310162b41a1c 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -320,10 +320,6 @@ config HAVE_ARCH_THREAD_STRUCT_WHITELIST should be implemented. Without this, the entire thread_struct field in task_struct will be left whitelisted. =20 -# Select if arch has its private alloc_thread_stack() function -config ARCH_THREAD_STACK_ALLOCATOR - bool - # Select if arch wants to size task_struct dynamically via arch_task_struc= t_size: config ARCH_WANTS_DYNAMIC_TASK_STRUCT bool diff --git a/kernel/fork.c b/kernel/fork.c index 10917c3e1f03..d071809866e0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -179,8 +179,6 @@ static inline void free_task_struct(struct task_struct = *tsk) } #endif =20 -#ifndef CONFIG_ARCH_THREAD_STACK_ALLOCATOR - /* * Allocate pages if THREAD_SIZE is >=3D PAGE_SIZE, otherwise use a * kmemcache based allocator. @@ -412,24 +410,6 @@ void thread_stack_cache_init(void) } =20 # endif /* THREAD_SIZE >=3D PAGE_SIZE || defined(CONFIG_VMAP_STACK) */ -#else /* CONFIG_ARCH_THREAD_STACK_ALLOCATOR */ - -static int alloc_thread_stack_node(struct task_struct *tsk, int node) -{ - unsigned long *stack; - - stack =3D arch_alloc_thread_stack_node(tsk, node); - tsk->stack =3D stack; - return stack ? 0 : -ENOMEM; -} - -static void free_thread_stack(struct task_struct *tsk) -{ - arch_free_thread_stack(tsk); - tsk->stack =3D NULL; -} - -#endif /* !CONFIG_ARCH_THREAD_STACK_ALLOCATOR */ =20 /* SLAB cache for signal_struct structures (tsk->signal) */ static struct kmem_cache *signal_cachep; --=20 2.39.2 From nobody Tue Dec 30 09:58:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE59C197A0 for ; Thu, 16 Nov 2023 13:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345223AbjKPNjQ (ORCPT ); Thu, 16 Nov 2023 08:39:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345224AbjKPNjO (ORCPT ); Thu, 16 Nov 2023 08:39:14 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0E41A7 for ; Thu, 16 Nov 2023 05:39:11 -0800 (PST) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGDRmWZ016619; Thu, 16 Nov 2023 13:38:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=gU7vbPwhVN7muCTCU/0kp+lelIegbVTYu2YjwnbykWc=; b=OTuonKfs/lyxa74NmnmPAJdhG6cvaZN6L0J99/cm0h1yOOT1FAOTANvCinUi5ZmyOyiW i6/ZVvNbnHtHub3bb9bLmkGs/zG0ieJNJa/HlWmneiMhUV51bcv8fJbyf+cTz4LHFuZy Mjr/CNVm2+J652X7T31c0Lm8KpCwZ1+x41QahN6D+HCJPrnsiCN3XXJ/5imt/AjSxDON 2Hkxwmh7ibu+7+B755OvTyAPYP2bIGot4t+ZM69WaT6fxx9wif93bgZnwCsciz6fUYhl JOG+KpboOYqxJ6/DdU0kyah7/N7UjXym5jSbL6vpj9fJ/jtJg1aBLWEXrmkhK26kOO/+ mQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udkyur8bf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:38:57 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AGDRvib016864; Thu, 16 Nov 2023 13:38:57 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udkyur7vk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:38:57 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGBeC2B000447; Thu, 16 Nov 2023 13:36:41 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uanekxrsj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:41 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AGDadXk13369926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Nov 2023 13:36:39 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86F7A2004F; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EDD620043; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) From: Heiko Carstens To: Ard Biesheuvel , Arnd Bergmann , Andrew Morton , Michael Ellerman , Nicholas Piggin , Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/3] arch: remove ARCH_TASK_STRUCT_ALLOCATOR Date: Thu, 16 Nov 2023 14:36:37 +0100 Message-Id: <20231116133638.1636277-3-hca@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231116133638.1636277-1-hca@linux.ibm.com> References: <20231116133638.1636277-1-hca@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FfD6q5Cb3BTS-54B56ChfBplkUHFebB3 X-Proofpoint-ORIG-GUID: X3Nvu-xvWovAL78vdRsD0QCZnlXaQ6Nr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_13,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 bulkscore=0 impostorscore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311160106 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" IA-64 was the only architecture which selected ARCH_TASK_STRUCT_ALLOCATOR. IA-64 was removed with commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture"). Therefore remove support for ARCH_THREAD_STACK_ALLOCATOR as well. Signed-off-by: Heiko Carstens Acked-by: Ard Biesheuvel Reviewed-by: Arnd Bergmann --- arch/Kconfig | 5 ----- kernel/fork.c | 6 ------ 2 files changed, 11 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 310162b41a1c..c2f87ef9f0ae 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -305,13 +305,8 @@ config ARCH_HAS_CPU_FINALIZE_INIT config ARCH_TASK_STRUCT_ON_STACK bool =20 -# Select if arch has its private alloc_task_struct() function -config ARCH_TASK_STRUCT_ALLOCATOR - bool - config HAVE_ARCH_THREAD_STRUCT_WHITELIST bool - depends on !ARCH_TASK_STRUCT_ALLOCATOR help An architecture should select this to provide hardened usercopy knowledge about what region of the thread_struct should be diff --git a/kernel/fork.c b/kernel/fork.c index d071809866e0..ce8a4b8c04e2 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -165,7 +165,6 @@ void __weak arch_release_task_struct(struct task_struct= *tsk) { } =20 -#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR static struct kmem_cache *task_struct_cachep; =20 static inline struct task_struct *alloc_task_struct_node(int node) @@ -177,7 +176,6 @@ static inline void free_task_struct(struct task_struct = *tsk) { kmem_cache_free(task_struct_cachep, tsk); } -#endif =20 /* * Allocate pages if THREAD_SIZE is >=3D PAGE_SIZE, otherwise use a @@ -1001,7 +999,6 @@ static void set_max_threads(unsigned int max_threads_s= uggested) int arch_task_struct_size __read_mostly; #endif =20 -#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR static void task_struct_whitelist(unsigned long *offset, unsigned long *si= ze) { /* Fetch thread_struct whitelist for the architecture. */ @@ -1016,12 +1013,10 @@ static void task_struct_whitelist(unsigned long *of= fset, unsigned long *size) else *offset +=3D offsetof(struct task_struct, thread); } -#endif /* CONFIG_ARCH_TASK_STRUCT_ALLOCATOR */ =20 void __init fork_init(void) { int i; -#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR #ifndef ARCH_MIN_TASKALIGN #define ARCH_MIN_TASKALIGN 0 #endif @@ -1034,7 +1029,6 @@ void __init fork_init(void) arch_task_struct_size, align, SLAB_PANIC|SLAB_ACCOUNT, useroffset, usersize, NULL); -#endif =20 /* do the arch specific task caches init */ arch_task_cache_init(); --=20 2.39.2 From nobody Tue Dec 30 09:58:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01CC6C197A0 for ; Thu, 16 Nov 2023 13:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345210AbjKPNh1 (ORCPT ); Thu, 16 Nov 2023 08:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231164AbjKPNhW (ORCPT ); Thu, 16 Nov 2023 08:37:22 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D424BA0 for ; Thu, 16 Nov 2023 05:37:18 -0800 (PST) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGDMXZj008819; Thu, 16 Nov 2023 13:36:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=5tT2x94kITssepSoUFE+QAGQdO98GI5ZAe4RJoDR/JU=; b=Fd7p7ZGrJSCx9KIfin4lIIDTYYY9XuXpFSKoZUqA7la97Zwt+DwwJBuQyvMXPEvQk5c8 Dh0Irw14HMlG7zn81B5/mejnQHGrpm9RgLHIgiKhoMdh9pTkoZ6LXuQGsYE6rNJeYGuc RKjizKWgZ8Q7AEQqrL2ztSIyRgVhbMOu7xzdD8s2t4COT1yg9l2z4z8IPzqZ/KLVcno1 S8Q9HTPDlq07VHdv8WKxzxhGlxkjkc9100thhFySjMJ/KdDVj1JPeGHtLjL/neA5nHS3 BsTrYnXgGfF5YSLbu1NzqlI9ohCkbmp5a01f6xzM+wnyIfhF6MWtt5gHKhLBCvnyVfXG cg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udkwg8e6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:43 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AGDMvaD010277; Thu, 16 Nov 2023 13:36:42 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3udkwg8e5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:42 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGBgIbt004493; Thu, 16 Nov 2023 13:36:41 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uap5keewj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 13:36:41 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AGDad7k17433296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Nov 2023 13:36:39 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C75A920040; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8FD6E20063; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 16 Nov 2023 13:36:39 +0000 (GMT) From: Heiko Carstens To: Ard Biesheuvel , Arnd Bergmann , Andrew Morton , Michael Ellerman , Nicholas Piggin , Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/3] arch: remove ARCH_TASK_STRUCT_ON_STACK Date: Thu, 16 Nov 2023 14:36:38 +0100 Message-Id: <20231116133638.1636277-4-hca@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231116133638.1636277-1-hca@linux.ibm.com> References: <20231116133638.1636277-1-hca@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: N2-JIjbstfip17sUPrL72h-OBexE9a0g X-Proofpoint-GUID: TKL22pshACc6f3uKkVoxltfhl9qA5IP1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_13,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311160106 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" IA-64 was the only architecture which selected ARCH_TASK_STRUCT_ON_STACK. IA-64 was removed with commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture"). Therefore remove support for ARCH_TASK_STRUCT_ON_STACK as well. Note: this also reveals a potential bug in powerpc code, which makes use of __init_task_data without selecting ARCH_TASK_STRUCT_ON_STACK which makes __init_task_data a no-op. This is broken since commit d11ed3ab3166 ("Expand INIT_TASK() in init/init_task.c and remove") from 2018 and needs to be addressed separately. Cc: Michael Ellerman Cc: Nicholas Piggin Signed-off-by: Heiko Carstens Acked-by: Ard Biesheuvel Reviewed-by: Arnd Bergmann --- arch/Kconfig | 4 ---- arch/powerpc/kexec/core_64.c | 3 +-- include/linux/init_task.h | 7 ------- include/linux/sched.h | 2 -- init/init_task.c | 10 ++-------- 5 files changed, 3 insertions(+), 23 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index c2f87ef9f0ae..bfcc7c2dc039 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -301,10 +301,6 @@ config ARCH_HAS_DMA_CLEAR_UNCACHED config ARCH_HAS_CPU_FINALIZE_INIT bool =20 -# Select if arch init_task must go in the __init_task_data section -config ARCH_TASK_STRUCT_ON_STACK - bool - config HAVE_ARCH_THREAD_STRUCT_WHITELIST bool help diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c index 0bee7ca9a77c..762e4d09aacf 100644 --- a/arch/powerpc/kexec/core_64.c +++ b/arch/powerpc/kexec/core_64.c @@ -283,8 +283,7 @@ static void kexec_prepare_cpus(void) * We could use a smaller stack if we don't care about anything using * current, but that audit has not been performed. */ -static union thread_union kexec_stack __init_task_data =3D - { }; +static union thread_union kexec_stack =3D { }; =20 /* * For similar reasons to the stack above, the kexecing CPU needs to be on= a diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 40fc5813cf93..bccb3f1f6262 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -37,13 +37,6 @@ extern struct cred init_cred; =20 #define INIT_TASK_COMM "swapper" =20 -/* Attach to the init_task data structure for proper alignment */ -#ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK -#define __init_task_data __section(".data..init_task") -#else -#define __init_task_data /**/ -#endif - /* Attach to the thread_info data structure for proper alignment */ #define __init_thread_info __section(".data..init_thread_info") =20 diff --git a/include/linux/sched.h b/include/linux/sched.h index 292c31697248..c2ecb2e06046 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1955,9 +1955,7 @@ extern void ia64_set_curr_task(int cpu, struct task_s= truct *p); void yield(void); =20 union thread_union { -#ifndef CONFIG_ARCH_TASK_STRUCT_ON_STACK struct task_struct task; -#endif #ifndef CONFIG_THREAD_INFO_IN_TASK struct thread_info thread_info; #endif diff --git a/init/init_task.c b/init/init_task.c index 5727d42149c3..6f6485d554df 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -51,8 +51,7 @@ static struct sighand_struct init_sighand =3D { }; =20 #ifdef CONFIG_SHADOW_CALL_STACK -unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)] - __init_task_data =3D { +unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)] =3D { [(SCS_SIZE / sizeof(long)) - 1] =3D SCS_END_MAGIC }; #endif @@ -61,12 +60,7 @@ unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(l= ong)] * Set up the first task table, touch at your own risk!. Base=3D0, * limit=3D0x1fffff (=3D2MB) */ -struct task_struct init_task -#ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK - __init_task_data -#endif - __aligned(L1_CACHE_BYTES) -=3D { +struct task_struct init_task __aligned(L1_CACHE_BYTES) =3D { #ifdef CONFIG_THREAD_INFO_IN_TASK .thread_info =3D INIT_THREAD_INFO(init_task), .stack_refcount =3D REFCOUNT_INIT(1), --=20 2.39.2