From patchwork Fri Sep 21 15:05:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-cheng Yu X-Patchwork-Id: 10610293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66D7714BD for ; Fri, 21 Sep 2018 15:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5646F2E501 for ; Fri, 21 Sep 2018 15:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5433C2E540; Fri, 21 Sep 2018 15:11:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD4492E525 for ; Fri, 21 Sep 2018 15:11:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C13D8E0022; Fri, 21 Sep 2018 11:10:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 873318E0020; Fri, 21 Sep 2018 11:10:29 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78B278E0022; Fri, 21 Sep 2018 11:10:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 390518E0020 for ; Fri, 21 Sep 2018 11:10:29 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id g9-v6so5795484pgc.16 for ; Fri, 21 Sep 2018 08:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=TzXAdJk6GLBdsR3JRfMehxivF+WkFDmQbR9flyMAfbU=; b=SAxPzOckikRcyY5yXlJAWiX4zaL4p0O5ZlfhKgXNeLMN1IBMC9aQHK6bY7KlnsoOaG m69oDDUzmWP0n9NC2lH9hn8J2ItzUlJy12eFcIp51IUGz3+x9gIxouGMmtSJigWINkMr f7iWvW/KpXBR0tPCXndJGMyqG3rcCRcUevxpAJKTRKS0etrBIjgi8lcSEfO+9WjmivlB JSQ4XoPP4SbFSRRXPDTt7xDUp1G05T7rrWpoZzKOaGLoZv1ZCHCj/MpwhJ556Vj1aQso QMAnATFa0rk6o7vS0vorUpd5j3qgFk+l6byiMK2JEOha5jqE8vNVEVNhmeeLLtE4SeMl u1tw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APzg51BqOHGwnpcheIFp3DMQEQOMsr+FMqjE07gKhnyuQy2G16e16XRZ fg4i0+pJ0kqNOTNS3MTggOiPapThzDILK1NpnQa4b5HxyZk4pH7LTMi7DEXUw4JZLQHgUC5Gej3 gyx3ehNkyBSyrGzJG9KeUbnQ9UXjYMnNSXRajernOPlOeGVQ6STjVGdKzf+hGZ/EALg== X-Received: by 2002:a62:985a:: with SMTP id q87-v6mr47211973pfd.64.1537542628910; Fri, 21 Sep 2018 08:10:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdakYRENhZJcvujXbtbs9tR6X71h9xkQ7I2FHV8oj17pd/7/8qexsSHjNPR01JGfmKWtEjr+ X-Received: by 2002:a62:985a:: with SMTP id q87-v6mr47211906pfd.64.1537542628046; Fri, 21 Sep 2018 08:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537542628; cv=none; d=google.com; s=arc-20160816; b=o0l0+XEXTN4ZZaEX9wDEsCDrdRzlyOxkXm7mHKlEe/IZr0PtHJ7BOlARNcBRCZ7SU4 psQVcWOb+TNQxLfhRIHfOCbfCt50PHzkZui+gm3t6EdXruts5oFG20Lls/5MQ1n1G8V2 XcKUBk+QcYiIcre+R0B6IL+sSwhjkhP3l6mcZPUMcuBFZmuI9fExnFX38ANCVb/3U22/ MdVcamTHHvyKutAbiIHvJ+WDXf35Do7yDKVCwE1Hn1fZJMDIwOEMZmG25i29EMBOrWMQ 1CDKo5FmFJywmZUNUOlu/QDiKOMUaua/fbm7TOPF7Vtbnac9ZD8GhzH4rlqICMPc7f8n jisg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=TzXAdJk6GLBdsR3JRfMehxivF+WkFDmQbR9flyMAfbU=; b=HMdg2V9z+bgmYvSO5CcTHbAmLis2KBT7ZdFKZUBX3IN5u7XlLppc8i5Z4rYt0R3pP9 +uLJOLKpZ9F/r4t2E9+CoIDE4yn3CzCLwZQ7IfhUX3kaU4XJW2vPpU9dYj4/4disEvq+ +6NDeJ6aa+WTNoGn4R/NofITI80/xxdXQtI6D9VM8NisaGVfFiGAJiADy8PmB473sQgC HP6QsKgnXUzeyhSsOncf0MpT+xDryhnPcPvqdZ75mk9iYX0z/yJ71Pnjgb75p02k1Bgi 0dE+ywwCl3e6+/PsNvtfbh5afRt3F4+JXA1mgIEgFZJXPAIMPbHKGXDl4LbidqCj8FG3 g+7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id g16-v6si2805450pgd.354.2018.09.21.08.10.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 08:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2018 08:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="88187958" Received: from 2b52.sc.intel.com ([143.183.136.51]) by fmsmga002.fm.intel.com with ESMTP; 21 Sep 2018 08:10:27 -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 , Cyrill Gorcunov , Dave Hansen , 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" , Vedvyas Shanbhogue Cc: Yu-cheng Yu Subject: [RFC PATCH v4 0/9] Control Flow Enforcement: Branch Tracking, PTRACE Date: Fri, 21 Sep 2018 08:05:44 -0700 Message-Id: <20180921150553.21016-1-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The previous version of CET patches can be found in the following link: https://lkml.org/lkml/2018/8/30/582 Summary of changes from v3: Move IBT legacy code bitmap allocation back to when the application requests it. Most application do not need the bitmap. It is only used when an application does dlopen() a legacy library. In the previous version, we pre-allocated the bitmap for every IBT- enabled application to avoid creating a hole in the linear address. However, this created a problem when the system has limited memory. H.J. Lu (1): x86: Insert endbr32/endbr64 to vDSO Yu-cheng Yu (8): x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking x86/cet/ibt: User-mode indirect branch tracking support x86/cet/ibt: Add IBT legacy code bitmap allocation function mm/mmap: Add IBT bitmap size to address space limit check x86/cet/ibt: ELF header parsing for IBT x86/cet/ibt: Add arch_prctl functions for IBT x86/cet/ibt: Add ENDBR to op-code-map x86/cet: Add PTRACE interface for CET arch/x86/Kconfig | 12 +++ arch/x86/Makefile | 7 ++ arch/x86/entry/vdso/.gitignore | 4 + arch/x86/entry/vdso/Makefile | 12 ++- arch/x86/entry/vdso/vdso-layout.lds.S | 1 + arch/x86/include/asm/cet.h | 8 ++ arch/x86/include/asm/disabled-features.h | 8 +- arch/x86/include/asm/fpu/regset.h | 7 +- arch/x86/include/uapi/asm/elf_property.h | 1 + arch/x86/include/uapi/asm/prctl.h | 1 + arch/x86/include/uapi/asm/resource.h | 5 ++ arch/x86/kernel/cet.c | 76 +++++++++++++++++++ arch/x86/kernel/cet_prctl.c | 38 +++++++++- arch/x86/kernel/cpu/common.c | 20 ++++- arch/x86/kernel/elf.c | 8 +- arch/x86/kernel/fpu/regset.c | 41 ++++++++++ arch/x86/kernel/process.c | 2 + arch/x86/kernel/ptrace.c | 16 ++++ arch/x86/lib/x86-opcode-map.txt | 13 +++- include/uapi/asm-generic/resource.h | 3 + include/uapi/linux/elf.h | 1 + mm/mmap.c | 12 ++- tools/objtool/arch/x86/lib/x86-opcode-map.txt | 13 +++- 23 files changed, 296 insertions(+), 13 deletions(-)