Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2723241rwj; Mon, 19 Dec 2022 08:06:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ly82Tspo4zprzevKpajiuUO7diDH3OG/ESMV8lTS2ScqM3P1JlwCWbRNhjnUZdk0KZRfT X-Received: by 2002:a17:906:ad8b:b0:7c1:994c:f168 with SMTP id la11-20020a170906ad8b00b007c1994cf168mr21848769ejb.54.1671465976238; Mon, 19 Dec 2022 08:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671465976; cv=none; d=google.com; s=arc-20160816; b=ROVzTDHGFP24T/rMpZR5GnKtXfz1D2NZnO1zLVMObkph/7Rol//t2Zv6xl2FSEsthY Q1DCGoji2w+d3bNxnndnZoymsjOuyXvB6HYFlwanbH5ah+GSg6OIRRT0gtZLsE/mVsQE t71MrtGpe5GACQJLNeckPDsYMK7DmnHRmR7btjnpcbjroIJnhjyW3wHiwZyXuBzzeBxI CLU3UhsEX6O40rScLuJqtirS3gcjvH+6X0hAdPpXpPuig5uGf6CJJWJFpIU64y+tbEZi k0EY8ptTRhHcif3/SB6irW1PQMHhoUc/N9Ok6nOYCNJdDT0CYHy2O2wz5bS6KCbytCEA /nCg== 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:dkim-signature; bh=KdZYtJLDRb9x+/tacCvutz61fqLYajL5kPnJqkf0xhM=; b=lYOfdXtg3n+/Px/GzCtEH4SnGelvEBk10GyIdbCfVBb88EHSClHUc5xaug/fIWhy/e g7b4O97z7JGcvHhboxA3CPnO5e6HkfOQ9+T9arl0mWC/favLqRZt8w3LgTa4xT49uYPu LTRdULpOZaaJ3ODVe9Aqvr48g4PXhP515dWyk5gOJ/nXAxsvdvvAF76mTLHp4Kx04rCZ SEH3vgd2FKeWU4V6jabtGYKnwK0YwyjRAJwLYT2h8DxWhMXuh3b82h93KykJUkjQEOq/ lK3+B6axj+x1f9tnD5ugu7E4fYFm9/Hrk10CkV2a6AzilPdWPQE1b7c8kbAchAOfNyF9 ZI3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LK6fVQE7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs38-20020a1709072d2600b00778d193ca81si10547809ejc.550.2022.12.19.08.05.58; Mon, 19 Dec 2022 08:06:16 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LK6fVQE7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232860AbiLSPGD (ORCPT + 71 others); Mon, 19 Dec 2022 10:06:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbiLSPFb (ORCPT ); Mon, 19 Dec 2022 10:05:31 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B50E0CD; Mon, 19 Dec 2022 07:05:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KdZYtJLDRb9x+/tacCvutz61fqLYajL5kPnJqkf0xhM=; b=LK6fVQE7Ey5+B3j7gHOi5eOm5y 0TcSfYAy8s/ZBadf3MKVq6b944bzYM5noq5/+ZkDJC4oiaYWYMCZfuF/Ot8FNE8fi++CiTpfoirk4 vFchFv39449g/A41kDy2376QCvoFJPcSTTuUXz3yDOq2OBinOngRmgZzC+PnJAn4YJHqPcfdwoHcb wlW4BxPDt4MAP6Y2pdmw/FFXGO99i0sQ7GzgyGG90IRlceF0QGWdmKSd7bDknIhvsxw3VfpIP/cUC YdIvJ8CeQ9o67hON9mEQuOn9KnFQVv6XwqtzUdUOkBEBXjOiJxBpWr3MMd+2UZRwjcoSfiXjNnwRL n7+tY16g==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7HhT-000p6L-Bf; Mon, 19 Dec 2022 15:05:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 39E1F300348; Mon, 19 Dec 2022 16:04:55 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1EEFC202FE50F; Mon, 19 Dec 2022 16:04:55 +0100 (CET) Date: Mon, 19 Dec 2022 16:04:55 +0100 From: Peter Zijlstra To: Dan Li Cc: Masahiro Yamada , Michal Marek , Nick Desaulniers , Catalin Marinas , Will Deacon , Sami Tolvanen , Kees Cook , Nathan Chancellor , Tom Rix , "Paul E. McKenney" , Mark Rutland , 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: <20221219132731.6ng4sz2nv6ujvu7i@ubuntu> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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. A trap is always a single instruction.