From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from va-2-38.ptr.blmpb.com (va-2-38.ptr.blmpb.com [209.127.231.38]) by sourceware.org (Postfix) with UTF8SMTPS id 8867938582A2 for ; Mon, 18 Dec 2023 01:05:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8867938582A2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lixiang.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lixiang.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8867938582A2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.231.38 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702861537; cv=none; b=mt9JXu5H4sMkjWyNcI8gWDcKtLc09WzrNsziQ9EftMExnt/GBFz8cnaC+3FjaAE6/cYP8vfoXJr7WouVjQsYl2VdNg/xlI3VxtEd2r1evngY8CpysTzef49pQ1S3hs+4oYmFWvLoDJSxWobTgmYgKiLyVi8XynMUJt8op8yIvqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702861537; c=relaxed/simple; bh=j6FRoP4CcfMnkkpUEgC6X7IrNI3n+Eb0rdf1DhR7S0E=; h=DKIM-Signature:From:Date:Subject:Mime-Version:To:Message-Id; b=uRrJkSdHN0DQYy9SSHMMak5kOTsHjKmMgvgAjfygV6h/JDFtZTMqCi8T409LhW0kbCanhbtXpf34XO0X8WBFzNAPQINcseIvzrYe7Uv58ezRbrtuVtuGStYkN7+pZgohgBnIyq2ofsRTPh8MeXiNGSwQqkDT1NLXfA4gYta7BNw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=lixiang-com.20200927.dkim.feishu.cn; t=1702861528; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=Yof8dE/0QFqM9PFjVwyL5jlcWF/XJogkCt1i7OS9CfQ=; b=cHDfURPFqG3UVe9C1WAgMfrENNFdhySKUQz7jpt36SUZXBH/uMLnn39ONCK0vWDl8VvmBP ufJq9nLlLBECCx34jrUXe//TfMAjOVH+5v9SL75CIpIlycxp+jgeXDj1QB4/XOixEp4e27 M4A3kes4TbBNr1yK0Su2XMcbjZuldpaPs3xwtucWSnQPHIBoSXFJBSbMGct1lC6MMWMkYW YI3nBOOaCXsQrwTrQxRpBXRBS6s7a7SfhmmBA2dqgcc8pCj6Xpsw5NbjRIZudA0ofkzD55 2udcX/qSgphQsD2F9F4QdWQBbghY6gVAVi+Rry/U84bCtK968RKHN6ThLucEqQ== From: "Wang" Date: Mon, 18 Dec 2023 09:05:23 +0800 In-Reply-To: Content-Type: multipart/alternative; boundary=70183ea0fc9c7054bd87a8e04834373ce373647ac2b3d1dbb3a367965697 X-Original-From: 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" , , "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" , , "Yuntao Wang" , "Yu Zhao" , "Zhen Lei" , , , , , , , , , "Dan Li" Subject: Re: [RFC/RFT,V2] CFI: Add support for gcc CFI in aarch64 Mime-Version: 1.0 Content-Language: en-US To: "Mark Rutland" Received: from [10.124.192.10] ([111.205.82.9]) by smtp.feishu.cn with ESMTPS; Mon, 18 Dec 2023 09:05:26 +0800 X-Lms-Return-Path: Message-Id: <435f6ecb-47f9-9282-3eea-058b27ca814c@lixiang.com> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Content-Transfer-Encoding: 8bit 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> X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,HTML_MESSAGE,KAM_NUMSUBJECT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --70183ea0fc9c7054bd87a8e04834373ce373647ac2b3d1dbb3a367965697 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On 2023/12/13 22:45, Mark Rutland wrote: > 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=E2=80=AFAM 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 includi= ng: >>>>>> >>>>>> 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, whi= ch >>>>> 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 C= FI. >> >> 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=EF=BC= =8Cbecause >> 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? >=20 > I'm not sure what you're suggesting here exactly, do you mean to add a ty= pe ID > scheme that's incompatible with clang, leaving everything else the same? = If so, > what sort of scheme are you proposing? >=20 > It seems unfortunate to have a different scheme, but IIUC we expect all k= ernel > objects to be built with the same compiler. >=20 > Mark. Thanks Mark, I will consider a scheme that is compatible with clang. Likun Wang. =E5=A3=B0=E6=98=8E=EF=BC=9A=E8=BF=99=E5=B0=81=E9=82=AE=E4=BB=B6=E5=8F=AA=E5= =85=81=E8=AE=B8=E6=96=87=E4=BB=B6=E6=8E=A5=E6=94=B6=E8=80=85=E9=98=85=E8=AF= =BB=EF=BC=8C=E6=9C=89=E5=BE=88=E9=AB=98=E7=9A=84=E6=9C=BA=E5=AF=86=E6=80=A7= =E8=A6=81=E6=B1=82=E3=80=82=E7=A6=81=E6=AD=A2=E5=85=B6=E4=BB=96=E4=BA=BA=E4= =BD=BF=E7=94=A8=E3=80=81=E6=89=93=E5=BC=80=E3=80=81=E5=A4=8D=E5=88=B6=E6=88= =96=E8=BD=AC=E5=8F=91=E9=87=8C=E9=9D=A2=E7=9A=84=E4=BB=BB=E4=BD=95=E5=86=85= =E5=AE=B9=E3=80=82=E5=A6=82=E6=9E=9C=E6=9C=AC=E9=82=AE=E4=BB=B6=E9=94=99=E8= =AF=AF=E5=9C=B0=E5=8F=91=E7=BB=99=E4=BA=86=E4=BD=A0=EF=BC=8C=E8=AF=B7=E8=81= =94=E7=B3=BB=E9=82=AE=E4=BB=B6=E5=8F=91=E5=87=BA=E8=80=85=E5=B9=B6=E5=88=A0= =E9=99=A4=E8=BF=99=E4=B8=AA=E6=96=87=E4=BB=B6=E3=80=82=E6=9C=BA=E5=AF=86=E5= =8F=8A=E6=B3=95=E5=BE=8B=E7=9A=84=E7=89=B9=E6=9D=83=E5=B9=B6=E4=B8=8D=E5=9B= =A0=E4=B8=BA=E8=AF=AF=E5=8F=91=E9=82=AE=E4=BB=B6=E8=80=8C=E6=94=BE=E5=BC=83= =E6=88=96=E4=B8=A7=E5=A4=B1=E3=80=82=E4=BB=BB=E4=BD=95=E6=8F=90=E5=87=BA=E7= =9A=84=E8=A7=82=E7=82=B9=E6=88=96=E6=84=8F=E8=A7=81=E5=8F=AA=E5=B1=9E=E4=BA= =8E=E4=BD=9C=E8=80=85=E7=9A=84=E4=B8=AA=E4=BA=BA=E8=A7=81=E8=A7=A3=EF=BC=8C= =E5=B9=B6=E4=B8=8D=E4=B8=80=E5=AE=9A=E4=BB=A3=E8=A1=A8=E6=9C=AC=E5=85=AC=E5= =8F=B8=E3=80=82= --70183ea0fc9c7054bd87a8e04834373ce373647ac2b3d1dbb3a367965697--