Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2100772rwj; Sun, 18 Dec 2022 22:46:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf77gyUp8ItSI/3hrzLJAoPlPjFmRlH9GninE8QIg8Cti2VhC7uco1TgItfZteb6exKVVthF X-Received: by 2002:a05:6a20:d2c5:b0:a3:8eb5:6869 with SMTP id ir5-20020a056a20d2c500b000a38eb56869mr51711261pzb.14.1671432390685; Sun, 18 Dec 2022 22:46:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671432390; cv=none; d=google.com; s=arc-20160816; b=exHkedS5k6ZmGuVrQeAww7C+4MaXUWIkpKbRq2QotBtL8+QrpaDaCdFnMOpUTCGGGY lfdAqa/Tn12IK5G+Ch80n0PFEHbv2B9E95ILCDBDuHBHiXU3x+ExHREZae963hYRqfwj kVAZl7KuH40CdSOINZJrHHt3z+ZsU2FCN92QItKxH8hJYOyGiwBl/+F6KNSacEIc/w8M xPfg2abT8t9H9MpeNTBJwO5pHxESCsvN8R7dV7wTvOd8HHZFqdefgkUHsuTuY5I/mWeD 0WoJcYQXOSlF3Cmn+8BAT5jCrVuFbC7tl2F3Ln4In5wzW9jYgPn90qXVHvyOQEf8hFDy 3vJQ== 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=x6wBmBynq3nQh89d9yjAKo+Zm4+3fSnMMUhm5AG3pJM=; b=GvIn1Zgj+mZtA7C8o38oitBtraGqIc4PVvza+ETxJ1rmgOQAYdFCgH8qQezBpjp/J9 70R57C3fIrR7mVjO/LmRb0M01cGG0iiYhzl0T4okv/mmcfflV0pRDOqrtGsic5MaG+/Y SdnL1M5MVmhiiq+ygzlkK1pOMEWVtu0Ej7MMaLwY45BZ6lZjRnWyeWAKnLwmsW9IdJNU MO7CTkTCnlLJdLpoxgLSvfkYhJzqFpxfICQ1Rld6LR9pb7ZuGB4hox4RJT5eWOkAD8u7 2m13e0iOZ3ZE2U/ZPVnWDbvhcK1MM0RJ/tVEqpKoD539PPSx3CpsyPEn5d0VFC9VXRyJ 4LDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S+g8Kqll; 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 h62-20020a636c41000000b0048a5e036c44si3446300pgc.383.2022.12.18.22.46.21; Sun, 18 Dec 2022 22:46:30 -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=S+g8Kqll; 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 S231167AbiLSGiQ (ORCPT + 70 others); Mon, 19 Dec 2022 01:38:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiLSGiN (ORCPT ); Mon, 19 Dec 2022 01:38:13 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884446402; Sun, 18 Dec 2022 22:38:12 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id w20so1495408ply.12; Sun, 18 Dec 2022 22:38:12 -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=x6wBmBynq3nQh89d9yjAKo+Zm4+3fSnMMUhm5AG3pJM=; b=S+g8KqllwWEGtkNcOGEJzH+dxc16IDbnHaLIL8kA1qbNRTBzIEPovDirRmORPFY261 eAOgaIZWWRdqk1aV2+eaL2PijXAcAgqYhHeY5F2pOrETsfYdmTiwD2QUHYSn5dJBeEOW u2LG4O8Lw2+FFfQJaXecxQR0SrcMrRNakG03ZZ4PXF+dmbLI9/UATauOzqKKaYOHGHcv ODQbTFOSdr62rOsO1JGLLg7RkcCazHP8/1bue+WqY/9Zi0r3PAEKx1cbTDXAjAWihV3t tW0YH/ZfeO58ePx0FACiVpJNY3ej6AKDhgt/kiOu+hTq4+LIE35r4Nc7dtpMPdbH/Pmb rixA== 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=x6wBmBynq3nQh89d9yjAKo+Zm4+3fSnMMUhm5AG3pJM=; b=IbIbrTueEneqn/eOO21pKO6CAfRJIrKDdXs957JBbKLOmcd7IuNRzECOqzqC72honk gcbzyZJ7CyPULOt1Vaqcx1cC1ZGTBzsEL0IUcozzCKjZWNIj4sKxsi5Q1YnbobVG506i kLat6TwUR7TWKL2a9DM+TXJ/ZOj7dKFEUlnPmEgX4I/1ugltwPmZg0nyDpMwW/Y9M04Q PHYhMCd51F4aietaT5O1Dpkq2q6nou/93vFk5ZU9V4hI9dkANW5d1fI0dwp4RYvYrxgf WukOs2vUog24fIV9xUXrWicgpVHy3sQEefEvQ82CdaEM507Lre0QyAiU67gYzRfc2nIP zidg== X-Gm-Message-State: ANoB5pliAPYzi3AQvrO/6aOXLnIEdEgfJYSXKDlLjc5dYL+K6D3lkjQd fJxEQpH6+y3TqV0K8/abc5I= X-Received: by 2002:a17:902:ef47:b0:187:1b7a:6930 with SMTP id e7-20020a170902ef4700b001871b7a6930mr47705835plx.6.1671431891959; Sun, 18 Dec 2022 22:38:11 -0800 (PST) Received: from localhost ([103.152.220.92]) by smtp.gmail.com with ESMTPSA id n10-20020a170902e54a00b0018b025d9a40sm6163746plf.256.2022.12.18.22.38.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Dec 2022 22:38:11 -0800 (PST) Date: Sun, 18 Dec 2022 22:38:09 -0800 From: Dan Li To: Masahiro Yamada , Michal Marek , Nick Desaulniers , Catalin Marinas , Will Deacon , Sami Tolvanen , Kees Cook , Nathan Chancellor , Tom Rix , Peter Zijlstra , "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 Cc: 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 Subject: Re: [RFC/RFT] CFI: Add support for gcc CFI in aarch64 Message-ID: <20221219063809.xgd6jjio4f7j5ysw@ubuntu> References: <20221219061758.23321-1-ashimida.1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221219061758.23321-1-ashimida.1990@gmail.com> 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 + Cc: linux-hardening@vger.kernel.org On 12/18, Dan Li wrote: > Based on Sami's patch[1], this patch makes the corresponding kernel > configuration of CFI available when compiling the kernel with the gcc[2]. > > The code after enabling cfi is as follows: > > int (*p)(void); > int func (int) > { > p(); > } > > __cfi_func: > .4byte 0x439d3502 > func: > ...... > adrp x0, p > add x0, x0, :lo12:p > mov w1, 23592 > movk w1, 0x4601, lsl 16 > cmp w0, w1 > beq .L2 > ...... > bl cfi_check_failed > .L2: > blr x19 > ret > > In the compiler part[4], there are some differences from Sami's > implementation[3], mainly including: