Message ID | 20240329044459.3990638-25-debug@rivosinc.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49731C6FD1F for <linux-mm@archiver.kernel.org>; Fri, 29 Mar 2024 04:47:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFE746B00BE; Fri, 29 Mar 2024 00:47:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C5CB56B00BF; Fri, 29 Mar 2024 00:47:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3CD86B00C0; Fri, 29 Mar 2024 00:47:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7DCE96B00BE for <linux-mm@kvack.org>; Fri, 29 Mar 2024 00:47:05 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 498CFC0843 for <linux-mm@kvack.org>; Fri, 29 Mar 2024 04:47:05 +0000 (UTC) X-FDA: 81948842010.11.D76950E Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf07.hostedemail.com (Postfix) with ESMTP id 6C13B40005 for <linux-mm@kvack.org>; Fri, 29 Mar 2024 04:47:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=EzxmspcM; dmarc=none; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711687623; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hGZuEOPDrPSpE9XmexYpP1TU1T3x9oK+sun0qc4e7DM=; b=1afgW5vSvZq7PF/CpUujwC5Dg+2fTDUKswoSQQihQjQ4t5Coy9V0OIpRrBsdA9ywkRaP09 qjIXiRsTNfaeJy242qODhOowpJt1tCIa6DnVZWIYm6fF5aPx8pGT2+Qd7tEoo6e/yQjvuy upOC5YoZGjo9QdW8qJINM22/dvkC2Es= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=EzxmspcM; dmarc=none; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711687623; a=rsa-sha256; cv=none; b=F3NSp1kL0lAoZ/ptezLhZ2g8OhHZS9jZfBVzRA8sPBwqK3CPkBK7LWmsLcZd9/lTCT8j1l rRsjrROw7QkkrxLq49a0Y/n0Cz6ML8wx8VGuUHWU8cM0b4wa7JCU1lNRUOMGvz7+y/ncnO iqcgSp0iZ8nYDoboFc77msLmIVN8ZAc= Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6e6ca2ac094so1581612b3a.0 for <linux-mm@kvack.org>; Thu, 28 Mar 2024 21:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1711687622; x=1712292422; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hGZuEOPDrPSpE9XmexYpP1TU1T3x9oK+sun0qc4e7DM=; b=EzxmspcMbetoofz4KYIdn0i+8x7zvrSSqk7Oqyx65+ece1dQYuaxLIXojjsEli+EeQ VOZkgF8+B1jTuAunR/n7qedXIlUPa5ksC0zI5jfBZuznsB+LJ07HhNt0vqtNiHCHN7GF YhfZyqSkpD9OSqDARDyrUvYzFpt1MFWATeNBlNe2lPMkxrc77ab7yMBkex+AS47MzDVU na5OrGFc5rvVFMsEGbxFIK7TqQ1Lzh2dOOfAnUl7te5bnDwJDTeub9PRi497/zi9l1Nj B/wPrea3CbN9QJTWWEpCUWn0cnlsp+eePpBHYbeUS5plDov9jE7SQHD3j/X0+Vg6lQBV VvDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711687622; x=1712292422; h=content-transfer-encoding:mime-version: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=hGZuEOPDrPSpE9XmexYpP1TU1T3x9oK+sun0qc4e7DM=; b=wCio72imibJA6owyk/5pGkQ915QGDTnWROEQE1tXEXlKumxn6ZREdqmgrZOLmmggk6 7ADd6ij446vN8zKQi4eicfnSGDbok/Fcq3iM+Adbx8izkrho/L/lredlJ1IbGOfayIDc VqdR11WcyzQ9thJ1VcXLz//CDE015PF0gUWZ44cE5cizlDOHXWR43WIwnP36tYaLQwDX qv2fvzPUKF5lIT36L0O+5xj/mxmMTu6AeS47EVKv0b3AwAGU0EF7bzF9B8ojb1Yofnxx LIgyrhashB1pJpmN1kTVt62ktvyR/88ALwsSTDpkObhX1NuqswkblhBdBZY7GjRW0LvF xQ0g== X-Forwarded-Encrypted: i=1; AJvYcCWHihBGofuSRTEnZZloXmAbVqUULZJU6eBAvA74vBu8vzba7HDR+1aNVcTtcsctCogWUSxFobFqcgn2n0JzXEh12xg= X-Gm-Message-State: AOJu0YyxNun4szt4JlZ76JD28xQY94nHH0JTaFKfP5kcE7F49fEk54sW Xxwo4bxvICf/F8KviFacd2YphrosuQaBxEVSUs1MHKefKzB/20Qarob2cMkkv3k= X-Google-Smtp-Source: AGHT+IGVNl5i8Vrjt70n++oCEY2675qx+nSiOe/0hD9dLIqDDPWOmm3HrHLeaGTRiVH879DeLLhxrQ== X-Received: by 2002:a05:6a00:a82:b0:6ea:d10d:c96d with SMTP id b2-20020a056a000a8200b006ead10dc96dmr1470360pfl.19.1711687622313; Thu, 28 Mar 2024 21:47:02 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id i18-20020aa78b52000000b006ea7e972947sm2217120pfd.130.2024.03.28.21.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 21:47:02 -0700 (PDT) From: Deepak Gupta <debug@rivosinc.com> To: paul.walmsley@sifive.com, rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com, samuel.holland@sifive.com, palmer@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: corbet@lwn.net, tech-j-ext@lists.risc-v.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, Liam.Howlett@oracle.com, vbabka@suse.cz, lstoakes@gmail.com, shuah@kernel.org, brauner@kernel.org, debug@rivosinc.com, andy.chiu@sifive.com, jerry.shih@sifive.com, hankuan.chen@sifive.com, greentime.hu@sifive.com, evan@rivosinc.com, xiao.w.wang@intel.com, charlie@rivosinc.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, dbarboza@ventanamicro.com, sameo@rivosinc.com, shikemeng@huaweicloud.com, willy@infradead.org, vincent.chen@sifive.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, gerg@kernel.org, heiko@sntech.de, bhe@redhat.com, jeeheng.sia@starfivetech.com, cyy@cyyself.name, maskray@google.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bgray@linux.ibm.com, mpe@ellerman.id.au, baruch@tkos.co.il, alx@kernel.org, david@redhat.com, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, shr@devkernel.io, deller@gmx.de, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com Subject: [PATCH v2 24/27] riscv: create a config for shadow stack and landing pad instr support Date: Thu, 28 Mar 2024 21:44:56 -0700 Message-Id: <20240329044459.3990638-25-debug@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329044459.3990638-1-debug@rivosinc.com> References: <20240329044459.3990638-1-debug@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6C13B40005 X-Stat-Signature: bzjctaix4d8cgi6r8ii8qiexgbkwowe9 X-Rspam-User: X-HE-Tag: 1711687623-923711 X-HE-Meta: U2FsdGVkX1888x2Y9nwmFN0x4L+LLpwd4YNRj53QbR8PhwZiYiyoBkXGrgGd71fIBlrwlsnwaM/yPlFwupiIdBE4OSr0lP+2JSWtgTGR+oy5orAcQ1YUmMg8izYYf5hXl/Xgh/L5UNUlcqt+QJHsL/pMAzEnX4fS+SPW01JOQB+rDmRFl7zxqOivfZqvJK0FK8CwN5Wk/AGYvgv3wFAnNzvRY3oLkM0ATOQpPNHQHf+Oli8ZCU47CvAIXnezCWGhU6UDGmMb0yPDmffxs4wSbBrpn/ts36PRJbWdN2mZQZxGjEJtFvsmhzQ061WzXJ71M6EvSmQTZvQcm7sssc8R2oTE4L8RpnFq5auq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ABhbpYcSYNGbsTVfSiXWRQ0pJteUoYy706N2vlYk31LwvEGWHP5DocOX9ua2pIgMcISv9kPCA5+j+wQZZHvGDS0PcPlqwOeIpGW9R0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001847, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
riscv control-flow integrity for usermode
|
expand
|
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 7e0b2bcc388f..d6f1303ef660 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -203,6 +203,24 @@ config ARCH_HAS_BROKEN_DWARF5 # https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77 depends on LD_IS_LLD && LLD_VERSION < 180000 +config RISCV_USER_CFI + def_bool y + bool "riscv userspace control flow integrity" + depends on 64BIT && $(cc-option,-mabi=lp64 -march=rv64ima_zicfiss) + depends on RISCV_ALTERNATIVE + select ARCH_USES_HIGH_VMA_FLAGS + help + Provides CPU assisted control flow integrity to userspace tasks. + Control flow integrity is provided by implementing shadow stack for + backward edge and indirect branch tracking for forward edge in program. + Shadow stack protection is a hardware feature that detects function + return address corruption. This helps mitigate ROP attacks. + Indirect branch tracking enforces that all indirect branches must land + on a landing pad instruction else CPU will fault. This mitigates against + JOP / COP attacks. Applications must be enabled to use it, and old user- + space does not get protection "for free". + default y + config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT default 8
This patch creates a config for shadow stack support and landing pad instr support. Shadow stack support and landing instr support can be enabled by selecting `CONFIG_RISCV_USER_CFI`. Selecting `CONFIG_RISCV_USER_CFI` wires up path to enumerate CPU support and if cpu support exists, kernel will support cpu assisted user mode cfi. Signed-off-by: Deepak Gupta <debug@rivosinc.com> --- arch/riscv/Kconfig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)