Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3306214rwj; Mon, 19 Dec 2022 16:29:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+qIH5imRZDLwC9O5074F8RhOsG9e9Kn7HgEdJs0KKdo3hu3PA41+KV8yn/+wlL0e05qt0 X-Received: by 2002:a05:6a20:3d22:b0:9d:efbf:48e8 with SMTP id y34-20020a056a203d2200b0009defbf48e8mr68719984pzi.44.1671496178702; Mon, 19 Dec 2022 16:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671496178; cv=none; d=google.com; s=arc-20160816; b=l7N+fkM7olyVayOM+AbmA39w8XMIaEOM98pbHNwpLmMW6c8tkJ9p2u9ctqFrLn1iHH P+GAKynzh98po4pT5WKNAM26NISCQK3v81ODcpKJXKn5kR6uFagIwFXnZN1mlB7DD2P6 RzGlRUiZC8XD+X3YD9w9wqHV+gPB36FyYD2JnoMmd9Ue+cOLYbHXYKxdcEYicgIG7tEW dMStZc4VXdGcjt7x2NcB7NpEASH+DS5sxlElqNzTN0WA8x5D6ygxK3g6xZVGBoi7ElSC hkYHwAZ1S+QaDtsn2PWmL3V2EC0K9kBi9rB33uezbB0PtoV5lH4Nn5BmJYzRg0Vycpoq Nplw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=iXhT24A08qIcxdPTrS8ABQk+wBAUtPj45USUD+WsbiA=; b=ye5Ejx14Ie4xgs3bW56tz4EEoHeB+VcZGv9+e1Qm4YQMefdczJgOF6SsjnMnDIbUAQ huI9cYFdM+0VOn5jLpi2NiiO8zXf3/cJ2XGnTAJu42+EY5RnIsAI7PXs5PP1q8hcoV9t 19oan4vNlC8wQHFdjuPuWKZNXBJJ5stVqC9WL30nkQ1HDpJX549qDEKPPLnqmYEYz7tM Yme3x6qC8+WzZM8VMEOwlOfqm9NPzqVsQf+PKbxKM6GGJUqpKpusdf2g2wHqNRoSubHe md1MpiLnq30Fov5rUeEkadohF8WCJqNutjyN2fM/CMRqeGfUX7FsX7XB7sA5sEck71Gv 98SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ikqXE5Sv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f129-20020a636a87000000b00476e62744a8si11896552pgc.388.2022.12.19.16.29.29; Mon, 19 Dec 2022 16:29:38 -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=@gmail.com header.s=20210112 header.b=ikqXE5Sv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232469AbiLSXiv (ORCPT + 70 others); Mon, 19 Dec 2022 18:38:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiLSXis (ORCPT ); Mon, 19 Dec 2022 18:38:48 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EDA4EE37; Mon, 19 Dec 2022 15:38:47 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id 3-20020a17090a098300b00219041dcbe9so10405093pjo.3; Mon, 19 Dec 2022 15:38:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=iXhT24A08qIcxdPTrS8ABQk+wBAUtPj45USUD+WsbiA=; b=ikqXE5Sv3C0Z7QeUtZToua8qSUDYVrSpl1Z9eJm2snZpS6OYsJc66Mfj20vV+0kPqu dJhRFfhQtTYN1idfPqN83/0d5vmM5VLsImAkcxhWamazE/Rzr8GOW4qft50gVwJ4Hhme 9FnDCgoMYp+l81g3xM7zvGN5i5vgKDqndedskEpd/sQeT2H2JIeNd14Z3ce5m6XtXvot t6C0qffyNuSAAtBnkYOAXx8MwJ/Del1fMjSU8HT5jS04SBiPtD2lzNOJZJliwGOsDDBk VC10uCA4xKtmWCbS/HtqbWj3Q2c/3GeZueSi6nzS4zUf2jKbbiY97HjsaePUMSCqfFFm lxvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iXhT24A08qIcxdPTrS8ABQk+wBAUtPj45USUD+WsbiA=; b=iyskpS0iD2qszOGQTkI9DUXtYv3h/XcqJZsKy44aii4IdDeNJ0k28N9WE72uZfPLop Ut5JEbEwZyaSDf/QW2FDkdJORW0H+cJ5zlvo8rJy3wJIu0de1LJtIMMVbz4MahmBxDto DBLzVJo7Kx0SAbRPsViINcMGFt8wUtZCkDb0lfrZm5tSAEJrRPvv6AgYkIVn35tEy40T vvXfcPlExAv4qzqTKro/pEzzswETWTq4bt8EaNimW/Lv2SRTn+4bh3HIZX4C0tSz6iYr yvyoE1VSuYrhCEhbF/Xtk1dAFq25dYUpcOWD0F91AOrTNydKHE0iohP73PzP1VhlV5e3 m8Pg== X-Gm-Message-State: ANoB5pnX94wWLlciXObOxgdXKElpiA5DQZgcQSR06W031ZxqC1bhlXGP lKYOQB2oa3JTqzjjyn35YoI= X-Received: by 2002:a05:6a20:9c8f:b0:a2:17a6:3e86 with SMTP id mj15-20020a056a209c8f00b000a217a63e86mr32379941pzb.55.1671493126783; Mon, 19 Dec 2022 15:38:46 -0800 (PST) Received: from localhost ([124.248.219.206]) by smtp.gmail.com with ESMTPSA id w6-20020a170902e88600b0017f8094a52asm7790420plg.29.2022.12.19.15.38.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Dec 2022 15:38:46 -0800 (PST) Date: Mon, 19 Dec 2022 15:38:41 -0800 From: Dan Li To: Peter Zijlstra 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: <20221219233841.4ywyegnzqhzfr4fo@ubuntu> 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: User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 12/19, 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. Oh ok, got it. > 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. > Yes, IIRC, long jumps also typically require at least three instructions in arm64. Thanks, Dan.