Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1690052pxb; Fri, 20 Aug 2021 11:24:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIZABtC48ot6HQuAQERK2ND/vF1+tecLo6CLroiOq7RoZjZa7bLy1+KWYMZ2+fOJNg4iNt X-Received: by 2002:a05:6638:18c:: with SMTP id a12mr18873787jaq.100.1629483883908; Fri, 20 Aug 2021 11:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629483883; cv=none; d=google.com; s=arc-20160816; b=OJqDyeg2yTRd5+FqkCkAJGm6HgHqSmB0s4tfbSAhs/kumySk4QphJM7BlqeTRgmJcw gpftFgX06aR6QuABkYvKxG1ju2z6LOmRID2VOjFRmSeuOL63fu8uqYpj9mrMs/s7r6M3 +lommHebj35FzMgNizl0ym73m0Ih8g36LQEznk4e1yDgSxPMlSDgGdAkCyMQQYf4AWld d+lHqoWTkd0NaEeVhSZa5cWnAlBVjUiTG4jIBdl1sdu9FOocCd5xgyueCmfIWI+l+3rF 4oT768yEQ5++a405jW1SGXqF+ipeN7b1r57DS3glD0FCDY9glZUkyKnSz6AvqkGc/xzO V5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yPXSipZMyaCSWdvYxvZiD0W9OCguHZM+iT8tqHzo780=; b=dXHg7cSvTxE3eKNmkgLe5zdKmYCsDLAGoaezq5cEOBZxHJsdEsDs+E5/u3v8DQlOgO 8vEZy4Si9wXPap1fxTnI3HLdFluoJMvx6++nKZ3MnvDmclNQ2XVmLHWMu1/GV5YxbTna OVvSICgSjdSI6ze+//mcoc54rjHCdcQgprTAWUD8nqrfIc+NnYXwoa+GB2H/+QGt0B2d eUjuk1oRCeYbaSaQU3vwmBNPDGSkfuuB68nBRtX/nOR1OnVaWRoOQcQ6Dpyy/kthGmZi wMFijYSqHjkp/Gyhdwp0VGZZCC0vyx8LI9lWaSIoV5pEAubrCncvNjwFtWiDJcEeE5Qd mrfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si7203468ils.62.2021.08.20.11.24.30; Fri, 20 Aug 2021 11:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238051AbhHTSYT (ORCPT + 99 others); Fri, 20 Aug 2021 14:24:19 -0400 Received: from mga18.intel.com ([134.134.136.126]:48048 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236946AbhHTSXz (ORCPT ); Fri, 20 Aug 2021 14:23:55 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10082"; a="203964937" X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="203964937" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:07 -0700 X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="523799150" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:07 -0700 From: Yu-cheng Yu To: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , Rick P Edgecombe Cc: Yu-cheng Yu Subject: [PATCH v29 00/10] Control-flow Enforcement: Indirect Branch Tracking Date: Fri, 20 Aug 2021 11:22:35 -0700 Message-Id: <20210820182245.1188-1-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Control-flow Enforcement (CET) is a new Intel processor feature that blocks return/jump-oriented programming attacks. Details are in "Intel 64 and IA-32 Architectures Software Developer's Manual" [1]. This is the second part of CET and enables Indirect Branch Tracking (IBT). It is built on top of the shadow stack series. Changes in v29: - Rebase to Linus tree v5.14-rc6. Changes in v28: - Patch #10: Update change log and comments. - Rebase to Linus tree v5.14-rc2. Changes in v27: - Use a ucontext flag to save/restore IBT status. - Disable IBT support for IA32. - Rebase to Linus tree v5.13-rc2. [1] Intel 64 and IA-32 Architectures Software Developer's Manual: https://software.intel.com/en-us/download/intel-64-and-ia-32- architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4 H.J. Lu (3): x86/cet/ibt: Update arch_prctl functions for Indirect Branch Tracking x86/vdso: Insert endbr32/endbr64 to vDSO x86/vdso/32: Add ENDBR to __kernel_vsyscall entry point Yu-cheng Yu (7): x86/cet/ibt: Add Kconfig option for Indirect Branch Tracking x86/cet/ibt: Add user-mode Indirect Branch Tracking support x86/cet/ibt: Handle signals for Indirect Branch Tracking x86/cet/ibt: Disable IBT for ia32 x86/cet/ibt: Update ELF header parsing for Indirect Branch Tracking x86/vdso: Introduce ENDBR macro x86/vdso: Add ENDBR to __vdso_sgx_enter_enclave arch/x86/Kconfig | 19 +++++ arch/x86/entry/vdso/Makefile | 4 + arch/x86/entry/vdso/vdso32/system_call.S | 2 + arch/x86/entry/vdso/vsgx.S | 4 + arch/x86/ia32/ia32_signal.c | 22 +++++- arch/x86/include/asm/cet.h | 13 ++++ arch/x86/include/asm/disabled-features.h | 8 +- arch/x86/include/asm/elf.h | 13 +++- arch/x86/include/asm/vdso.h | 20 ++++- arch/x86/include/uapi/asm/ucontext.h | 5 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/cet_prctl.c | 5 ++ arch/x86/kernel/ibt.c | 99 ++++++++++++++++++++++++ arch/x86/kernel/process_64.c | 6 ++ arch/x86/kernel/signal.c | 6 ++ 15 files changed, 221 insertions(+), 6 deletions(-) create mode 100644 arch/x86/kernel/ibt.c -- 2.21.0