From nobody Wed Jun 10 16:01:10 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 1CAC83D9041; Mon, 8 Jun 2026 18:15:21 +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=1780942523; cv=none; b=kG1iOmlZmQML2UPJCi5oWtAvVM7dkya2sxQKOp6wHt6CbOvbj9gXnKYHfKlqRwb3gJ0okQIsZmgA2N5XNxLJ5T4Z1pZzxUDBJZOrrwo8LsxM9dapC1AgQ6kMLZDT7hKKjriLQG9YIPXYIOqLIhuxklFF7VjOIDC8a7mx8XUh58o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942523; c=relaxed/simple; bh=zkPVQ5iYH5V51TRpOLygowOTrddfFMZjzV6XMnDtx74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BnzefbOMHO+/B4592Zf1T0V6Zs3WmDGXQab6DfVPYZiJw6Npjso+2+oTIwL7wvtDBnGXNCJPgx0xyrsKNVbDer6cMg7Zg7gwUApVpQIPGSzYw5gs03xyh3rYf9tTFN04bjJDl7TWCRJ8QDu6wOlxYeE5DvbAPWnasD3Dx7y5gt8= 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=GXtXnhzH; 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="GXtXnhzH" 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 658GePdq1207171; Mon, 8 Jun 2026 18:15:02 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=pCgArfWh1z7dGTQUN PDJcBjiw2AR1reflJVRbNUihc0=; b=GXtXnhzHNJFda3mT15Uhu2TGkjPVVgxP4 aM4fVT+p8jHRH0+lG3jXLQ6otW5oRWxZZors719sa4JC5aOmIkpGb6jHjrh9qV4j 3Dio9i9nKSjIha+Ym3a+oR0HfanDt972pEB4bg+kdVek24DKdatdWaos2KwsoaZo NNcLGr2EvdZSKEb9rC1DyLOooAtB0r+qIEG1InjK0FeXw9K01F6FhwK5vwRB1927 dJ9ryTPHyek4vami1tMU/mFIDnzBbowNzNGOP97jmvRLwtjMTedIAJ/yhHoFWO4n 3qNTk0iqwRapoJ/NDuupxR8A75nNvcuYfnqnIBGxDKUFWvowBlJvQ== 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 4emb6srgxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:01 +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 658I4bsv002573; Mon, 8 Jun 2026 18:15:00 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4en0jy6a8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:00 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEuHL49938796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:57 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA96A20043; Mon, 8 Jun 2026 18:14:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91EAD20040; Mon, 8 Jun 2026 18:14:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:56 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 1/6] s390/bug: Provide ARCH_WARN_ASM for Rust WARN/BUG support Date: Mon, 8 Jun 2026 20:14:46 +0200 Message-ID: <20260608181451.3734956-2-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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-ORIG-GUID: cqWWZqCMqnBHxHEqlw20X-eTaoDawo6w X-Proofpoint-GUID: tKqqsRX7M-TElpNUXI2VZEK0qEZMhIWp X-Authority-Analysis: v=2.4 cv=ZbEt8MVA c=1 sm=1 tr=0 ts=6a2706a5 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=FelO9ux0wxsA: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-Spam-Details-Enc: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfX1MFDIxFyn6A+ nsbsK7/rYh0lui5yJjBXhaS8zFMFfA2dUPlrQL/pqWLiTCudOmRaW+2aIss+8Z1zkqzjgSQW672 h+sMmsUNQ/ftuFSVe3fA3qNBxD5Ps1CP6mYwT5jq358w0OMA7NGgrv9hvTR+X6Obu0y/m9H69xp k9P+P8gy17uiJ+1NJ51+AezJJwDfK4ZTOsaWnwqlUNzEPv458O63nvZc9XGN9tIBhVXAPxQQuTY OMrI7wEpnRD/4P+fsLlJx0eo+NKPRbpEMufgtj4hUlXYcF98eK5yeqZmT+5So60LqTQt7VDSZLR Pa8Z46v2htzL5RLkNX4+nnh2cKUYwnQXfGWv64kQvJ4NFOk4aHttsokTXBUmh55Mgk0aAlePT+2 9S4BlmvQ/EyRcOTXep5B9XR7FoVvnc1zpsb35hRQiF8GxBlnqG9w2G/CezkDIhwm2Kc8T8uM0wE 9LAXCwbxBGotnTqlyYg== 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 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 Acked-by: Heiko Carstens 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 50a270edb020..2010342c97b1 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 Wed Jun 10 16:01:10 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 0EF123D8915; Mon, 8 Jun 2026 18:15:20 +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=1780942522; cv=none; b=eyHXzhbPFknP1FqPoxkKdLafpPtJ9U5bTmj280i9ZEPoYPlJ9gkkrp0umCA7I0FNEKA7KDpJ5MQhzijO8nKB1T7O3kWK5Bc41wg1c7mwwNzjW2Y+9hi9k133bZgyVf7/EwfGT1E5odcf+gpCtUGjXlsv9wgY1Ed80lkntt1skLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942522; c=relaxed/simple; bh=NsiXgfMjrDJjgxqe+NpRrQ8wAejU9KwZ6faRF02L4f0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LDWvOHLd60COVf2GoSgVecEvVvQngO41+nBFuVJlHRzylM3PcJUUd+QMQ7AmK1ISAB7VG0aQI44e3+ASNtgmCeeCZJdsK6O/a0lZPbCPpbDkT/2tdWPytKbXlHhwYZ7a4mIw2O9/Ar20olv9r+AkH3ny0vDpRwg3R1r1ZmNeNBo= 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=KRWB3Fvk; 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="KRWB3Fvk" 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 658DZ7uZ3480113; Mon, 8 Jun 2026 18:15:02 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=R/d5uAGA/A/PtHXYL oaHW8B0R8vQ7C9tt0+DkWtuxpM=; b=KRWB3FvkDiSd/jIRcze09tTPXrpeWIHUR jtBkbaysCsp5g16LfFK01N5Vogd2gcorUptLlF1bqawydqSaUhmQSRFmUQYO8QQS Udd3Lr1LTZSGlL7X/iPTUkRjfxO5MzJ7GNd3MoA7Q73Hq1gw/f9gZ62sfpHMeAOR pEd0wO91sS+XzCDkINX6klijft/xEN+NTob17H7NTJdeiS83Fuau7fNHBQ3EiA8E 7FuAjRStYQ8z3o/AolpRXWkGQw6KTEG/NM8+T3PsCYBRFmpu2doL8Z9jN8XrWqOG ZQ1/izNgnxmO2r46hmxTZFMtdjNu2artBcw73KXL58mLu2I3ok7Zw== 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 4emb6srgxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:01 +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 658HnelM023294; Mon, 8 Jun 2026 18:15:00 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4emwvpxqex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:00 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEvVN31850832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:57 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3131E20043; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFBFD2004B; Mon, 8 Jun 2026 18:14:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:56 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 2/6] s390/jump_label: Implement ARCH_STATIC_BRANCH_JUMP_ASM and ARCH_STATIC_BRANCH_ASM macros Date: Mon, 8 Jun 2026 20:14:47 +0200 Message-ID: <20260608181451.3734956-3-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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-ORIG-GUID: Z3M_4wLGPtWh2W7wz7I_5icdE_MykGZ5 X-Proofpoint-GUID: VZPn9GfBXmu1Frxf4b_1GwIyAWZHWZ-E X-Authority-Analysis: v=2.4 cv=ZbEt8MVA c=1 sm=1 tr=0 ts=6a2706a6 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=_2yia0w1AAAA:8 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=1XWaLZrsAAAA:8 a=V3UG4Yqg79Bxd1UTefQA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfXwa0ysiCFKzxP dJ+1/0ZQ3DZ9MG3gIUmPIB9rpOSuYTFRAf8nbD0zhexdkok5teXkqFDOh4VQY8sQ6zEyL9pcwlK m7++oET3mV/dcKBlYSdlkptiX/eM1QZJSIzaQy7WhCprjHFws1Cto5mBq9M9BRoV998zY93CPxP ojG/sMwTAkWbLTPCQg97bjln3tI0aKI32sCxP+EdMlOjOlF0/9upvlTZOnKgFBtoZDGXr5LjjBm V9mFGxaoj27xldSAuUInshVC3TFwHVsGOdvgWP0QQO+bKmQayYaMti2A1UgpszHl4RaFgbEXTn+ HrisxQ8cBOBwH7x9reKyDzSr1hjB/CWy/4ek8D/0bWTqqzN6YOkpRBl+QrhKSqDWsN1f9TZ2vBP XknotTCcA3Rl2Xc/ZqP1QQL65dqYFs+Jclhp46UR0/R4JSBKpVJ/ruALWR1COUKUj2svMTcJ+Ny S0zU37ZgqvbOUhna+5Q== 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 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 Acked-by: Heiko Carstens 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 Wed Jun 10 16:01:10 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 7873A3D9035; Mon, 8 Jun 2026 18:15:21 +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=1780942522; cv=none; b=WLclCGPN659ziNAzMwmPRGorn5wzCkrWVgQ2KGY1BtOXwVN/hwaibjipjpec5sFCrv5tS/0Ch2tc4x60tbH/7KjC/mTJjMfRtXnemIkCDMzxGtBcda3UnP1YL/BiFLvgWbNi6PJEHx3xJZlbJRaavtDvVI4TPHdpGEuKTFIaEZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942522; c=relaxed/simple; bh=qWolF4Y3S+HO+T4uRPNwjeV2U2dgXoB68nyfNxJHb4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rc4U2+xOjeltomTFDbWyO+8sZEqEVct4sUvgaagqcyInUSaQCwqcsMiukgSI3CZBHk0W+2+upJQgZjOFuHS0NNc8qyxPJPXRujE4SvuLchixlagLIcjI4e73wCtx+mbnh+U2sbcILePqxjQGrYNt879mYOiAyHyQqY0JMZnsYMA= 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=WzHbmv7j; 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="WzHbmv7j" 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 658DWSQj2661850; Mon, 8 Jun 2026 18:15:02 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=XbnC7mQ2CCKjbfHIq J5fafLzxjlhe0unKwj/TF24/bc=; b=WzHbmv7jJazs36Kj423FnX7cJShIe8+Rr U2LYrSwXOCafFeATL83KHlNy20eaCDt5BEplraXolsI3ftK7KHG1kolw84WiXYKk 2DYLcFSekWrG8OdkYGI3g0iWSf4MIHFhVoBF8xCecP9chu75lz/OuoSrXSbXc/Cm w4+70LcvXk8WF1bY5SsB6t33jH6T50RdKu/OX+J7Cl50q/c66Ix1309r0mIYMypj SXIx71l0GCJ/JqDU00wOVOmt65UXjPka6phWiEiZJJ80Lx4rAiicMY+l/0+vamB9 JEzVQs1XeKHDmhmlToh3QWYAo0FZ4kSL3Dp+lB9GYdg7AAOQB5cAQ== 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 4emb958nrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:01 +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 658I4aiX003280; Mon, 8 Jun 2026 18:15:01 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4en03fxbv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:00 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEvZe51184006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:57 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EFAC2004B; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36CC02004D; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:57 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 3/6] rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts Date: Mon, 8 Jun 2026 20:14:48 +0200 Message-ID: <20260608181451.3734956-4-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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=N4UZ0W9B c=1 sm=1 tr=0 ts=6a2706a6 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8 a=VnNF1IyMAAAA:8 a=_2yia0w1AAAA:8 a=7MZg_RI75Eq2x-0mQykA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-ORIG-GUID: nZnCAixn83C8vFUhgsW4B4lDx3tKjYsq X-Proofpoint-GUID: R4uZvzQjh7xvVsjnY1PckTFll6soZAM_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfX1dF0VqaleRfT 4dBwcY2Pvx+m6zez6TvrJLv17jh2dVbu/vTdIp0Q1lPvpdmjnucAH7DnGMu5TDY3fCavoHiOIbe BkbTCwVQEORh7ZX+68bXBGObHqQQLiP+BT/AoNd3E1wCgWI2g1JSZ41VSodWTBFFE8IJmMMXZ67 DtgSyZU0CcoIjQaGzp42c+9SBJBfvDa6eVWS/NUeue99G6oqMTAUv/3loJeXG+tFtHv5dZAT1r2 bOD2wDG0WjYYBPFoPryDVsTMuQ30fDujRmOgqnK+TEqa9vBvUdCqstY2oxm+9a8/8uZaovCnrt9 jeaPzBQ2YQtV7QfNvM3YJkX1u4z7/cFXFSRak0Ph/I+bR5KSpDWXIXCkTFUZbGbzzMPz8nyz97T ZYN6dxegY8BUV/a5EQLF29ROmLaYgwjXb01aBm7rtul8TQIQ0Vwswkz6uuhVhExZB+10KdsPeJC 8qfCbypB3pBJ2QC3uyw== 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 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. Link: https://lore.kernel.org/all/e5c7aa10-590d-0d20-dd3b-385bee2377e7@inte= l.com/ Acked-by: Miguel Ojeda Acked-by: Heiko Carstens 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 Wed Jun 10 16:01:10 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 176593D9027; Mon, 8 Jun 2026 18:15:20 +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=1780942523; cv=none; b=bNHnXee4hDNbZ7Hap7ijAdz17ZSQdN1mHOSsdyC5gt9AwZFEf9j2jwPNuC6CjCzQhmgO9c1d2+WopMz9Ty3zpuGeJW5NEUbUikDFUZA1dyJcInMQon0Yae79geE8degcGXkY8NEa6ZCILZJ+LfkA9M/r7ccW/EOm5SbiEEyH3SY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942523; c=relaxed/simple; bh=z5aDbCkruTXiuZUIzSSdNkuEKChf6FJQ7I6csuaXjyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O2ydUXSJGhvvKTDt0HfjTyrH15/7MKkRJwtWqQNsNdkonb3dlBtx073sbHSM86l3IwinfgJtK6iXxHPdah9aafGhfsOwMt/8R2vqkPugEdwU0s45JDn8hSDbGnr9/VICsffwERecU50IjlP92QZ83RCoKG9xgTpXAYTr0XsCnGg= 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=b/Qi19Dx; 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="b/Qi19Dx" 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 6589dX9t2494942; Mon, 8 Jun 2026 18:15:03 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=tdPNMk18ImxNBGKmf 2uPkiF94pNknNIhO/Gpdrcft8E=; b=b/Qi19DxnOuPJZWD2D4d0VoLZOK4BnEoP eVPtXYe7XI6QAySHXZJ+Du2Yir3MAb85WMruiL67yhUivKbmxhliSof1n3g9iR9I UHD1QG0hRiyEGsyqIkEOD0p9mH9VRPQHd4bFa+t7vEnEySTsTqDf8MdiS9BWtJke T1AqDfAUMojbm3oiHP5gYo8CL4CuWb1kU6IbGta7hjrxkTBkmelMcLxFHA+eE804 AMa5egdFDXzyHTmy6dqwTa3dr0O21pvWh0c0kj+oUJfmmS0PgZs9LAWOY6MId2lc l3PhBcaynXDJiV10LvfoS61LhZ+kc7h0VMBwGznQxZRMsEs0z1J2g== 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 4emb6srgxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:02 +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 658I4dcC020169; Mon, 8 Jun 2026 18:15:01 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4emx8vxngh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:01 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEvfD50528534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:58 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D69DE20040; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84A642004E; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:57 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 4/6] rust: helpers: Add memchr wrapper for string operations Date: Mon, 8 Jun 2026 20:14:49 +0200 Message-ID: <20260608181451.3734956-5-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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-ORIG-GUID: KgDHuFQWEO2b7jqeHFl5EHnbGbKMNcyv X-Proofpoint-GUID: 1aIC8G-_gv_EdTTuBMIHZB_S_R0gn0mO X-Authority-Analysis: v=2.4 cv=ZbEt8MVA c=1 sm=1 tr=0 ts=6a2706a6 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=0OX8x8mQKUGR4pMsIeoA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfX72ZFz/lDI8Uz FW1UV0gC4jCyowrnujxMHlYQRL2r/gi6JxqbL0Jq3YxmAO8IaE4QRM0+1jiWsu5OKwg2xJ9+aRx mXZRD6eacVxZrMZq3ubLvwufmZ6dIQ6nWunmordD71Nz7fZCAYkzTUS6wdkxuH5vW9KzkZiNQoX jY8T50BXVWmgMaaxuImiRTuzr7EibZ1puqi0oyHmEta0wYw4I33+eiG1pS5puMM/6P1uukdXWCt bjDdokwnPpXpnAKbfOGIbQKlBCyalesWHMuBZNrQZY4iOlnKXgCOFNBPB0fnBB6Lg81oPBMGcV6 XWMcnnHv4LGcM3KVeV/hKg5k+Seu8hbC60ZcjvW4oj8PL8Yp05nnAun9rZm0H1lhdaF3q+sZsqS Sfj2BS0Hrvf6p9FLeQQ4O2WfdHkAY2mqCNlAk1q0f57crnljN9004xjsS46E3vw2DclGy0mULJf dfV6nVDrJJD7rQJIIIQ== 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 Content-Type: text/plain; charset="utf-8" Add a dedicated string helper file with a memchr wrapper that uses the kernel's instrumented memchr() function to ensure KASAN and FORTIFY_SOURCE protections are preserved for Rust code. Reported-by: Miguel Ojeda Link: https://lore.kernel.org/rust-for-linux/CANiq72mXAZc0sNM7ShX8VDVs_7zJd= dawP-e=3Dwt+ERr1YUCcWUw@mail.gmail.com/ Acked-by: Heiko Carstens Signed-off-by: Jan Polensky --- rust/helpers/helpers.c | 1 + rust/helpers/string.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 rust/helpers/string.c diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 625921e27dfb..592b9bdb4e4a 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -88,6 +88,7 @@ #include "signal.c" #include "slab.c" #include "spinlock.c" +#include "string.c" #include "sync.c" #include "task.c" #include "time.c" diff --git a/rust/helpers/string.c b/rust/helpers/string.c new file mode 100644 index 000000000000..8ef30eb07a15 --- /dev/null +++ b/rust/helpers/string.c @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +__rust_helper void *rust_helper_memchr(const void *s, int c, size_t n) +{ + return memchr(s, c, n); +} --=20 2.53.0 From nobody Wed Jun 10 16:01:10 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 011383D45E6; Mon, 8 Jun 2026 18:16:31 +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=1780942593; cv=none; b=iyY1PMAfCaj73GIDRH0WJq14p6OajlT6uuK39cWapY1l3YvaeHG5XUufLcZGafHzeOSdvLp8pE7P0OqQEns3YIDhs/x7wVy4Yr6zw1PAdLz+3mfNqoVIGGl/WGcEZ/hQw1SmC3Fn9iPI83C7Ma3jIGtX9eYOsU2yNr1m80qErxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942593; c=relaxed/simple; bh=N/5vqbnuG5A+AUDy826NEl00ECRgNaqNXW4fu1PiegY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jPLo6sp+ePDlMYg0pphbZMCVNF09JTrOnVgleRrscDACQaf0Qc8a1Hg/EzNEYvgsH3/kmZ6wTHdV9gU0SJPpFUwN0yyILCWYTRKW90cJZKPXYLk7PD/XVB0FdwnVe38lthi67/KSx5/w4yz1HUNOD0SYbjXhpUpWb9xC1jaiyH4= 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=NIZBAktc; 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="NIZBAktc" 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 6589xjj43804276; Mon, 8 Jun 2026 18:16:18 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=12TTVlDLRFRGHxgvl +8cBIsCTcACPNHnn18WCSFs7s8=; b=NIZBAktcWNotrIkV6mhOn81gsjJDtrsZi t+97eowOF3XK9qpKfygGUKD0wZC4eXQ1IQL9EwN1FfsfIPxdBMlD4xQZePQZxRWH Iw3U1axrPF+wDM4Ej5UjAEz/3a+zAJGmKBJ4OFnwVSNJEDz3JCeuLPp7hhn+/sS9 pccZ30v94pjoaO0cu5tAoB8R4LWTIP93uUHJHa7muiG2Gfxb5xYtgktNtDrbuKO8 S1p8wc3J117s4RMVI7FuwfC62SmjCV1lt4wSnscZ3096f9jp36s+wtsg/AhHvB+D u/Fv7KGEm9kSb1FEOfgl+D/VDUU7298xr9xH6dwZJz6V5gUIxcwtQ== 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 4em9ye0nc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:16:17 +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 658HnnER023332; Mon, 8 Jun 2026 18:16:16 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4emwvpxqn6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:16:16 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEwpb61342100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:58 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D74220040; Mon, 8 Jun 2026 18:14:58 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DBD9820043; Mon, 8 Jun 2026 18:14:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:57 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 5/6] s390/cmpxchg: Fix KASAN stack-out-of-bounds in atomic helpers Date: Mon, 8 Jun 2026 20:14:50 +0200 Message-ID: <20260608181451.3734956-6-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfX8oF/U6Di/uxR Oo2ALV5t1EEu76auHCGntiNt78R6WHHo9RTpialaa1gYGu3gKLJt8+QjQM//2Jmj8Jtr3/F6orp ymdMYspbtv1KUWzqjuA2O8zwJ5gaOND0kGwHwUu3HHp/sFWrVG9QL4TwC5sKV+wt14ZENl35HR/ 7/VqG2VVchmxK7e689XIbpwfNnisow05l2lkDnSS5+XhfYP2BDwuGfagw3R2iuZltBir2pqAp8d 3KucK6wN+/NCyula6TvoZsk7SLUPPQKbYIxNF/6ZRHPpcO7CwcWJCqUVrElyyMJQ3O8IaWroo6p JOqGd0CNZtU5/ELVlZQ1qZNm5ufWLJcpeInBCjTk77ZfC/tZAaLc0mOK6B08lA9jzJLqoAUF/kn 4QSLFW9FSBZuNrkaJVxqawxia+X07PjN0XfKJ5ggcCVdM09xiuypjAeOw+Qev7/nx3QOYyYO9Sq Zy/yKdGtF6kqq+WG/VA== X-Authority-Analysis: v=2.4 cv=QKhYgALL c=1 sm=1 tr=0 ts=6a2706f2 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=_2yia0w1AAAA:8 a=VnNF1IyMAAAA:8 a=9-FPAKYo-0jGICd3_CYA:9 a=4yAS8WwzZ1jAEY03B-5r:22 X-Proofpoint-GUID: 0kHwyCX0npoqF-48K12MvQwNNZTxIskr X-Proofpoint-ORIG-GUID: ZGmTGmcKN0XVTr5DXbQw_hQpJB_V4vc4 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 suspectscore=0 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 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 Link: https://lore.kernel.org/rust-for-linux/CANiq72m4GVWFYqnxNtCHTPu7XcGew= HB5LNwOoayTfnXs9pPbNg@mail.gmail.com/ Suggested-by: Gary Guo Link: https://lore.kernel.org/rust-for-linux/DITFTAVVHTNQ.380OHUHGTOI6M@gar= yguo.net/ Acked-by: Heiko Carstens 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; } =20 -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; } =20 -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) =20 void __xchg_called_with_bad_pointer(void); =20 -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; } =20 -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; --=20 2.53.0 From nobody Wed Jun 10 16:01:10 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 E12D83D8903; Mon, 8 Jun 2026 18:15:20 +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=1780942522; cv=none; b=R0fCPZ+mPNez0L4oGraEyPIZQQWqpuY99LidYeG/qDzMK1YgrLPNRB3xbuUctZNcGCjg11ltjYYkEpIQQ2rJsX8Qn/eJP11I2YnYrZ/i6+k4wdWwXAyUOSBZTj3ZfgxRRRkEXUGOiQhdvz/dNU8pZmmbGcAvRE6LYdHdhPVHkWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780942522; c=relaxed/simple; bh=jyeHStup7bcEmb7YwAA0o4q5Cd8HPAT7sGtOIZLjuUE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lAXEB6+b77+Di6MV+DB9ecsGrVMNy6lVD6bkIB3FNnK5xzRe6J6u1LlI5ztGNIdiqv+06xpTIHaO0ADyjZvtwdadbHUmHxybagZRfjJsY+LWv/mS9I6Azxt+di+GoMVBub/PJrNoXDfZ6yeSyF/fMJ40P6vBvBDtEsKRwVf/jkI= 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=tX5WhTNW; 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="tX5WhTNW" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6588W7Fo3088318; Mon, 8 Jun 2026 18:15:03 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=Els+tXHkKesJ5A7Q0 3cP5o0dgLZBH8RfYyS9Xyv9G78=; b=tX5WhTNWZSb6tH+MVn7Ca1GGw2EaBU9cm LLeHVnEVra1ahjXDyKUeHucZ2pKBr1m27noMFi98rz5bPNZR6NbiWasYMbb0yUj6 yaOj+PNTDDH8G3YVe98r2FZ+bbhcZBKSCn1IuYvp2knVUBcrN5dFa6Ee6Cf+yJ2y OOA4V38Ta40/zBQm+oVi50iuB2X+R0gNCpw7gbt99/zBoJ973S8ESQdrA19GKnri xU9+Z4UPJfXSUbmXZa1G/dMRY+AEWvKamNaR0w1iYTYfK/6hZZxeXLgJkE8zE5vF VmIDxeBZ9svhWlO3IT3J3Bi7IK4LeE8KzODfHT+aCCiKcdJf+SXvw== 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 4em8yhrt2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:03 +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 658I4cFZ003171; Mon, 8 Jun 2026 18:15:02 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4emycgxfj2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 18:15:02 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658IEwIi60227912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 18:14:58 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 786CE20040; Mon, 8 Jun 2026 18:14:58 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32EA12004B; Mon, 8 Jun 2026 18:14:58 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 18:14:58 +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, japo@linux.ibm.com (Jan Polensky) Subject: [PATCH v6 6/6] s390: Enable Rust support Date: Mon, 8 Jun 2026 20:14:51 +0200 Message-ID: <20260608181451.3734956-7-japo@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260608181451.3734956-1-japo@linux.ibm.com> References: <20260608181451.3734956-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: AW1haW4tMjYwNjA4MDE3MCBTYWx0ZWRfX63vCQEFAnmEg AZELY2MZEHhdbZR6KG8YIRvcJy8idf/xpurSh1sMUlPAmiHbM+xU2WOiyMeFTUT4d0NMqrQVgue 9P24JTtsH+jzOVHu9aRUd/QToIaCTddMIHFqsS6EvzFi14KaBFY1RFj8FobPZm0RwllZkDSoc11 /GZJxcWjaX17n06qIRmKhKoVNNNQ1C1DfWemJncVr8ReJabjLjYZR6wsTlQnOrRcgZizfzvqVVb yKDh7vNc38gvc/lIDNAopdOLy9MT9XmVLUee1h3GQot9y2wj4W79vVqyKw0e69zaPxgMMiPydvr E/i4wM0EKyjMDYRNFLzozwpDtqB9WFta0L79KWIK+19Gw6y83pTvWYmgdcjgyT28XPtTouVWp7h amuxioVnvQRnwmvEVv3bfO3zbeiN76L19lIZsAzpFipGBXpmnIV5hchA/Qix0Gtp3uO4pe4nzim JRd8vqu3iaC6OrP5xFg== X-Authority-Analysis: v=2.4 cv=HvFG3UTS c=1 sm=1 tr=0 ts=6a2706a7 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=dVHDsLM4Y7J7NbvvS_QA:9 X-Proofpoint-ORIG-GUID: IiK5sZPCHTg8LOOofaoFjUCOYUPKr_eG X-Proofpoint-GUID: lxrPJhgAzmqQsAFruuXIe09uHvTxRb5A 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-06-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 suspectscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080170 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 Acked-by: Heiko Carstens 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 16f7e855e012..3bf296581a88 100644 --- a/scripts/generate_rust_target.rs +++ b/scripts/generate_rust_target.rs @@ -260,6 +260,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