Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp239381rwl; Sat, 25 Mar 2023 01:12:56 -0700 (PDT) X-Google-Smtp-Source: AK7set9/MXapVH0Tp811Y7CSvlNbDq6ywr6mW3cl4jrXykI7+iYpMWl+HWOTmdONx4LVM5L4UHaB X-Received: by 2002:a17:906:cb9b:b0:8f4:809e:faee with SMTP id mf27-20020a170906cb9b00b008f4809efaeemr12467800ejb.19.1679731976733; Sat, 25 Mar 2023 01:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679731976; cv=none; d=google.com; s=arc-20160816; b=SnWOvceO6z761UKLnPO4Qtyl2cKBR7ya3vNuQ/XsFxj26cvkRnRebdAJuT4tGxybhJ tFP2m4grMlG7tQguDE7It/s43Vvnab5X96xzHP6AgcIE9y0WGNomLN84bpLSuVSfC4Fs PRqwe+aYsZLHb0YS69JyhwegMX9CYezkE/JBZQB8NnnvIx5uam8Rs75x3ZzNn1QEVByT p7WXhfMMvKwccVKqFqtdzZ2tMrgDhEeMGqxMRfGaBYC4bLPqpBzuMw/iCYYcgfD2qttB 0ShiqUidroDjT5f23Bp5LCnJhmCoVxzNdVb8OSGkBwo3kaTdn9a2h1PUia1OT+qRfM8d N10A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=+NlJ/oPig1GP7X1e2c7GDto79ZOIHWgulBZ822qNni0=; b=cqaF8y/Mal3f1eNztzB/t5ku/34Znz6WFixZtwhBtPWA3mWsLQYq2VnYHp4q/+UbuX 1+tu20ONF89q/d3zUErGvR2gLe69l/JdmADkhlAB1AHReJeV400PFXKSHAZghXXUtWMg La1/8kTfkNnjOD4bzqv7nvwnpUfe3XFsTbJ83zB1BOmydtBAXmm5cq5tiXsTe+0xp30b yher92m/qokbR2y03p5eY59G0k+tQMdesXaPgrANQkWiF/OapeTKayh/FC9ZN5EQgrRp VDs/jSy9KavhnHXLrMhvl1oK4Fs8OuA7TnUWiJ5hFcDYqKMtC9LtbpGwKim4XDTcpw55 W68Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="MAds8lO/"; 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 f7-20020a50ee87000000b004ab4411217csi23390766edr.394.2023.03.25.01.12.28; Sat, 25 Mar 2023 01:12:56 -0700 (PDT) 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="MAds8lO/"; 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 S230350AbjCYIMD (ORCPT + 99 others); Sat, 25 Mar 2023 04:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYIMC (ORCPT ); Sat, 25 Mar 2023 04:12:02 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E45712841; Sat, 25 Mar 2023 01:12:01 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 20so3951665lju.0; Sat, 25 Mar 2023 01:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679731918; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=+NlJ/oPig1GP7X1e2c7GDto79ZOIHWgulBZ822qNni0=; b=MAds8lO/SQafNzkzu9ERbPN00+9EVMg0nVXQHSKzx5xVWQRzNxVtddouKOyGkU5kpo ahAUApjRyB4tG4GifLdRUnQ6xNGdrZAkkTG9TU8AEfXRnjKq/7+1Np0T7F+UKpoYg8vl Hl7f97ZfuWXxy7ro+uE17qnhYq8vxvbCEnTwLlbX9P3EDE/bbvjrkGAF/Ax7ze77Yi68 NiwV7EHhDwW/oJvfN5RJ0xZwInUZAPA2au5kQIxP4BrXZmxjun9GCm9vq2Ta75em70iC s0Hda8iINwzZ7a2G8zetIGAqfiUQsA69Ebc3nE/Z4AvxM8uUzX8TWWsqfo21WVIHUlWq NHWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679731918; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+NlJ/oPig1GP7X1e2c7GDto79ZOIHWgulBZ822qNni0=; b=TZvF/CrNls1GmYuBa4VpNwgtIG5+GgpFq5QE1oyA3R96blMpVxUW4DlOTjuQimbTV5 8jvCsIjVQURPhtc0jiEdsCO7iL7fmFlKkOFfi+xPD/D2OxhcJ+nuK5JfHLZHLIKGD/ST 1k7LU5nhpjjZtrsC40woyT9MX/Bg9ufIlu4uiwQP9O0BGgDCT3EUYRa8scb+ltrY9czh cuetMGex+Tn/UrvemDOphKM9zGV3taL2tWJBwBKgG0WayiyRzZOtjaw1i68b6NuRnG4A YvaObax67Etjse3O/hUblEQCsj+2jS1nV5TJ2HzQBFrpz8DJTw1c/jvp/+z41J7llh7b 9INw== X-Gm-Message-State: AAQBX9fY3hYFDxPWfK3Yxjua7G49HRTdM/z5Qmq4z2jXQSNGnwB6n90G CCxy/7spzyIXZJs9t+slNRo= X-Received: by 2002:a2e:86d5:0:b0:29f:e144:6c6a with SMTP id n21-20020a2e86d5000000b0029fe1446c6amr1490057ljj.23.1679731918514; Sat, 25 Mar 2023 01:11:58 -0700 (PDT) Received: from localhost ([188.119.65.94]) by smtp.gmail.com with ESMTPSA id m18-20020a195212000000b004e95f53adc7sm3720859lfb.27.2023.03.25.01.11.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Mar 2023 01:11:57 -0700 (PDT) From: Dan Li To: gcc-patches@gcc.gnu.org, Richard Sandiford , 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" , Dan Li , 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: [RFC/RFT,V2 0/3] Add compiler support for Kernel Control Flow Integrity Date: Sat, 25 Mar 2023 01:11:14 -0700 Message-Id: <20230325081117.93245-1-ashimida.1990@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221219055431.22596-1-ashimida.1990@gmail.com> References: <20221219055431.22596-1-ashimida.1990@gmail.com> X-Spam-Status: No, score=0.1 required=5.0 tests=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=unavailable 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 This series of patches is mainly used to support the control flow integrity protection of the linux kernel [1], which is similar to -fsanitize=kcfi in clang 16.0 [2,3]. Any suggestion please let me know :). Thanks, Dan. [1] https://lore.kernel.org/all/20220908215504.3686827-1-samitolvanen@google.com/ [2] https://clang.llvm.org/docs/ControlFlowIntegrity.html [3] https://reviews.llvm.org/D119296 Signed-off-by: Dan Li --- Dan Li (3): [PR102768] flag-types.h (enum sanitize_code): Extend sanitize_code to 64 bits to support more features [PR102768] Support CFI: Add basic support for Kernel Control Flow Integrity [PR102768] aarch64: Add support for Kernel Control Flow Integrity gcc/asan.h | 4 +- gcc/c-family/c-attribs.cc | 10 +- gcc/c-family/c-common.h | 2 +- gcc/c/c-parser.cc | 4 +- gcc/cfgexpand.cc | 26 ++++++ gcc/cgraphunit.cc | 34 +++++++ gcc/combine.cc | 1 + gcc/common.opt | 4 +- gcc/config/aarch64/aarch64.cc | 166 ++++++++++++++++++++++++++++++++++ gcc/cp/typeck.cc | 2 +- gcc/doc/invoke.texi | 36 ++++++++ gcc/doc/tm.texi | 27 ++++++ gcc/doc/tm.texi.in | 8 ++ gcc/dwarf2asm.cc | 2 +- gcc/emit-rtl.cc | 1 + gcc/emit-rtl.h | 4 + gcc/final.cc | 24 ++++- gcc/flag-types.h | 67 +++++++------- gcc/gimple.cc | 11 +++ gcc/gimple.h | 5 +- gcc/opt-suggestions.cc | 2 +- gcc/opts.cc | 26 +++--- gcc/opts.h | 8 +- gcc/output.h | 3 + gcc/reg-notes.def | 1 + gcc/target.def | 38 ++++++++ gcc/toplev.cc | 4 + gcc/tree-cfg.cc | 2 +- gcc/tree.cc | 144 +++++++++++++++++++++++++++++ gcc/tree.h | 1 + gcc/varasm.cc | 26 ++++++ 31 files changed, 627 insertions(+), 66 deletions(-) -- 2.17.1