Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11593928rwl; Tue, 3 Jan 2023 01:29:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvQaMtyi+8qHjPnLt1t3wgbTszMuSjGfQPkhoBTEz5ClIe0cwHp9GUdry5sSywoVrcXQ0ml X-Received: by 2002:a17:902:74c3:b0:192:96ad:7444 with SMTP id f3-20020a17090274c300b0019296ad7444mr23273298plt.32.1672738193430; Tue, 03 Jan 2023 01:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672738193; cv=none; d=google.com; s=arc-20160816; b=UzjjU3X1AfSRpr3a5qMmAoI/Ql1ER/joapA87rylrjQvxNppM26LHgjjajTrAQYgCG MoJwE7u2P/3rc3WFQjeJTZu55gxDB9+KD9lGUCd087k6oPNN9XjiN1Eb6OXvzcLKZ5ds MqtzltlFebCCVw7caGbjARHOzANfSUKjpzEgZAIMRiWxz2SYO257DCZpam+athcS88uk SylkmqL3w6g6ysDlUuPq4Rx++Rm0D/eyeqc/agEktBcaiRrJ4ndiIPPDjFGXLzha7AYi U1aUSCTZYEkmTvmlekCzLLKJ+VvBhbMo5eZg9oeFrJTn4E2fWMiQ3ptM45lYkt8sQIhG k8oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=0cvRlgHl+WEn55s/1EpsaDmr/w/YiW/0ZDPA7qpQ8bY=; b=ZXutRw6l8gKQ37afEWkjc6YSGrkI5G+Bhs4OvU3+FpIARLKF6JI1aB174/QaoUS1rZ VoShKOVIZS0Mgl4FRh8prqe5XZF7S8ELhOzRHuWbaK2LQVnLp0HPRTXz55NNrYe3JqFD GvXAz2PSeAr5vqhXACazX5ACPyzuVmMYnQl6LvIXAMKqB0QYLMtePpSOFa9ZBvXQr52I 1yQjTsk3UHbokQ+xzMBjvOxLgynXNR2ehU6iqs5k/yKWodDKOtefxBbVFWooyFU8Fyvw KfwMCcDLGP6EvewWoNhe7W8dsp6ZxQYDBqXB7aH4MESfBy6t8fojFY+RmAl6nz5+JSlY 1+Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020a170902ced100b00178170100fasi33276369plg.337.2023.01.03.01.29.45; Tue, 03 Jan 2023 01:29:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237005AbjACIzi (ORCPT + 61 others); Tue, 3 Jan 2023 03:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbjACIze (ORCPT ); Tue, 3 Jan 2023 03:55:34 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CB6F8B7E8; Tue, 3 Jan 2023 00:55:33 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 286431515; Tue, 3 Jan 2023 00:56:15 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.37.13]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B8F2E3F663; Tue, 3 Jan 2023 00:55:28 -0800 (PST) Date: Tue, 3 Jan 2023 08:55:26 +0000 From: Mark Rutland To: Peter Zijlstra Cc: Dan Li , Masahiro Yamada , Michal Marek , Nick Desaulniers , Catalin Marinas , Will Deacon , Sami Tolvanen , Kees Cook , Nathan Chancellor , Tom Rix , "Paul E. McKenney" , Josh Poimboeuf , Frederic Weisbecker , "Eric W. Biederman" , Marco Elver , Christophe Leroy , Song Liu , Andrew Morton , Uros Bizjak , Kumar Kartikeya Dwivedi , Juergen Gross , Luis Chamberlain , Borislav Petkov , Masami Hiramatsu , Dmitry Torokhov , Aaron Tomlin , Kalesh Singh , Yuntao Wang , Changbin Du , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev Subject: Re: [RFC/RFT] CFI: Add support for gcc CFI in aarch64 Message-ID: References: <20221219061758.23321-1-ashimida.1990@gmail.com> <20221219132731.6ng4sz2nv6ujvu7i@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 19, 2022 at 04:04:55PM +0100, Peter Zijlstra wrote: > On Mon, Dec 19, 2022 at 05:32:04AM -0800, Dan Li wrote: > > Hi Peter, > > > > On 12/19, Peter Zijlstra wrote: > > > On Sun, Dec 18, 2022 at 10:17:58PM -0800, Dan Li wrote: > > > > > > > 1. When a typeid mismatch is detected, the cfi_check_failed function > > > > will be called instead of the brk instruction. This function needs > > > > to be implemented by the compiler user. > > > > If there are user mode programs or other systems that want to use > > > > this feature, it may be more convenient to use a callback (so this > > > > compilation option is set to -fsanitize=cfi instead of kcfi). > > > > > > This is not going to be acceptible for x86_64. > > > > I'm not familiar enough with the x86_64 platform, could you please > > tell me why this is not acceptable? Is there a similar situation > > on the arm64 platform? > > Mostly because the call would be a 5 byte instruction while the trap > (UD2) is only 2 bytes. > > I suspect Argh64 has a similar problem if the to be called function is > outside the immediate range (26 bits or thereabout), in which case you > end up with a multi-instruction sequence to construct the call target or > so. Either that or a direct branc to a PLT. > A trap is always a single instruction. Indeed. I strongly prefer the BRK for the reasons I've given in my other reply, which include code size. Thanks, Mark.