From nobody Mon Jun 8 10:56:41 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94B6F3F9F30; Fri, 29 May 2026 14:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066705; cv=none; b=Vfhj5ZcXE7jVFkqy7dHttC9pJ+7Nxxy8yXeJ3yadpqGwfcwvgpIBvZtcs5MTR9xbBTbp+/a3BlH9NDNU3J4AkQ0QgbtljWLCQ0Sz6wpva11+xUusEjv+TbDHfcNBAvmd9ffa2ItO5X/sTYsl+1oNzSsuKbx9yUoNelNXlz55has= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066705; c=relaxed/simple; bh=t9prYQ5R/QNczm6DLTqQUsztYBFPrZkZLT1+x0wTetQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d3KA9hrf6xuR0lKCYLYawJFe5kSxmMuYY5Z/L14qrfyAoeKssUPcWFIiDQKEsvE8k/6VnMmRlin9H40D0vYB8ptYNIt0OVuzsWa6cMWQ9qe4xCm+oq1BrPqy+SSbDQEgoV2ykG4/9vM0+TDZ7lFgK28IjqGd4YotiiBpTO+WTME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=FvtNDIMm; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="FvtNDIMm" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TAjhfP2133306; Fri, 29 May 2026 14:58:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=g1D4FOhP0sX94oDuy 01ICrI8pDgK0OI7tEiSOa5IySA=; b=FvtNDIMmj6jgaFShSH75DC7tFBG7fiRqZ RvbNiqzyjb1VwpYLOrHGFaYFSf75UHhyUkRiEqtMAq/gCLuQvDZQkYQO4SdG5XOt 6Cf5o7su8J/krK6eMakEZY0uK8YppJP9qTB690MvFQrxQhNU7vSOMC61prE3VHz+ AlvEpE4qa/vtIp8ThDfe2/c0tLAljyxXTQt8939oJJ8Hr6hTM1x1uTQ876DIZhLP lgYyokmnLOmL0z6mJqp1InVCnRIdmcDFogNWHZJVOtXqScJai7/6/4u73Ke1RK76 qBGa8gXhHy6EqRdVYZrkfPqkulfEuB0jctv2FMSZt2EQbU3Pb2URg== 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 4ee887t6be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs7Z2005221; Fri, 29 May 2026 14:57:58 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4edjrc74ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvsZf46268674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:54 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C56C20043; Fri, 29 May 2026 14:57:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53E562004D; Fri, 29 May 2026 14:57:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:54 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/6] s390/bug: Provide ARCH_WARN_ASM for Rust WARN/BUG support Date: Fri, 29 May 2026 16:57:47 +0200 Message-ID: <20260529145752.1209016-2-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=QLJYgALL c=1 sm=1 tr=0 ts=6a19a977 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=_2yia0w1AAAA:8 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=gpATZORf9AIJ6E5TQREA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-GUID: pPPECtYoTcHRoGbgVZrcEv7yCdgXg6UH X-Proofpoint-ORIG-GUID: s9PzUE96grJ90uhgjJTkpN5Jp7MtODNr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfX4uzePk7v7zxd 4SFiRb38HPA6JiooiqXFpDW2R3DMcOMal9YbYnmiN5dUEKJc1R/mMc9Wy7+Q3hD5NZfI4DJ4scb L/QqOsMFFDuG+Aix9PN2Jo2e9p8ZK3OMnT79haaVBwYclNPXVi8+Mj1kp6Doy0jaWNtpj36fgp9 +HkSgIffDR2PUHynb7ryVg0xz5rtD3ZUN0QmNYFAW0gXwoESdHuY0PrcyxnLtUUt4UB/66c/TZz W2zapZ8/X0M+ohtwSvF/SkRBT2e9DS0qyhoS3TduLVIThIctjofu/ZPEOIA3pO6C5iBs1SuXKVy CI88UieugkCHsmbBs2xFoRJGBnusHgWSY2Vc7WLaWp0L20bU/FtiMQ8i1Y/L98WdjcoN+7+vMeH nskewOWszAljmIkNmtDxZ1o7PbC1Zs4O27oDL9w+HU/Jj5dFxifxyFrkZ7GGWvIIXNixQ03+hlx QREqEDRLmP0gKttx82g== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" Rust WARN and BUG support relies on ARCH_WARN_ASM to emit __bug_table entries. On s390 the macro is missing, so Rust code cannot generate proper WARN/BUG metadata for the kernel's bug reporting infrastructure. Define ARCH_WARN_ASM to produce the same assembly sequence and __bug_table entry format as the existing s390 BUG handling, including the monitor call. Define ARCH_WARN_REACHABLE as empty since s390 does not provide reachability analysis for warning paths. Acked-by: Gary Guo Acked-by: Miguel Ojeda Signed-off-by: Jan Polensky --- arch/s390/include/asm/bug.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h index 59017fd3d935..a72439370f62 100644 --- a/arch/s390/include/asm/bug.h +++ b/arch/s390/include/asm/bug.h @@ -4,6 +4,7 @@ =20 #include #include +#include =20 #define MONCODE_BUG _AC(0, U) #define MONCODE_BUG_ARG _AC(1, U) @@ -121,6 +122,17 @@ do { \ #define HAVE_ARCH_BUG_FORMAT #define HAVE_ARCH_BUG_FORMAT_ARGS =20 +#define ARCH_WARN_ASM(file, line, flags, size) \ + ".section .rodata.str,\"aMS\",@progbits,1\n" \ + "9:\n" \ + ".asciz \"\"\n" /* Empty string for compatibility */ \ + ".previous\n" \ + "0:\n" \ + __stringify(mc 0(%r0),0) "\n" \ + __BUG_ENTRY("9b", file, line, flags, size) + +#define ARCH_WARN_REACHABLE + #endif /* CONFIG_BUG && CONFIG_CC_HAS_ASM_IMMEDIATE_STRINGS */ #endif /* __ASSEMBLER__ */ =20 --=20 2.53.0 From nobody Mon Jun 8 10:56:41 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B036136C9C2; Fri, 29 May 2026 14:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066699; cv=none; b=tS8FcaSzLvfxMKOub9DZIXSIGaGBvOrV9d8Rk1bius8ICHWNoKLbpM2PR1wYrb2lJOpMtOce3eayy03zRQ5T3xo0dp5ghpg8GFKDqC9BaPW7YP/gexMqLT8bIaZEQmU5Z0TKIjK6xsBiDGrV1uiIlxZqZDomVZMcSg94pDsckBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066699; c=relaxed/simple; bh=UlEGYP8jSj19m7y5UJVI2ZyhNH8EIvLeJPip/Lv2Xuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c2eQ+H+laUxRtUVs9AAWf5/iFJo2mEuIJmuHiMYxmi7aTrbGw1vLx77Dvck5oHMeu9sJLMu0KeGHmvs8LhYTXu8zrKhTczLA/rsDyfo3R6zZ4DxWjz64QHqBkNIEuCjaOOWE3GA/fw/CHn1srqNxrjqUwbqoCXE9QhL8Q4QYPRo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=U4/nFoQv; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="U4/nFoQv" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TAosco1684644; Fri, 29 May 2026 14:58:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ZbqJ94R3zv4TlxZ4l Pc4zdJzKpGMXMz18Ox5ufJCyYU=; b=U4/nFoQvWtpnDPs5NgsviOC9xALQgm6ht MnvJAEzEqiF409LHTXoo0Wn1FI4dEGETwT5OusV++kQhYmsY8RqPVEVOazPBVqdw 1Uv8EaaiddI6dSFBUQW2iD5evAyr+RbDSfSLPVJ3uLO7rsrg9smtYcJwRDKpY8ZF bR1FOgLOblJKR6cOmaRlz/blB0vjxD2oIBP3jp0CTPu2rmJqvKMwfc6s52Rnwqlv QRYnKs+q04vXn0WUdRaDwRZa7en2E/25GCKLc29HE5aokAGYJMmFUpVRErIjpJDs e3pX1zwNJ5NLAzi30h2RrhzXwPTkTg5ytOgYlUsMvaDErpbktnIuQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ee884jkk2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs73q011911; Fri, 29 May 2026 14:57:58 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4edjrbf5qq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvt5l15073756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:55 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E786420043; Fri, 29 May 2026 14:57:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A19162004B; Fri, 29 May 2026 14:57:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:54 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] s390/jump_label: Implement ARCH_STATIC_BRANCH_JUMP_ASM and ARCH_STATIC_BRANCH_ASM macros Date: Fri, 29 May 2026 16:57:48 +0200 Message-ID: <20260529145752.1209016-3-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=fIYJG5ae c=1 sm=1 tr=0 ts=6a19a977 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=_2yia0w1AAAA:8 a=VwQbUJbxAAAA:8 a=1XWaLZrsAAAA:8 a=VnNF1IyMAAAA:8 a=V3UG4Yqg79Bxd1UTefQA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-ORIG-GUID: R9eW0Qss0zsCCnEpJgtD5pbCm2A7AZMZ X-Proofpoint-GUID: dxxobNePvy5wUELnQsC9OtlomR9g9tqV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfX3BisU75UTUcD FyJkXJ8/DfRNZm2WWRqYmM+uOudw8RPpASoc4OE8sbchcXc4LeEKM0bAspMVowir3nkMpZWY5fb uCArFUjQZBRbcZC/7DRV34trPhTfS3jjOevsilk3pw9LAzrOeywedBPjuWbeuNPfsz3Qa7Obttv mVroY6jwrnsv+boz/FVcq5/0WspxiIimkesfXZ4lji97ajFH7mcz5cSY/RcrphTkx1sAfaSMgCJ Tez1KJ6nq3xetAVEXEtLpq1yK+luUYLkw6ZbyKYNyakkXh03/8ez5NZGVz4ibU/zzmvQdk4z3Yq vZqgwjC01tOWHH8WxA5kBUgdherdBPNwi9GlpA328S5lDP7lxLPTYyFbsYqyCjOVFsSSJJ+niZx 0kKPuRZkuvbT1yUAL0lrmUUWg20e+AU4+7LB6TA9/O2AXXzaY6GW82SohbkLkSU+wzVMLUR3qj3 w03f6k9+3kB+nLbOfeQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" Rust static branch support needs the s390 jump label instruction sequence and __jump_table emission in a reusable form. The current implementation embeds the sequence directly in the C asm goto blocks, which cannot be shared with Rust. Introduce ARCH_STATIC_BRANCH_ASM and ARCH_STATIC_BRANCH_JUMP_ASM to describe the brcl sequences for the likely-false and likely-true cases and to emit the same __jump_table entries as before. Switch the existing C helpers to use the new macros to avoid duplication without changing the generated code. Acked-by: Gary Guo Acked-by: Miguel Ojeda Reviewed-by: Alice Ryhl Signed-off-by: Jan Polensky --- arch/s390/include/asm/jump_label.h | 33 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jum= p_label.h index d9cbc18f6b2e..0e28c90dc242 100644 --- a/arch/s390/include/asm/jump_label.h +++ b/arch/s390/include/asm/jump_label.h @@ -19,19 +19,29 @@ #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd" #endif =20 +#define ARCH_JUMP_TABLE_ENTRY(key, label, local_label) \ + ".pushsection __jump_table,\"aw\"\n" \ + ".balign 8\n" \ + ".long " local_label "-.," label "-.\n" \ + ".quad " key "-.\n" \ + ".popsection\n" + /* * We use a brcl 0, instruction for jump labels so it * can be easily distinguished from a hotpatch generated instruction. */ +#define ARCH_STATIC_BRANCH_ASM(key, label) \ + "0: brcl 0," label "\n" \ + ARCH_JUMP_TABLE_ENTRY(key, label, "0b") + +#define ARCH_STATIC_BRANCH_JUMP_ASM(key, label) \ + "0: brcl 15," label "\n" \ + ARCH_JUMP_TABLE_ENTRY(key, label, "0b") + static __always_inline bool arch_static_branch(struct static_key *key, boo= l branch) { - asm goto("0: brcl 0,%l[label]\n" - ".pushsection __jump_table,\"aw\"\n" - ".balign 8\n" - ".long 0b-.,%l[label]-.\n" - ".quad %0+%1-.\n" - ".popsection\n" - : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); + asm goto(ARCH_STATIC_BRANCH_ASM("%0+%1", "%l[label]") + : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); return false; label: return true; @@ -39,13 +49,8 @@ static __always_inline bool arch_static_branch(struct st= atic_key *key, bool bran =20 static __always_inline bool arch_static_branch_jump(struct static_key *key= , bool branch) { - asm goto("0: brcl 15,%l[label]\n" - ".pushsection __jump_table,\"aw\"\n" - ".balign 8\n" - ".long 0b-.,%l[label]-.\n" - ".quad %0+%1-.\n" - ".popsection\n" - : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); + asm goto(ARCH_STATIC_BRANCH_JUMP_ASM("%0+%1", "%l[label]") + : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); return false; label: return true; --=20 2.53.0 From nobody Mon Jun 8 10:56:41 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400673FB7C7; Fri, 29 May 2026 14:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; cv=none; b=U+8B04g++9HAZ0aAFdzEQ/OJWaZ/ankcqRIu3ShUAWpQe9hfEHxPDi8bJww9WzULvCg2TI9EtzdNliapYANU9HDMo4a3dLQ191xkpvF95NKlLqbbu2CcCpw8B5f/qDdXWMmcyXf1BS9VTue5SZGZudtacHBESvy4IhBVkuA0Bxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; c=relaxed/simple; bh=IWO7Uo2KXbmdRgXy4ayEN3ftvPxNIpRdKDci4TWZnjU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q4dMkhHHmltRdu+i1K9X6phxHZAGEhaL0pz52UpMDLTms0oG/KAVMHwTgsVu+kOt1/LFr/076RD+DzwFwVGeQY6cteBwC6jf3bqvxI3ULKn92J4P6I4yc81Q5Ml1F+8CjIQfZG0ZJc3fpvGSCwuKkACGEt4MK9IokxmVvh3lhzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=gkAGQP5R; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="gkAGQP5R" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TBjf0K1467798; Fri, 29 May 2026 14:58:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=pphvuZo/ASvzdbuEo /WD9Nm83V0JqGg1rFjkIn+HN9o=; b=gkAGQP5RcC8SzmkPasGG9M9kw6fVgyKDs 4Co4KEebp1VmZd3JQEIG/tErrnXcQemWsgbAvCQgQF/8AMBezrF+W6tupSUjliSY MJ1cfApJXOSToUdvOQ3Sx9Bd4AxzXaGN+fLAv4Go7H4QSMMxG5niPwduJA5l68/x 1d5Itu3cc4cCkXan8EepPkIdrj/OFZJAQVepF0cY/FQwnWjOtpA2ruwmeFFRzyWc lEOyW0CYwSEIQbIZIzREltvY0rBPcGIMxreiALkGYGlBKhNvCZ+f7PPdRUpc3D6v qdhG3HfF90JlIV5l7qh1h0bEZvIZwP7yuDq3Kete1RSSwBsqs5sFg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ee886jjpn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:58:00 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs8Rk006469; Fri, 29 May 2026 14:57:59 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4edjrbf5gj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvtlh15073758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:55 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4213520043; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED3EC2004D; Fri, 29 May 2026 14:57:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:54 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/6] rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts Date: Fri, 29 May 2026 16:57:49 +0200 Message-ID: <20260529145752.1209016-4-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: EWIHXImlfenCgyctbqHiQXdxCizZA29x X-Authority-Analysis: v=2.4 cv=Z8Dc2nRA c=1 sm=1 tr=0 ts=6a19a978 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8 a=_2yia0w1AAAA:8 a=VnNF1IyMAAAA:8 a=7MZg_RI75Eq2x-0mQykA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfX1E/tl8E3Q57k wH/SCnWRL1rTxRGs0/YqK4fgoKQ6Utg0YBwR9dD4ZFOn/c1lza/awADWt1fhm9Gn8eoNTs88eR5 Z+o5v+RTIKQG9cLN3sks55KY6x10m5WlkqLjXiVX3gOsI6CuMot3J3uz88pUJQJ7qkLHL4lU9kL oIPdid+58AlvZs+muduUbtaW84L8uX2/8QE8EsWYfxXPz2k4lwV3AD7MXqn1zYSnYBHzDXe6kAQ 4G4WwrkwEoQvoPg7tHDshU9knuNYNTig88A3Bgd/qJa8vjLJFJQkDTx8gJEEsHcCLzhOVsahOX4 CGGWcIdUa2bMnosiPkBv+Z1WVVZmk8//jiDb9uUz7SusceCSUAJBlqpIrSMSKCKRzFUFJviwtXW /wKPi15kO+TJfjarzn03BM1W5hQEeQLcqE/TkLpAY0xntKpJin2w5NLdX1dXxN4sR+IkzwLTWCR P348Re2D+qaSzRgKe7A== X-Proofpoint-ORIG-GUID: LfFPcSpBDPNJXjUOzMLZjGCH7819_j_E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" Bindgen attempts to generate Rust layouts for a number of s390 structs that are packed but contain, or transitively contain, aligned fields. Rust rejects such layouts with E0588 ("packed type cannot transitively contain a #[repr(align)] type"). Add the affected s390 types to the opaque type list so bindgen emits opaque blob types instead of full representations. This matches existing workarounds for x86 types such as alt_instr and x86_msi_data. References: https://lore.kernel.org/all/e5c7aa10-590d-0d20-dd3b-385bee2377e= 7@intel.com/ Acked-by: Miguel Ojeda Reviewed-by: Gary Guo Signed-off-by: Jan Polensky --- rust/bindgen_parameters | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/bindgen_parameters b/rust/bindgen_parameters index 6f02d9720ad2..8402b0c93545 100644 --- a/rust/bindgen_parameters +++ b/rust/bindgen_parameters @@ -14,6 +14,13 @@ --opaque-type alt_instr --opaque-type x86_msi_data --opaque-type x86_msi_addr_lo +# s390-only: same packed/align issue as above (E0588). +--opaque-type lowcore +--opaque-type tod_clock +--opaque-type tpi_info +--opaque-type uv_cb.* +--opaque-type uv_secret.* +--opaque-type zpci_fib =20 # If SMP is disabled, `arch_spinlock_t` is defined as a ZST which triggers= a Rust # warning. We don't need to peek into it anyway. --=20 2.53.0 From nobody Mon Jun 8 10:56:41 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C77F3FB06C; Fri, 29 May 2026 14:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; cv=none; b=rAEZv25g709JPRQyLjhijI1gBuB80beeZRoRJGVeQCZAFqVk1oJyktyBpmp72VEgTERE9ulSuzO1R1lm130Rf2M06LYVFipd6Z+njFUMZ+kYdEpHYiXR2nHhmRFN+wDveSLb0H8fb53vmq1B7lURBLaqOOIyxrWDpi6gLqGFNHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; c=relaxed/simple; bh=IzaHGNo+wI02TY1vL/z8Q0HtpWru8igkQzbYsUb+gmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mBGMi/aSSJrv5lwQAQN3CPVo5aOTvDapblj1p0YznpZcyOvcZwHNiNBeJ77QClrNIF1zqzfEIMdoC6+Ttk166/xTagari30r3wQsstsXxngo8W+hfUwEsHJ3KDUO3PDdKlGAm7UNnVyVlMf/uzg2LHh/ywMeg8a0vgSRj+xRjRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=OX2caTQK; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="OX2caTQK" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TETswi1467859; Fri, 29 May 2026 14:58:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=gLV57L2cE79gIsPyQ 15hh3VU7Mp3tzfLpiwC7VM+Z8I=; b=OX2caTQKb/QG/dxBcYHdP1SXwore7yhs7 PT5G0UpdA+l3pVDrD1MJNjAchPxKuJDsz4n20ulZJAcQvYOjaX5foKdK9AXBH7TI uDWg7Oj+izGiwgpQyBSxlFdFwvBFXDuLeQMb4O801xRRoMlpP9mMpQc6wova8vDN S2332tIc0Z+6wchEb42xexnoKPBfKoY1RO/9TqrrJEsOCsgu6f+QVvjAAIr6w7j8 LhUx8Ai7b8iY9964v6f/NBC2XPD0KkCWC1mATimZR6lK4flYuJJzxMuSb33C7DHt G7w3/14qDJU3FjaBDyy3jXSrPzGLh1WTayUmTemUu3L/6I0tqxS6Q== 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 4ee886jjpy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:58:00 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs79a000697; Fri, 29 May 2026 14:57:59 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4edjrby52g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvt9q22151690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:55 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9678A20043; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 46F5C2004B; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:55 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/6] rust: helpers: Use __builtin_memchr directly on s390 Date: Fri, 29 May 2026 16:57:50 +0200 Message-ID: <20260529145752.1209016-5-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: vV_9jLwsdk_Yi6R_FsAr5d08pjEHK2l3 X-Authority-Analysis: v=2.4 cv=Z8Dc2nRA c=1 sm=1 tr=0 ts=6a19a979 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=IDKdOGsrxnk7c9Cu3JMA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfX6/uoqH9kLBPN F24UiH0lwfmVDTGHpoxjSBNEjDXVhwpxTENliL7UbyoKkuOFnaV7G6E4BjdZ6Q0oa0zs3N7S87B MQWqJm3fGFa6qNu7gSTTx88v0gwXIii0foLYKxhm/zLer9pKDSUNMqk+Ym1/KkyOr30aJmRRXxl /NxcKkecBwuGWe/rBh0l+2Tt1zbz67EDh2mcCLdZ5UsT7puaz+i7Jhm0jRFRgGjSlbLxn2YybIk 4h9hqU1R569RhdOVVqr/FhwgjlI4NyLFEWevhoYtGkefy/LMO99yhfJF0byaTuDUsTowSzQp3Qu LZ2VXNCvZRoKc2E/5nshiiPi8dg/OI/Doii3/fBS+fBQNdcX3bhJ5vq9JVkHJraq2KDnX7puvHr JXynzrdXCUljpfKvesNjgLe9ZHVaFmFRiDZbC1335NhNAAYetoex4cKaW9LK6dU0oYcKuMKtsJx OjxoJuwAI/bX8GUof4Q== X-Proofpoint-ORIG-GUID: Bm-_96bkl9LvOTzOMAlamic2RTseClsJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" The __underlying_memchr macro from include/linux/fortify-string.h is not being expanded correctly during Rust helpers compilation on s390x architecture, causing a build failure: rust/helpers/uaccess.c:40:16: error: implicit declaration of function '__underlying_memchr' The macro is defined as __builtin_memchr, so use the builtin directly instead of relying on the macro expansion. Reported-by: Miguel Ojeda Signed-off-by: Jan Polensky --- rust/helpers/uaccess.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c index d9625b9ee046..d4107426003e 100644 --- a/rust/helpers/uaccess.c +++ b/rust/helpers/uaccess.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include __rust_helper unsigned long rust_helper_copy_from_user(void *to, const void __user *from, unsigned lon= g n) @@ -27,3 +28,9 @@ unsigned long rust_helper__copy_to_user(void __user *to, = const void *from, unsig return _inline_copy_to_user(to, from, n); } #endif + +__rust_helper +void *rust_helper_memchr(const void *s, int c, size_t n) +{ + return __builtin_memchr(s, c, n); +} -- 2.53.0 From nobody Mon Jun 8 10:56:41 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B03F73E5A2E; Fri, 29 May 2026 14:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; cv=none; b=QX9JNopTMp3pjQxcOd4tadQa0Pr7tUXd9HkhvRwANNtkPTm1s4xwATY4V+lKgN6WFAk+GOsRmJWXOatT74+cp7arCRJnHqF5B1GFrN4T9M8lHMzpxry+hhL3hwmK4Ck75xVxTU9BmPfxt8B1iYr7mvy5xf1LlsBVRx72pG9qmkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066700; c=relaxed/simple; bh=XXWBG0v/dCruQJ6/OLnskMnp6HMzg3Wt/R4URVKIf1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J9FHlJcSocE6DnY/We4Zhr3B53rkjbLLMJ3jZf7fsKL3m4iljU2bqkQxjdNK0KNZBNzUpi0L9y1db73/8DBNoC/yhDq6ih/EkiSHmCxw3MzLozngpsDjw1UrM73uktljAbzITWmLDwnBk7OBXk4cq5ava9hT9grthmyQlPSwtXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=ZrFKRlRr; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ZrFKRlRr" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TEdjWU2418247; Fri, 29 May 2026 14:58:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=kP9ndZg5wFaJoUa0B 3eCJsB4VeU9eiqBZ7cvmQx9k+s=; b=ZrFKRlRrPsf6p8giUVj5EbT9+DjIqzkNr MY6XJaLqS/p7/0oc2ofYYVXRUQiveoAA3YBmmUHCE1YinshvMhEPdGgyFN4+ZZWE D3lbLZQ6vvRO8oitFHiFgSPR7KpOkmpqvdI86MydX+kWJEYoEbKzQ4NLMHK4AyZ5 79tR/gNsx/cnTMcn2FYO5cdLylMyP4zbR8r+uy5aS6ndo8ce3UVxbCWTVGcZgkXY dtnitUcCsvbgBQf/Q9vi56Iv9qK79XX7H9WbP9p+SpEIAJpAdYQHmnL5/XBUHBGi HCRaEbqmHJSHh+NEHv0J3Q/AfQUlpHVDDv9TYP69px9RhhWCZkiZw== 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 4ee884tnw6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:58:00 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs6Ao026544; Fri, 29 May 2026 14:57:59 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4edjrbf4ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvujW44761512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:56 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4E8020043; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C28F2004D; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:55 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/6] s390/cmpxchg: Fix KASAN stack-out-of-bounds in atomic helpers Date: Fri, 29 May 2026 16:57:51 +0200 Message-ID: <20260529145752.1209016-6-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=L4MtheT8 c=1 sm=1 tr=0 ts=6a19a978 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=pGLkceISAAAA:8 a=_2yia0w1AAAA:8 a=VnNF1IyMAAAA:8 a=9-FPAKYo-0jGICd3_CYA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-ORIG-GUID: egA_7cV0gytuu6FjtcJZOc0ympGv0M8T X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfXwXzEVAzemXQ2 mckVK9nBDA8v82BQDtqQbc8tXKZpETBzhOOnMGqliSLSmNzBN3q4jGpiswBwdO6OmldDOtXozt+ DjVoI78k+vR2XcGbfk30VcFDttiBAK48bnjapUw1Xu1toGlWImMplGFxtJdZqFZ5ZlJguJIw9tQ +bnz7NBGpJ2BAEnTc/JePiO89kpHCysCGDQPEPcqTzBXP6L+UWQYfzBukKiJp4iB2I7r0ZXrNbO EMVpWzA0KnJc3ortD5+gzGc80+3fHryvYv+9o+CYkAXOVWZLpCsBVoVzdbXUaFzZmPkC+urYmbZ EnDVpiPkaWLQIGYURQEOZT5ht9k6z0JpGtfumQpPCeAdRBuREtVltSrSLxjVgEUvX+4Y8NkNDco l3Eql60nqTdJVLCWwwX0QCoWagmkCKHpXji343uX+Vn9RuIaLpyqyA/4HiypEJtKGy9X9NIIbBI 2pDtqiWpFLGJElLnClA== X-Proofpoint-GUID: xY5V1Wui0CVgmO4f0LZkP54jbn2xx_k1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" The __arch_cmpxchg1, __arch_cmpxchg2, __arch_xchg1, and __arch_xchg2 functions emulate 1-byte and 2-byte atomic operations using 4-byte cmpxchg instructions, since s390 lacks native 1/2-byte cmpxchg support. When KASAN is enabled, the READ_ONCE() operations in these functions trigger stack-out-of-bounds warnings because they perform 4-byte reads when only 1 or 2 bytes should be accessed. Mark these functions as __no_sanitize_or_inline to prevent KASAN instrumentation while maintaining correct functionality. This resolves the following KASAN error during rust_atomics KUnit tests: BUG: KASAN: stack-out-of-bounds in rust_helper_atomic_i8_xchg+0xb2/0xc0 Read of size 4 at addr 001bff7ffdbefcf0 by task kunit_try_catch/142 Reported-by: Miguel Ojeda Suggested-by: Gary Guo Signed-off-by: Jan Polensky --- arch/s390/include/asm/cmpxchg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxch= g.h index 008357996262..e6ac55cf3c17 100644 --- a/arch/s390/include/asm/cmpxchg.h +++ b/arch/s390/include/asm/cmpxchg.h @@ -35,7 +35,7 @@ static __always_inline u64 __csg_asm(u64 ptr, u64 old, u6= 4 new) return old; } -static inline u8 __arch_cmpxchg1(u64 ptr, u8 old, u8 new) +static __no_sanitize_or_inline u8 __arch_cmpxchg1(u64 ptr, u8 old, u8 new) { union { u8 b[4]; @@ -58,7 +58,7 @@ static inline u8 __arch_cmpxchg1(u64 ptr, u8 old, u8 new) return old; } -static inline u16 __arch_cmpxchg2(u64 ptr, u16 old, u16 new) +static __no_sanitize_or_inline u16 __arch_cmpxchg2(u64 ptr, u16 old, u16 n= ew) { union { u16 b[2]; @@ -173,7 +173,7 @@ static __always_inline u64 __arch_cmpxchg(u64 ptr, u64 = old, u64 new, int size) void __xchg_called_with_bad_pointer(void); -static inline u8 __arch_xchg1(u64 ptr, u8 x) +static __no_sanitize_or_inline u8 __arch_xchg1(u64 ptr, u8 x) { int shift =3D (3 ^ (ptr & 3)) << 3; u32 mask, old, new; @@ -188,7 +188,7 @@ static inline u8 __arch_xchg1(u64 ptr, u8 x) return old >> shift; } -static inline u16 __arch_xchg2(u64 ptr, u16 x) +static __no_sanitize_or_inline u16 __arch_xchg2(u64 ptr, u16 x) { int shift =3D (2 ^ (ptr & 2)) << 3; u32 mask, old, new; -- 2.53.0 From nobody Mon Jun 8 10:56:41 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3CC9407CE4; Fri, 29 May 2026 14:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066705; cv=none; b=uMtYU9vShWZIyyxxiuqgfT9LcWQUq5uoRXcrlhnMK9JQMna/7jHVi41dJXk9L3RtkGA6vPfD4928fKURqQqqr/SV6HM8G03AE4yNHV6zsQ2o3GGpc6QtBr6AN7D2JKxwcTMKPs2M/jLZIIgT37MO8ICCPrCkiKKXRKJsM6k+FN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066705; c=relaxed/simple; bh=+s4EAgt5oeCOZsZMGoJeB1wSEWIEp0X8A2PtY7urlc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tBjmTkr7uwQ05KiSAVpx2p4vcufKpdfWHGbKNqCCNs49Q4eC0+wIpEsPeY36rkpK1YMKLG/3D5VNfzGYtnt58qYenUn9n9IsCPRbK3ULxguV0+1hDuoCqSKQz0yHyUT+5oBjziRAs7eH0DaBIeFd3+dRNoLY51EKTo2nFveCLs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=fuPdIdQa; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="fuPdIdQa" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TBARcv3218468; Fri, 29 May 2026 14:58:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=DXiytoeGyO7kgBmmb h6FhjAYCwg4hBJWO7+aT3ceJig=; b=fuPdIdQaJjHmybkJJPXY8E+ck7I+ALx6K ReZWBeBCaT+JxY0GUwKuMDjDqhfGKPwXQYRLZpJsfJTiPRURHPAWTCrovFruc5Kh o66ybIka/zXHDyVU/+7ERoBQ3K2wui8rkvDMrDbctUeJjg6p+4e1amsXtSmb4Cdw 3qxFQ4WouL4sWADDp4JOrjWVXPAQbW1JpDeXMvW0ztoqXes3P9cDYtVtQ/LP4kC4 Rz6taFrOOhxyyGbRrUSN616tvP0CCn2t00oahr7mRE2vu273LeIUuRhc23mCFv45 TGsA6Dyy7rlu2vmywNU3qdVfkQYkT5Sl3FZeqLsvmvVHuf9uYtR1w== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ee88bj67c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:58:00 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64TEs4Cl019159; Fri, 29 May 2026 14:57:59 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4edjrbf5js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 May 2026 14:57:59 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64TEvude38535604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2026 14:57:56 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BE5920043; Fri, 29 May 2026 14:57:56 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA0C82004B; Fri, 29 May 2026 14:57:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 May 2026 14:57:55 +0000 (GMT) From: Jan Polensky To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ojeda@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, rostedt@goodmis.org, ardb@kernel.org, linux-s390@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 6/6] s390: Enable Rust support Date: Fri, 29 May 2026 16:57:52 +0200 Message-ID: <20260529145752.1209016-7-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260529145752.1209016-1-japo@linux.ibm.com> References: <20260529145752.1209016-1-japo@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NiBTYWx0ZWRfX78F1ms+qKgOG B/NEOKUudNcHhz2dCihTfquAHeGBOPa4cmNrTN4TdLBhF8XDdur8ZZEmkl9rGMnCEosQItUtTFZ Ooq/xEQ4MZbz7cVM2RZCiN61GL4VGYcUW6yV+yJFw12dfHTtxt2NXNi51pJFQtaPP5g7V9BkhRy OAvF9mwe+JFkBbrwflwJGMS+qHCdTUE8gyfIIxSt9M4gyZ8ud6by7QXnwArkRmT6atV2h+F2JEG u7InWc5vq47f/Gcr6fSu/uSVxjRnJzZRfcOkQuRXWh/Dvf8wBc2fCHUIryhBvmXK4XzKwJYs9Jo jOvIrKhFYmeRlwORd6+pCa78K6kWdxevKsin7quNLW/jyNdkz//bmyI9iWmoIA8MU7CNL5JcfjD NgAueh4blFa9QXJJ4XcTZDlctq44isogHY52Xc6i0cznuEt4J5bq1KlZYFEH/ddaxvZzk2fL4Y+ jd1Gn0JHvcSVn0qTk6A== X-Proofpoint-ORIG-GUID: YihyEVYUJ2FcuNfYdyJqffDwHah-6R67 X-Authority-Analysis: v=2.4 cv=IJEyzAvG c=1 sm=1 tr=0 ts=6a19a979 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=dVHDsLM4Y7J7NbvvS_QA:9 X-Proofpoint-GUID: cPWxpLrl1iWNw4_aUgECQ7Hq-5idIKQ5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 clxscore=1015 spamscore=0 bulkscore=0 adultscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290146 Content-Type: text/plain; charset="utf-8" Enable building Rust code on s390 by wiring the architecture into the kernel Rust infrastructure. Add s390 to the Rust arch support documentation, provide the s390 Rust target and required compiler flags, and set the bindgen target for arch/s390. Adjust the Rust target generation and minimum rustc version gating so the s390 setup is handled explicitly. The Rust toolchain uses the "s390x" triple naming for the 64 bit target. Rust support is currently incompatible with CONFIG_EXPOLINE, which relies on compiler support for the -mindirect-branch=3D and -mfunction_return=3D options. Therefore, select HAVE_RUST only when EXPOLINE is disabled. Acked-by: Miguel Ojeda Signed-off-by: Jan Polensky --- Documentation/rust/arch-support.rst | 1 + arch/s390/Kconfig | 1 + arch/s390/Makefile | 28 +++++++++++++++++----------- rust/Makefile | 1 + scripts/generate_rust_target.rs | 2 ++ scripts/min-tool-version.sh | 6 +++++- 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-= support.rst index 6e6a515d0899..4f980815e92a 100644 --- a/Documentation/rust/arch-support.rst +++ b/Documentation/rust/arch-support.rst @@ -19,6 +19,7 @@ Architecture Level of support Constraints ``arm64`` Maintained Little Endian only. ``loongarch`` Maintained \- ``riscv`` Maintained ``riscv64`` and LLVM/Clang only. +``s390`` Maintained ``CONFIG_EXPOLINE`` must be disabled. ``um`` Maintained \- ``x86`` Maintained ``x86_64`` only. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ecbcbb781e40..26951781d74d 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -248,6 +248,7 @@ config S390 select HAVE_RELIABLE_STACKTRACE select HAVE_RETHOOK select HAVE_RSEQ + select HAVE_RUST if !EXPOLINE select HAVE_SAMPLE_FTRACE_DIRECT select HAVE_SAMPLE_FTRACE_DIRECT_MULTI select HAVE_SETUP_PER_CPU_AREA diff --git a/arch/s390/Makefile b/arch/s390/Makefile index 297976b41088..8b712cd85fcd 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -35,25 +35,31 @@ KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_DEBUG_INF= O),-g) KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call c= c-option, -gdwarf-4,)) KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-arr= ay-bounds) =20 +KBUILD_RUSTFLAGS +=3D --target=3Ds390x-unknown-none-softfloat -Zpacked-sta= ck -Ctarget-feature=3D+backchain + UTS_MACHINE :=3D s390x STACK_SIZE :=3D $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,1638= 4)) CHECKFLAGS +=3D -D__s390__ -D__s390x__ =20 export LD_BFD =20 -mflags-$(CONFIG_MARCH_Z10) :=3D -march=3Dz10 -mflags-$(CONFIG_MARCH_Z196) :=3D -march=3Dz196 -mflags-$(CONFIG_MARCH_ZEC12) :=3D -march=3DzEC12 -mflags-$(CONFIG_MARCH_Z13) :=3D -march=3Dz13 -mflags-$(CONFIG_MARCH_Z14) :=3D -march=3Dz14 -mflags-$(CONFIG_MARCH_Z15) :=3D -march=3Dz15 -mflags-$(CONFIG_MARCH_Z16) :=3D -march=3Dz16 -mflags-$(CONFIG_MARCH_Z17) :=3D -march=3Dz17 +march-name-$(CONFIG_MARCH_Z10) :=3D z10 +march-name-$(CONFIG_MARCH_Z196) :=3D z196 +march-name-$(CONFIG_MARCH_ZEC12) :=3D zEC12 +march-name-$(CONFIG_MARCH_Z13) :=3D z13 +march-name-$(CONFIG_MARCH_Z14) :=3D z14 +march-name-$(CONFIG_MARCH_Z15) :=3D z15 +march-name-$(CONFIG_MARCH_Z16) :=3D z16 +march-name-$(CONFIG_MARCH_Z17) :=3D z17 =20 -export CC_FLAGS_MARCH :=3D $(mflags-y) +mflags :=3D -march=3D$(march-name-y) =20 -aflags-y +=3D $(mflags-y) -cflags-y +=3D $(mflags-y) +export CC_FLAGS_MARCH :=3D $(mflags) + +aflags-y +=3D $(mflags) +cflags-y +=3D $(mflags) + +KBUILD_RUSTFLAGS +=3D -Ctarget-cpu=3D$(march-name-y) =20 cflags-$(CONFIG_MARCH_Z10_TUNE) +=3D -mtune=3Dz10 cflags-$(CONFIG_MARCH_Z196_TUNE) +=3D -mtune=3Dz196 diff --git a/rust/Makefile b/rust/Makefile index b9e9f512cec3..77460502f576 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -403,6 +403,7 @@ BINDGEN_TARGET_x86 :=3D x86_64-linux-gnu BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu BINDGEN_TARGET_arm :=3D arm-linux-gnueabi BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf +BINDGEN_TARGET_s390 :=3D s390x-linux-gnu # This is only for i386 UM builds, which need the 32-bit target not -m32 BINDGEN_TARGET_i386 :=3D i386-linux-gnu BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target= .rs index 38b3416bb979..8f1df6819d0b 100644 --- a/scripts/generate_rust_target.rs +++ b/scripts/generate_rust_target.rs @@ -256,6 +256,8 @@ fn main() { } } else if cfg.has("LOONGARCH") { panic!("loongarch uses the builtin rustc loongarch64-unknown-none-= softfloat target"); + } else if cfg.has("S390") { + panic!("s390 uses the builtin rustc s390x-unknown-none-softfloat t= arget"); } else { panic!("Unsupported architecture"); } diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh index b96ec2d379b6..296acf8f71aa 100755 --- a/scripts/min-tool-version.sh +++ b/scripts/min-tool-version.sh @@ -31,7 +31,11 @@ llvm) fi ;; rustc) - echo 1.85.0 + if [ "$SRCARCH" =3D "s390" ]; then + echo 1.96.0 + else + echo 1.85.0 + fi ;; bindgen) echo 0.71.1 --=20 2.53.0