From patchwork Thu Jul 27 23:26:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 560E5C00528 for ; Thu, 27 Jul 2023 23:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4zLA6bXvgoveR+Vhu9Gb/2sczxrzvgbMn7sZyXkL7lM=; b=4qBadSfZWB4HCm lX0uV2tCcWQ+KJ00xEFcQh4qeV2WaOc1m5v1f9NgiRd7v2zm6BcQw5vJrt8IuVPgvACXa4R1f4mW+ s3FsGuZPupa8YnUqoSzA0LZIwMGn++fmAtkrrF8sjogV1Vq55MkLmE4/aof6R15RDA35jJXKsUTEC wtZxz9g29c3/DT0tAiDM5fEHGUv2AveXKd1ZOShHX+TBg1DrAq23YNK52oTKu13CEcQp/Scf7MA04 OGzxL5C7Fzkv9gMTjpQYqPpjoqvmm2n47YGcsTt8oAW+e0KjLPrkLEhe358N0RXzau1BNvAlofndA DYNLMWx97DHau9plrhYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPANy-000s4V-2c; Thu, 27 Jul 2023 23:27:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANn-000rzu-1u for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:00 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA93261F8B; Thu, 27 Jul 2023 23:26:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6DD7C433CC; Thu, 27 Jul 2023 23:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500418; bh=17quVgwOUPp97Iqg3owW8+YLOqublPdMuTjqZWkARPo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nkjp21yMDGAvaeHDkJINc7Yk4jYHJd6TVWwyVsWQ34LHn+p66SHnj9bdZLBqXAsbM oqCSS8+IEOyZaUy+EikWmvjemOoC3hXfqqwqhN0PM31fMD12PDPaaD0ksIbsizHF2h Sh+5pwlwqqCrYs3c8/dSnZf1JG+UKI8UETFh9mNi9qxMIysiu9RUcT0N1wghmtaJme xQ/QAKgsDFivbvnypgxgHtHlZQLf6Kvhj3u5PisjaLaC3HdIpHSUYBy/xJatZnOkS1 57ybyZnMwdF8b4UKHgSCNGiPeZ+DXXS53B0MhZelrrvrJMVXbA4KyrNmb7aYypDKBu Y9BNwnyhg4Wxg== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:12 +0100 Subject: [PATCH v4 1/6] kselftest/arm64: Exit streaming mode after collecting signal context MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-1-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=3033; i=broonie@kernel.org; h=from:subject:message-id; bh=17quVgwOUPp97Iqg3owW8+YLOqublPdMuTjqZWkARPo=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkwv05VrGqW153ETqB2RJgnxvIF7+LzYv/IlYjhZ6Z s8dnsWSJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZML9OQAKCRAk1otyXVSH0MWiB/ 0WLVRgq5i6hfMb4hl9vOiSFuzNvjGpyAaNmITZMvRqoaXQqNMCrVQXbcmW8BJhnEbdXq9f689krKZJ dWBcisXyxaUCfUh4TwQdOByvBjuIPRX88f9M3hgscq420v63Zdr3RTkmaFoXOFqRFI5dr0BDnveseH YSUtg6kEvpBEtEZR2rCbA3vqBGOtZLnQrf93RrUSrNA384N8IKOxSpnRauUiYRZekWZgUNOREZU/ej TlOl2k1QVVsXVM7+oRFrsP1rkJd1fUzqgRE2UfCGsk8KkDJbKp2VOribAg3KwJCEfkNZRdr5rYixX0 liQAB9Bj+61qzyJAfNPJlOj0hSZhXm X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162659_714210_016D7D1A X-CRM114-Status: GOOD ( 21.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When we collect a signal context with one of the SME modes enabled we will have enabled that mode behind the compiler and libc's back so they may issue some instructions not valid in streaming mode, causing spurious failures. For the code prior to issuing the BRK to trigger signal handling we need to stay in streaming mode if we were already there since that's a part of the signal context the caller is trying to collect. Unfortunately this code includes a memset() which is likely to be heavily optimised and is likely to use FP instructions incompatible with streaming mode. We can avoid this happening by open coding the memset(), inserting a volatile assembly statement to avoid the compiler recognising what's being done and doing something in optimisation. This code is not performance critical so the inefficiency should not be an issue. After collecting the context we can simply exit streaming mode, avoiding these issues. Use a full SMSTOP for safety to prevent any issues appearing with ZA. Reported-by: Will Deacon Signed-off-by: Mark Brown --- .../selftests/arm64/signal/test_signals_utils.h | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h index 222093f51b67..c7f5627171dd 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.h +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h @@ -60,13 +60,25 @@ static __always_inline bool get_current_context(struct tdescr *td, size_t dest_sz) { static volatile bool seen_already; + int i; + char *uc = (char *)dest_uc; assert(td && dest_uc); /* it's a genuine invocation..reinit */ seen_already = 0; td->live_uc_valid = 0; td->live_sz = dest_sz; - memset(dest_uc, 0x00, td->live_sz); + + /* + * This is a memset() but we don't want the compiler to + * optimise it into either instructions or a library call + * which might be incompatible with streaming mode. + */ + for (i = 0; i < td->live_sz; i++) { + uc[i] = 0; + __asm__ ("" : "=r" (uc[i]) : "0" (uc[i])); + } + td->live_uc = dest_uc; /* * Grab ucontext_t triggering a SIGTRAP. @@ -103,6 +115,17 @@ static __always_inline bool get_current_context(struct tdescr *td, : : "memory"); + /* + * If we were grabbing a streaming mode context then we may + * have entered streaming mode behind the system's back and + * libc or compiler generated code might decide to do + * something invalid in streaming mode, or potentially even + * the state of ZA. Issue a SMSTOP to exit both now we have + * grabbed the state. + */ + if (td->feats_supported & FEAT_SME) + asm volatile("msr S0_3_C4_C6_3, xzr"); + /* * If we get here with seen_already==1 it implies the td->live_uc * context has been used to get back here....this probably means From patchwork Thu Jul 27 23:26:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69765EB64DD for ; Thu, 27 Jul 2023 23:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Fe7yzbRfu1zSpfBzbmvVjETt19YxbOhfti1lpCGz63U=; b=IrFlUm+wbyOpjz Rv97n0VglxdDP+Ey54WEPKDzR0dovDioS+p5aFK35DXkTXirUXMfiXBVpPib4OeJh+m3fmBm3lrLR 3/M8/YDh7MNra+NDIcuiNtbXQ6K3uXB/xEweiHvh028IGcDEorBMcSKPK7BC8x4+Xyv0o7rRRXtA1 NVvxDynetjlOmOldYfJJBklo86R7lEAA0iwxq6oQSTsjql+kVBFtJCu6P81xLFPE+wUE7sNPyIT1g z2Y00PynYZ9e4dSttDCfTNuwQldo+BClxT1Is1loBDz7GT14lm0yHrBCoVrZY8wmYY0bD4YPiqU9P OEXSDYR0u5vWINWoTGtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPANz-000s4s-1H; Thu, 27 Jul 2023 23:27:11 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANp-000s0D-0d for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:02 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B400A61F7B; Thu, 27 Jul 2023 23:27:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4194C433CB; Thu, 27 Jul 2023 23:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500420; bh=jXMPykm8Sa7SRlmo5xtzHOIlSIk5Hq+qJ6dIW9lIji4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gM52nhQMToDrNZbOQX4DUuuR/CzhvuP3nCm0/uSOtAuHCbgUImUxjsue5HeACy+NA 6G4nByfh3BVo/4HM7b8CEgr72bc9l8B7oFWMmX3H7fcHpf12i7HJwPCTeRlwLt9Oi0 HXlUSMJr/Lh+KYjwnO82u2aPL5VH/kplEMlS7nTe+7je0oyee8oGDDEh8djNIoqp1p rhp8n0vnPkr7IcY06BWpY1R2yFiVVk+TyaSpARzLoKBbqNxgUO+yAttnnePy5RWyiN JKNBjlwz0wzwrpslxSm33c8gjaNgVT8Aqq5LbHO9yqHPFVNv9SkF9rjY5uuyr9t6kF r7NVgg9ZAUjdg== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:13 +0100 Subject: [PATCH v4 2/6] tools compiler.h: Add OPTIMIZER_HIDE_VAR() MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-2-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=845; i=broonie@kernel.org; h=from:subject:message-id; bh=jXMPykm8Sa7SRlmo5xtzHOIlSIk5Hq+qJ6dIW9lIji4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkwv063LfMOVtDu/PC70CFOI6dnptcjxsMx0BeCTqD G+2FKZKJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZML9OgAKCRAk1otyXVSH0BeqB/ 9St4zvcVA9AM5uZQ6iXsgGbrRYpAQ2GF9jDM2QSQZjfgaqcwhNuH8s7zUG1EfjTnUS+fkklj0iISTF 4s/SVoqGco4pKmKSsQaTx2t72WX1P2klXpJosUBr7AJsmezlqabHHc7vXcwIsHkabcALJqHgQUJ/e9 6Sw2X36LvFHp4Qua+RzWH96L5GV6nUNcftVPp5Gx1UnIBKJ+2+w1GCoX8scYJXYTjgxQ1T78sVH27n P4VSH757Cj82weBwXP5Vsv8Dy5m9zGcFjPbiHANEetNZWoSVZx3uaPP4poqby4sdLk6fsqLBuW/ek9 YA+RfSx0/GXLhU5yeezLdoBmc81JK2 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162701_283300_BA0B9366 X-CRM114-Status: GOOD ( 10.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Port over the definition of OPTIMIZER_HIDE_VAR() so we can use it in kselftests. Signed-off-by: Mark Brown --- tools/include/linux/compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index 9d36c8ce1fe7..f75cced41d59 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -190,4 +190,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s #define ___PASTE(a, b) a##b #define __PASTE(a, b) ___PASTE(a, b) +#ifndef OPTIMIZER_HIDE_VAR +/* Make the optimizer believe the variable can be manipulated arbitrarily. */ +#define OPTIMIZER_HIDE_VAR(var) \ + __asm__ ("" : "=r" (var) : "0" (var)) +#endif + #endif /* _TOOLS_LINUX_COMPILER_H */ From patchwork Thu Jul 27 23:26:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E7B3C001DC for ; Thu, 27 Jul 2023 23:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JvfehhbBQbKMAUllO1zOrFlSb+gvJG9hgmPVEcn9XgY=; b=0y7PK89bMtbs9T x+k4rkFx9lr+vwuuaGfgmR82nBGzDI8OL2qAn2EWJzSxNmrMOgodjiTLh0RUwIVOHLZ4cu0TX3bgF w1M8E/qQ4RymAM66M/9auhdghb0izHt24PtfAksGrRGcTDLouGYjnR1iaCVTc9ggNSIc9Kst68Ndb kh5JNfHDviBolAAYAK/kk1gxoRFvQ8oUM+1UVcws0GNCL0nwkiyJnlOosmzR0nuQpEpnkJsEuT4Jw Iv6IzM7RCa4MFm9aOC5Ly11d4JFU21H8Ln7z/jqloD+H2X3PxLBO1yOWi6IbxHVrQ/+PjNRblTub2 nzzlEiAwm2r9QzkWgRgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPAO0-000s5C-07; Thu, 27 Jul 2023 23:27:12 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANr-000s0i-02 for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AA5A61F8A; Thu, 27 Jul 2023 23:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91005C433C9; Thu, 27 Jul 2023 23:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500422; bh=Znm9gRTwsFwQfwD1M+msy3+6gP9lF4h25ZTmsNIMG+8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WXvhCx3tVGtpH7KM3WsPf+wJKi5tzA8AnxDAawXXSng2MmFBYN0/MOXK0hpTf1zmq 4OHjaNBIFFH3UAccIjni55fGQFBVuTPLXT+t3urAataGB7cePSb0kFKv2TP1GatcaG aPzOQovlIspJwoFZqRTLmSsj5s+6MiFqj4c7yeALO8SVg9C13lrx6WgmWZvDwCBXbu Boz2mn5Q0wKvEvWiUTD3dL9pEKqA0/mgQypPE/e5U0CEQjYle5JI7JgcLPD2AMcRU1 J3ManrUKmRAZnIY9U3lhMr893MAvaOM+1JoBgusZacBW5rkYCQU4MYuyParCK8q1z3 mwEhAlv4/o42Q== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:14 +0100 Subject: [PATCH v4 3/6] tools include: Add some common function attributes MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-3-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=895; i=broonie@kernel.org; h=from:subject:message-id; bh=Znm9gRTwsFwQfwD1M+msy3+6gP9lF4h25ZTmsNIMG+8=; b=owGbwMvMwMWocq27KDak/QLjabUkhpRDf60vB71y215inrJV+E2EvtuMndOPcufzzNzl5MwV+Hzv Vf5vnYzGLAyMXAyyYoosa59lrEoPl9g6/9H8VzCDWJlApjBwcQrARFqY2f/X7OoRrrAS0kqpYioQzq nK0o7ktSu1PC/Nt2ihyavyes2Vfp4fb32arL/5T5mD5+M//xgaNiUeCk2XuvaHvccveOu1Z3OdzT46 a4r0KKaoWcpxNFucLtg/SUw1wK+3kmtGjGKsr8f/CR1GveLSq26zehhIHHTMDP2w0apD/OhHA9Wzsa U7/kVMzzHdqHnO91v3ul/PbdbV8i+Qlrp59vyrHas25S+Kcc1/vKPuccdv16k+tuazJfonf7bn6spO DnRya1z3pCH2UsqpzR4nKr6fl3OpNvz6cut0pntr1Vh9k2t3HWF0ZU8ICRM6Jc7UweD2OWfqr8aFV2 /qN0ruOfzjdOr/PBXpYjaHJAdbAA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162703_090989_3CC488E5 X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We don't have definitions of __always_unused or __noreturn in the tools version of compiler.h, add them so we can use them in kselftests. Signed-off-by: Mark Brown --- tools/include/linux/compiler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index f75cced41d59..1684216e826a 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -42,6 +42,18 @@ # define __always_inline inline __attribute__((always_inline)) #endif +#ifndef __always_unused +#define __always_unused __attribute__((__unused__)) +#endif + +#ifndef __noreturn +#define __noreturn __attribute__((__noreturn__)) +#endif + +#ifndef unreachable +#define unreachable() __builtin_unreachable() +#endif + #ifndef noinline #define noinline #endif From patchwork Thu Jul 27 23:26:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 434ADC04A94 for ; Thu, 27 Jul 2023 23:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DIHOewtP/47R34+jk3Z4Gs1GFg4Q0nVtl1W1/FnChyM=; b=EaR+9SG/E9Ez1/ iCYFGdugaOPac3P5EFsIelzn7RX1BtTbmU8n1oGE8uzeJN4V9TSPgon0XgLP0JzWmRrSARu5VUOy6 PVQivj8pmwOZ0WW/jlOvgH5pe078gfuPo6+9FpIUENfeePQ3TsJB6nWD6gC3wpnfdq2blePXIbUOG G3kL4Fzaby5Ef6W+wuAgqkIJRRWK+yv86eFRZypup6t4+G4H1VOm4Wl9gHNbkow4p+CPMBizjBhPP Un2SGOybT1UISJaqJQ6lfrEh2cxo4qvu9Lf9Nsi6xxeYlHk3AOr2weZx//58gvoY/RLyI27lyAwRC epEzf8A/AxR46vDZr3NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPAO0-000s5U-1c; Thu, 27 Jul 2023 23:27:12 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANs-000s19-2i for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:06 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62DC861F84; Thu, 27 Jul 2023 23:27:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68E1BC433C7; Thu, 27 Jul 2023 23:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500423; bh=3Twxt+ztmPtVD0NHowFG7vKtvYRRWttH91DBpHBezI0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZewPS2cTsNisFWlRk/n/RKJhsrj9H3CELspdWuitrGRnprnemAQxNUSQXdescoYYG jKRJlkTsK+EJjc+EnyVmoyMCUdPouf+Y6I36UAwUyy+xO5nnGFmP4AtIkgk6pjGhwK +5TSOInCLFslFOfSzycjHN750UwrZHmjqa0S5Yjaw6bXdPldwogORaOMsI5zvWydNn +qQNSZugsczBIOczeOtC2Nqz1X6osFou49tdFWb/YblxaWJedI7sHntQo0kB+7Iy4I sDQPpIZ3a/iWrb0xvF6qydxKgmFBDEej0l6x+VQ/8TWrfxUNhOG1Um13FlFsZdBYld pzJPh/3jCBjEw== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:15 +0100 Subject: [PATCH v4 4/6] kselftest/arm64: Make the tools/include headers available MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-4-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=679; i=broonie@kernel.org; h=from:subject:message-id; bh=3Twxt+ztmPtVD0NHowFG7vKtvYRRWttH91DBpHBezI0=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkwv08T3Xmn3L+KDEN17Ziv1NJDSuu1hCzTrzS5/3j 8N2YXtOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZML9PAAKCRAk1otyXVSH0CiJB/ 9ZvL1M+upvI8SckwQ3t7MnnK28cyuCGBUjdWIBKplPv1nlemi4c/pqZfO6zlTC5YASi3j02mMbST3e eKVB54k497BtzlMyMf4ey3HzQbBKKU+GRBrBzY3WdaZ+M7XZRCSlS04GSM+CKu4pqkB6Or4LQ1Su6l kMVBEsMXvXwSqeRuYvi0fM+rW6/5VUzPiYbG2k9pzN7eE0TEi4hA2cWXbf8T3tStrldONWLT0M6Q9y i8uiiYoBpfktwjLuI2k+uwa7uqggY5WrErTY7CPIedU62xatcELrugd7kx3AjlrVDKSnfduMszGPB/ hfUqp5TCNNwTtyHjZGPyOeow9ReB0R X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162704_925680_E0C880C2 X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make the generic tools/include headers available to the arm64 selftests so we can reduce some duplication. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/arm64/Makefile b/tools/testing/selftests/arm64/Makefile index ace8b67fb22d..28b93cab8c0d 100644 --- a/tools/testing/selftests/arm64/Makefile +++ b/tools/testing/selftests/arm64/Makefile @@ -19,6 +19,8 @@ CFLAGS += -I$(top_srcdir)/tools/testing/selftests/ CFLAGS += $(KHDR_INCLUDES) +CFLAGS += -I$(top_srcdir)/tools/include + export CFLAGS export top_srcdir From patchwork Thu Jul 27 23:26:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA4A2EB64DD for ; Thu, 27 Jul 2023 23:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=546tSwLEDYlQ641dGjFbTnI6xcxyrZNcK89tYPQ8Hqc=; b=KsCsN8yj0e6Mjd aiSYnFRwEcAW2zrKMOrc5qXk96+T5I+CM5SXX6VnhFp2VnNzlEvR3DoOPV1T6PhszMcRwO0z8lKdQ KiUVg+jneYc+DGzIHIZAwLdHWeruyYnDJ9HttbMp8WLsves2o7aNCZ0vHxogN35ZFOsqlFUykEZKt Gi5FW7jT/ghrIPTGs3NsG8rnuWL/nfDLW+am0EsThdSmM6WosL92Br1g0I8JHLTG5o3g0wqiIRcGM xBjtTumOOZNE/CBzXGd6SdPLaqDZgefrzepFSFr73ko+67J/NpTqN8HpvP1UuHktSQtY5c2flpJrW LpAnSWMrxln1pidmdULQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPAO0-000s5p-3D; Thu, 27 Jul 2023 23:27:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANu-000s1b-2j for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:08 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 636BF61F6A; Thu, 27 Jul 2023 23:27:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46960C433CC; Thu, 27 Jul 2023 23:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500425; bh=U9eF72eZ37CI1cE+xa8X28h+BbO8qk9SjWJn/oLYilE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OrYEkASthgU4BOmTQSZsyI6Zu2kEP+1oN+V2Qyabjpcv3eLyHdT8vXXL5m9LNwtGv hjVsCWRewoRwjCgX0zCLlyLfVHd+8zyLW6zjx9fzEasiGhGmBXNY+3h3xBHG465CI+ Ks9Lf1Vsi5IbwsSrHwNF3flnjGFS0u4dGN9KYZzDjKZj/Niexr7yS4ofqROTmGYlq+ HZBm17eGJgXoa7joDPunZgw30CjYa3FFqA5yuFQiusdJ9dL9G8/YBqmxk0rK1+cscY W0I3QfkL0mCWFk0zzbBT9mhVuN3A6BNoK/Hx1o1SMiJz7cfRj2t+FmnmeVFKyD8CA0 BU6U8QIHsGBuw== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:16 +0100 Subject: [PATCH v4 5/6] kselftest/arm64: Use shared OPTIMZER_HIDE_VAR() definiton MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-5-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1124; i=broonie@kernel.org; h=from:subject:message-id; bh=U9eF72eZ37CI1cE+xa8X28h+BbO8qk9SjWJn/oLYilE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkwv09X8Mjn1yqAaOEMjsKIen70RXP0QJW8nIpTkh3 lnMxM1qJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZML9PQAKCRAk1otyXVSH0OI2B/ 9hXA4a3MhVplF/KUp49gZNZsDo+mb986YfPqBSVFgJXJR84jb8JBGk33xkR+fP78xIbq1x+YlH3Cor Trtjoa9QCbFbP5CpMW81jl7+0MRED48409wD74jGIxqWDnK9qEtdc+iZGmnC8u9EWP542zl1qZM4jT ZT3uWzmROX6NM1HUHTqy2vu6zsJtG6Gphkx5B0Xi437PUT1HT9deIP1RzLjg7Nih13uwVu1yeWM3aZ qUTXbOdZyXgfv32g2tOrXccCWBLmvRU4mD/biSzv4fH1f6SvqDospwE2+RYxtwMbd46t1i1ZYzjAnD jHeXqfxXILhpxL8v413Cr7UILUrRJe X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162706_926111_D049CBFC X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We had open coded the definition of OPTIMIZER_HIDE_VAR() as a fix but now that we have the generic tools/include available and that has had a definition of OPTIMIZER_HIDE_VAR() we can switch to the define. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/test_signals_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h index c7f5627171dd..762c8fe9c54a 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.h +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h @@ -8,6 +8,8 @@ #include #include +#include + #include "test_signals.h" int test_init(struct tdescr *td); @@ -76,7 +78,7 @@ static __always_inline bool get_current_context(struct tdescr *td, */ for (i = 0; i < td->live_sz; i++) { uc[i] = 0; - __asm__ ("" : "=r" (uc[i]) : "0" (uc[i])); + OPTIMIZER_HIDE_VAR(uc[0]); } td->live_uc = dest_uc; From patchwork Thu Jul 27 23:26:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13330976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4D8FEB64DD for ; Thu, 27 Jul 2023 23:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xuZNsvSa+7gSn5snm30SnpWi6Bo/BwdsbJeeHOr3UnA=; b=seYnAmad9PeJ54 QJ3dQsbDIn3PfujFgyyNi/4T06h1UjdMsckggdskNtOm1CFJAz9qc0bmLIjb0MdQanhy+0IKdvM2d PoPe5zQxmoioOedU6aty6robY8gFZPhPDEc9jWLePAaHhdnfPfjpuUDgkBjtln+Tc0xFaPhDN57Yj xbjbZyy8wsafSlxmgxi0dN4FMlXukliv29vvKoyTkMk2eKhmxvvLfU9OmH7wghSCBfDSP0g+4I2r8 ts7NtY+V+f24v3DnOltVXVVt/YNCAl54iZCKTLQTOCkxAZT0qf6vulJU5KicYpv/MJ6kebfJvU/kN Mb1QqjeyED9EdjFBLWUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPAOe-000sJ9-0w; Thu, 27 Jul 2023 23:27:52 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPANx-000s3V-1c for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 23:27:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04F2061F8D; Thu, 27 Jul 2023 23:27:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F0ADC43395; Thu, 27 Jul 2023 23:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690500428; bh=9k3w2GBcBAqmmGMPcYLsGGGPHhPVChgtpgxlIPZIOJc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E0t01Qv+n6eKa+pxbIMDfoirGbEwAEgWccJu5vrJYO2FEgtdWqw47uCHBxvhGNGNj Q/JYRe8HhOcXyS9FfQqEjnqABMLh39l+SR1JH40f9IZN9/D9VjBn3AdQ+34booim9c 9uTGIW0mP8Uw1C0e5Wsz2wXKVhFnYe0ITOOQ+4qsmQGlXYIwoNWFah0Ia1zn9cHP1d UoM+YS/Y6jFzeGxOCQWlwzcyPIMgTcPuonNfG/htvQqm3JZL4Zuw3TltJ7wbRiTCK/ OjH+xIm8ZDtkEK061340hDNO/nzKfwddY5d+C0tdEOgSY2NeT6I0APhTof/NLfC7Gg Wpi4GsJmvvWzw== From: Mark Brown Date: Fri, 28 Jul 2023 00:26:17 +0100 Subject: [PATCH v4 6/6] kselftest/arm64: Use the tools/include compiler.h rather than our own MIME-Version: 1.0 Message-Id: <20230728-arm64-signal-memcpy-fix-v4-6-0c1290db5d46@kernel.org> References: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> In-Reply-To: <20230728-arm64-signal-memcpy-fix-v4-0-0c1290db5d46@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Arnaldo Carvalho de Melo Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=3009; i=broonie@kernel.org; h=from:subject:message-id; bh=9k3w2GBcBAqmmGMPcYLsGGGPHhPVChgtpgxlIPZIOJc=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkwv09LNwFQCF4CRRL0scso9UK+3zOt7IV4CbSxiXS 1PHiYZ+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZML9PQAKCRAk1otyXVSH0JSjB/ 40eJ999zzsbI5ThnpILemnJjHqCswwKHRtduJHlB0FLL12fQX4/zXt7TK9eK8/uiLzsWi//nwQObtt WsamOENoa3zfgCaBFzj4j+F/sFkjN0mr/t56ZzINLHZhWO6rSzVbzD5a+9C3n4rzAQhHdKFxRGksj0 1aH020PnCSz1I43wDX8UoFB86XkxMOKERLAOkRy8rROErcI6XJ8ktqw7GDmGJvGjKlzHmEx8n1oDm0 l9uFG/Kp4Fk4A3JWK4I7XVe3gIZOiJtI2SV74q7GqJV6lhu61gqgIWmef6ZWRHg585uGx93nE+ChDF +VYwf+d1XSdaMaRA8rtxEZCLX7FuJp X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_162709_625107_988088E8 X-CRM114-Status: GOOD ( 13.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The BTI test program started life as standalone programs outside the kselftest suite so provided it's own compiler.h. Now that we have updated the tools/include compiler.h to have all the definitions that we are using and the arm64 selftsets pull in tools/includes let's drop our custom version. __unreachable() is named unreachable() there requiring an update in the code. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/bti/compiler.h | 21 --------------------- tools/testing/selftests/arm64/bti/system.c | 4 +--- tools/testing/selftests/arm64/bti/system.h | 4 ++-- tools/testing/selftests/arm64/bti/test.c | 1 - 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/tools/testing/selftests/arm64/bti/compiler.h b/tools/testing/selftests/arm64/bti/compiler.h deleted file mode 100644 index ebb6204f447a..000000000000 --- a/tools/testing/selftests/arm64/bti/compiler.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2019 Arm Limited - * Original author: Dave Martin - */ - -#ifndef COMPILER_H -#define COMPILER_H - -#define __always_unused __attribute__((__unused__)) -#define __noreturn __attribute__((__noreturn__)) -#define __unreachable() __builtin_unreachable() - -/* curse(e) has value e, but the compiler cannot assume so */ -#define curse(e) ({ \ - __typeof__(e) __curse_e = (e); \ - asm ("" : "+r" (__curse_e)); \ - __curse_e; \ -}) - -#endif /* ! COMPILER_H */ diff --git a/tools/testing/selftests/arm64/bti/system.c b/tools/testing/selftests/arm64/bti/system.c index 6385d8d4973b..93d772b00bfe 100644 --- a/tools/testing/selftests/arm64/bti/system.c +++ b/tools/testing/selftests/arm64/bti/system.c @@ -8,12 +8,10 @@ #include -#include "compiler.h" - void __noreturn exit(int n) { syscall(__NR_exit, n); - __unreachable(); + unreachable(); } ssize_t write(int fd, const void *buf, size_t size) diff --git a/tools/testing/selftests/arm64/bti/system.h b/tools/testing/selftests/arm64/bti/system.h index aca118589705..2e9ee1284a0c 100644 --- a/tools/testing/selftests/arm64/bti/system.h +++ b/tools/testing/selftests/arm64/bti/system.h @@ -14,12 +14,12 @@ typedef __kernel_size_t size_t; typedef __kernel_ssize_t ssize_t; #include +#include + #include #include #include -#include "compiler.h" - long syscall(int nr, ...); void __noreturn exit(int n); diff --git a/tools/testing/selftests/arm64/bti/test.c b/tools/testing/selftests/arm64/bti/test.c index 2cd8dcee5aec..28a8e8a28a84 100644 --- a/tools/testing/selftests/arm64/bti/test.c +++ b/tools/testing/selftests/arm64/bti/test.c @@ -17,7 +17,6 @@ typedef struct ucontext ucontext_t; #include "btitest.h" -#include "compiler.h" #include "signal.h" #define EXPECTED_TESTS 18