From mboxrd@z Thu Jan 1 00:00:00 1970 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 E861BC4345F for ; Mon, 29 Apr 2024 14:55:05 +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:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jgcH2vtm22UTzcFX3vd8+wsZ/1RP7lPrej0YQOTIQMQ=; b=ArS5CMNoKwQpew woQPEkd17XbhAuqyDKzTOw6lXLzpOTDUN+rSjbd82NFPvOcdnGkcZ4aq3LDfDSIY6jrdQHoVuPkkb shSZXAITCsAUQBmN+zLnlPdJszx95+3ExbfY0QtmcMy3hWjEF8oFzN4wP0y+xh/Dl5ulwmT28enHo 9nLZ/rBWiZ8KKBWd+NpiVO1rOST6ToIiLTJadHEazh9/vXuwYMJwccNWRqt8eU0+MUQ/b+O2M6+wO Qy95AxIm7zypIaytc/k4uAXrjpK8PrSp2eua3le11vnA83Oo9UIDVHBHRtKqP3vKQc55dDSzbc+Xn MJgpD4fHd/E9s4cO1zlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SPB-00000003DL7-2icz; Mon, 29 Apr 2024 14:54:57 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SP8-00000003DJ4-0HkB for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 14:54:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0B1A860DF0 for ; Mon, 29 Apr 2024 14:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB123C4AF1A for ; Mon, 29 Apr 2024 14:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714402492; bh=8DM51W9tiEcmuXpPGhHEdCnkLqP13qpOgpuxXtHOJRE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qnHKOw/chkWBVUxojZ3Qz88v+gbaupxa+gUAyZ3/NTPFthiXSS4HxNrLvNDUBbrwl E2WkPUa64wOYlYbDlNX4SxR0mU49917IMLzpHBYKLjN4/afSpcJUPF5SLl5YUzA2Xm zAZX1trphPOy01xwhFwsj65xgkieIHYYEobCiyb46XSDTti/KcJct7ENEMs0jhigka s6oe1Rld9EV2+vuLDCWTHr+pPW9vmkJRLKFtljXAV+4Wu032PgzE7oNVC+e/MHg/mC dR8qwPPe0e3PSUpcqmixp5O2V5prQ7pxBTImoCl/hdIe3Ds2KCjElUN2Lyqz4l8DvJ Qmd6Zt4EqI/qg== Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-516d68d7a8bso4235117e87.1 for ; Mon, 29 Apr 2024 07:54:52 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXr6ueWhG29OM6ke/Ku+IKtTqm65XO6p7+n1HfEVkSEerzbOyczIH+dwG8+ggIDAlXZJlF2u/OKlNPhNhdHMo6ZdbRakiGO4cYmhNCpuTOmBDmGUHU= X-Gm-Message-State: AOJu0YxaIF07asBgQf+/N4WW6eYcsK2HWkqzuguuIVLY4SxrPR7q3WG9 pEXjewglEAO6Ul3/tkmwhV05f+lb/HwUNINiawvI9QEN6inf90b2LxXdWAaVsjei8QXysHSPeFN uqOwcCtnSW8DZnCoc+MpRd97UmSI= X-Google-Smtp-Source: AGHT+IFMxdc7q7n4vsnXATmU6Ukw2OWEXLM+9DQfXNJyKv5vh18nLmDtSY08R7py6ufxGishc+U8UEoiDGYz9rWlZg4= X-Received: by 2002:a05:6512:3b91:b0:519:5fb9:832b with SMTP id g17-20020a0565123b9100b005195fb9832bmr2780019lfv.12.1714402491069; Mon, 29 Apr 2024 07:54:51 -0700 (PDT) MIME-Version: 1.0 References: <20240423-arm32-cfi-v8-0-08f10f5d9297@linaro.org> In-Reply-To: From: Ard Biesheuvel Date: Mon, 29 Apr 2024 16:54:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 0/9] CFI for ARM32 using LLVM To: "Russell King (Oracle)" Cc: Linus Walleij , Sami Tolvanen , Kees Cook , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_075454_302822_74889B30 X-CRM114-Status: GOOD ( 18.62 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 29 Apr 2024 at 15:22, Russell King (Oracle) wrote: > > I've applied this to a separate branch, and it should be in > linux-next by tomorrow. > > As mentioned today on a previous iteration of the patch series, > I'm not all that happy with the introduction of delay-inducing > branches to solve CFI issues especially on the early CPUs where > a branch causes the CPUs pipeline to be flushed - thus making > branches expensive. > > Can we make these branches conditional on the use of CFI? > > Didn't Ard mention there was a way to do this using symbol aliases? > Yes, but only if the prototypes are identical. Not sure why Linus decided to keep this separate, but 9386/2 implements this for flush_user_cache_all() vs. flush_kern_cache_all(). For coherent_user_range() vs. coherent_kern_range(), the return type is different (void vs int) So we could either make coherent_kern_range() return int as well, or alternatively, we could emit the branch instructions only when CFI is enabled (as in that case, SYM_TYPED_FUNC_START() expands to something that prevents a fall through) E.g., --- a/arch/arm/mm/cache-v4wt.S +++ b/arch/arm/mm/cache-v4wt.S @@ -108,7 +108,9 @@ SYM_FUNC_END(v4wt_flush_user_cache_range) * - end - virtual end address */ SYM_TYPED_FUNC_START(v4wt_coherent_kern_range) +#ifdef CONFIG_CFI_CLANG b v4wt_coherent_user_range +#endif SYM_FUNC_END(v4wt_coherent_kern_range) /* AFAICT, SYM_TYPED_FUNC_START() does not prevent a fall through if CFI_CLANG is disabled, but someone should double check. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel