Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5363369rdb; Wed, 13 Dec 2023 06:46:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6rsO+aay0hjca8BsSWSH62yxtTGUpijknR7kBAfuv8vya5BuZehKu9VSxAoalvZbqBKCQ X-Received: by 2002:a17:902:9a0a:b0:1d0:6ffd:9e1c with SMTP id v10-20020a1709029a0a00b001d06ffd9e1cmr7278621plp.110.1702478798629; Wed, 13 Dec 2023 06:46:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702478798; cv=none; d=google.com; s=arc-20160816; b=vmJLfo5MV+wNcKVYSTn3LuR0zq7UFwP5RscH6SB0YKqelIIZcrTgUvZjz5P5toLNWi SIOg3o/O+JEFg5YgLAVuySROOtiGJ4WnPjMLSJmQJ4Ru/GyPxiOKit/FcOeLbR/X37qr 2Hkqj0/FmSyZSNsxaUa96sDy7EiF96p9OGKu9qkRxtSclWTdx1Ll03As24m9cgIEPX4I uhFUXxSrwtryMUiXCJMIUO3Wo56PPePLRbO2/BDw7/tyv9VXhf4C0QCpn96G9B3UxTci oo+ciiuzGtK/LWjm8HWJPrqxmI1EjfHxwaJPnnit9pGTa6E/y1jfmSCBKQ+8rw7mb6DI melg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qGd8/zVJ3VqefH8TVUt/6dqg8zquxXf5PUlX/JhV7og=; fh=UqK+v90CzsKq38TG4SmcnaaC7uCWyk5RboLQUaTMvNA=; b=K5UQbZfjUcx30iCtmWiOcsNf9OWa249erKenFytk9sENUZoqhF+N9a9hNZNeA/ha/h kZBWjwchiVauBMF8T4h7wkkdh0BToVgj4zFWY5vW2OJuVoajOkX0btZtSx59O+PUKtaz A+YmhFPBbhlfxPXeaXOdJ8k8IunrSAEsC0Y4HNUgaECsuB5p/9ztOuSzNn4rxIUzcSL2 alcGOi419f4lLx7qLzCjCc0BBTHGUTNPRapggdHf1r0aodT0ORM+5BAVot/gPhqaSWyo apEKaZ9VoDQ6LipZuhykgLXLrb66reazM5oEH04vS2s6k045C+euQjcc0vGEQH9X/GDL SHjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id d3-20020a170902aa8300b001d34722c444si1901140plr.584.2023.12.13.06.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:46:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 642FA809A9AC; Wed, 13 Dec 2023 06:46:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235521AbjLMOqQ (ORCPT + 99 others); Wed, 13 Dec 2023 09:46:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233684AbjLMOqD (ORCPT ); Wed, 13 Dec 2023 09:46:03 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66586110; Wed, 13 Dec 2023 06:45:23 -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 10C39FEC; Wed, 13 Dec 2023 06:46:09 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.42.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC3A93F738; Wed, 13 Dec 2023 06:45:13 -0800 (PST) Date: Wed, 13 Dec 2023 14:45:10 +0000 From: Mark Rutland To: Wang Cc: Sami Tolvanen , Peter Zijlstra , Aaron Tomlin , Alexander Potapenko , Alexander Shishkin , Alexandru Elisei , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Arnaldo Carvalho de Melo , Arnd Bergmann , Boqun Feng , Borislav Petkov , Borislav Petkov , Brian Gerst , Catalin Marinas , Changbin Du , Christophe Leroy , Dave Hansen , Dmitry Torokhov , "Eric W. Biederman" , Frederic Weisbecker , gcc-patches@gcc.gnu.org, Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , Jiri Olsa , Josh Poimboeuf , Juergen Gross , Kalesh Singh , Kees Cook , Kumar Kartikeya Dwivedi , Luis Chamberlain , Marco Elver , Mark Brown , Masahiro Yamada , Masami Hiramatsu , Michael Roth , Michal Marek , Miguel Ojeda , Namhyung Kim , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , "Paul E. McKenney" , Richard Sandiford , Song Liu , Thomas Gleixner , Tom Rix , Uros Bizjak , Will Deacon , x86@kernel.org, Yuntao Wang , Yu Zhao , Zhen Lei , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-perf-users@vger.kernel.org, Dan Li Subject: Re: [RFC/RFT,V2] CFI: Add support for gcc CFI in aarch64 Message-ID: References: <20221219061758.23321-1-ashimida.1990@gmail.com> <20230325085416.95191-1-ashimida.1990@gmail.com> <20230327093016.GB4253@hirez.programming.kicks-ass.net> <4a84af95-6270-6764-6a40-875ec20fc3e1@lixiang.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4a84af95-6270-6764-6a40-875ec20fc3e1@lixiang.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 06:46:31 -0800 (PST) On Wed, Dec 13, 2023 at 05:01:07PM +0800, Wang wrote: > On 2023/12/13 16:48, Dan Li wrote: > > + Likun > > > > On Tue, 28 Mar 2023 at 06:18, Sami Tolvanen wrote: > >> On Mon, Mar 27, 2023 at 2:30 AM Peter Zijlstra wrote: > >>> On Sat, Mar 25, 2023 at 01:54:16AM -0700, Dan Li wrote: > >>> > >>>> In the compiler part[4], most of the content is the same as Sami's > >>>> implementation[3], except for some minor differences, mainly including: > >>>> > >>>> 1. The function typeid is calculated differently and it is difficult > >>>> to be consistent. > >>> This means there is an effective ABI break between the compilers, which > >>> is sad :-( Is there really nothing to be done about this? > >> I agree, this would be unfortunate, and would also be a compatibility > >> issue with rustc where there's ongoing work to support > >> clang-compatible CFI type hashes: > >> > >> https://github.com/rust-lang/rust/pull/105452 > >> > >> Sami > > Hi Peter and Sami > > I am Dan Li's colleague, and I will take over and continue the work of CFI. > > Regarding the issue of gcc cfi type id being compatible with clang, we > have analyzed and verified: > > 1. clang uses Mangling defined in Itanium C++ ABI to encode the function > prototype, and uses the encoding result as input to generate cfi type id; > 2. Currently, gcc only implements mangling for the C++ compiler, and the > function prototype coding generated by these interfaces is compatible > with clang, but gcc's c compiler does not support mangling.; > > Adding mangling to gcc's c compiler is a huge and difficult task,because > we have to refactor the mangling of C++, splitting it into basic > mangling and language specific mangling, and adding support for the c > language which requires a deep understanding of the compiler and > language processing parts. > > And for the kernel cfi, I suggest separating type compatibility from CFI > basic functions. Type compatibility is independent from CFI basic > funcitons and should be dealt with under another topic. Should we focus > on the main issus of cfi, and let it work first on linux kernel, and > left the compatible issue to be solved later? I'm not sure what you're suggesting here exactly, do you mean to add a type ID scheme that's incompatible with clang, leaving everything else the same? If so, what sort of scheme are you proposing? It seems unfortunate to have a different scheme, but IIUC we expect all kernel objects to be built with the same compiler. Mark.