Message ID | 20241001-v5_user_cfi_series-v1-9-3ba65b6e550f@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 E8AE2CEACE4 for <linux-mm@archiver.kernel.org>; Tue, 1 Oct 2024 16:07:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D0E42800A4; Tue, 1 Oct 2024 12:07:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 135CA280068; Tue, 1 Oct 2024 12:07:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78742800A4; Tue, 1 Oct 2024 12:07:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CAED9280068 for <linux-mm@kvack.org>; Tue, 1 Oct 2024 12:07:26 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8D14181695 for <linux-mm@kvack.org>; Tue, 1 Oct 2024 16:07:26 +0000 (UTC) X-FDA: 82625513292.19.5142896 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf21.hostedemail.com (Postfix) with ESMTP id 925161C0017 for <linux-mm@kvack.org>; Tue, 1 Oct 2024 16:07:24 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=T6sICvCj; spf=pass (imf21.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727798780; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YzRPf3gSm1oBJZUnyk2tQznTd/0pm5tuC+PNjTYOgOw=; b=sdJEY/ZRvOSX0t7gSDnBhIOnh09dOs6WEdVfokPTtwqcz45Er6HkCNON3D8Vz8PvsAKR7d +8akihNs/IMAAPEpmycFPliE30iUuwsEfgx+sOMy+t7ioHyp3ZPGFsHlDMQq08KHB9PMYh Kn9fbFQs8N84y591VlppApR8qURF2ck= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=T6sICvCj; spf=pass (imf21.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727798780; a=rsa-sha256; cv=none; b=3NBpMQTO07m1hTvj53vvUD8vr5g+2bgQq3V8/tnFb1k7CpbwtfxTMHknBFB+HIkxZg/Fx3 uGbeg+uJuq40TOA2j2nHpbp5p0E1XkiMpEc0eLXPKA48kpQxJgmz7NX9gskecGjABSjFoO gK5CMe9OcXtYt0mCx4qQcekkaAuwu4c= Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7db54269325so4370140a12.2 for <linux-mm@kvack.org>; Tue, 01 Oct 2024 09:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1727798843; x=1728403643; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YzRPf3gSm1oBJZUnyk2tQznTd/0pm5tuC+PNjTYOgOw=; b=T6sICvCj1ByoQN2ncU8rLXbBz2vUOIvRk4Z8B7MEfDUtUNpKxVWhVCZx7BcVPt3V5t BXtA2fYsV9sAQDg95Fn3jhelwLM4iFZxTZ4vKbmQ1owIvgraJ3/jeIqOkzOJsTIXqoHM E1KmLLvyUlgKVoM74hNGtKAKfuYd9FZP+ZNoe7TNikIrorrybtGvNkhrSnmM95F2bjZN jb6USUVRQH3dnwWjR46eCOPmDyqWUvSTWHLuOY6Ihf/HddPyBOKrSzWIKBQRM81FAs9c 4LZ/0x08iMduynFGh8EX9heUdKUPCfpXsDL8hOqPpE8pcxqcS7iMWYf+UfQ4sueudEyl o6Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727798843; x=1728403643; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YzRPf3gSm1oBJZUnyk2tQznTd/0pm5tuC+PNjTYOgOw=; b=UxPPLO3sltCOWvE5baboFjUn6uMeYE8PVrOxQTZ586OHPeuqqhSif/Vdb7MQaF+Lrm iSJHs+xt5/Fv5S47Y45U/AQQNNL2IqSF1KeOR295g9NOPj9W17mHWk4M79SHyanOPdFA ZbzaGKIpIkudsoPShOM2pjjZkHOUlbA1An9ZyT/viLxVRGUZLkgAMpj1AUPlWFxodVEF d/wbbSw1KQR4ycLjNzhhrSEEOulJBY3Fhdg4jDQvWlLddrEGqVRj7D/w6hGO9mvDKMOP bP0BZz75s65mFhCZEgj0aDYyU8andOCpMmQMbLqci1w1YzJBhFnD6N11YT7S6FpQcUik 2xMw== X-Forwarded-Encrypted: i=1; AJvYcCW7Vq1woQcV8PuPgQvKlrtJTqlGXrvRh39BzM4EWDJCjFlbXutw5QldXnrAmAb/8F6nFYWTYEna5A==@kvack.org X-Gm-Message-State: AOJu0Yz3RLyic6NAM4lxXzZaJ8KPpfcT5nAq65XnNJLvkNJKNzqHsjXm YhaoC7LfkUJyZ3kk39Oek+ArjpdRp2eJCkFlVDrZ/45fVewHtFmFZYuGApSAUKg= X-Google-Smtp-Source: AGHT+IFUtHGSqw39cY/b30rSSzM+TWp/wCUKZ0BHqFADXvXCzXnqk0YyVIrTqxVHl/zzcyJlxVk2Ag== X-Received: by 2002:a17:90a:7103:b0:2dd:6a40:dd86 with SMTP id 98e67ed59e1d1-2e18468601cmr227883a91.16.1727798843238; Tue, 01 Oct 2024 09:07:23 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e06e1d7d47sm13843973a91.28.2024.10.01.09.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 09:07:22 -0700 (PDT) From: Deepak Gupta <debug@rivosinc.com> Date: Tue, 01 Oct 2024 09:06:14 -0700 Subject: [PATCH 09/33] riscv: zicfiss / zicfilp extension csr and bit definitions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20241001-v5_user_cfi_series-v1-9-3ba65b6e550f@rivosinc.com> References: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@rivosinc.com> In-Reply-To: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@rivosinc.com> To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Andrew Morton <akpm@linux-foundation.org>, "Liam R. Howlett" <Liam.Howlett@oracle.com>, Vlastimil Babka <vbabka@suse.cz>, Lorenzo Stoakes <lorenzo.stoakes@oracle.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Conor Dooley <conor@kernel.org>, Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Christian Brauner <brauner@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Oleg Nesterov <oleg@redhat.com>, Eric Biederman <ebiederm@xmission.com>, Kees Cook <kees@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, alistair.francis@wdc.com, richard.henderson@linaro.org, jim.shu@sifive.com, andybnac@gmail.com, kito.cheng@sifive.com, charlie@rivosinc.com, atishp@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, alexghiti@rivosinc.com, samitolvanen@google.com, broonie@kernel.org, rick.p.edgecombe@intel.com, Deepak Gupta <debug@rivosinc.com> X-Mailer: b4 0.14.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 925161C0017 X-Stat-Signature: bfh3jrm9rr69g9n6zoi78y8axwbecr85 X-HE-Tag: 1727798844-809006 X-HE-Meta: U2FsdGVkX1/vgWgV1SkV5DGoJW459ZS/G5mGKCzQmq/gBsoVzSWSXFXB65wDrPT3hy+KGx71MOrEcJmtbXjQnROZlaM3SKslzJUvoP67lrDKxgpqkDWsST+EpDV13lWtuRCXHHFMX1+PKIWPA8QJUs7lc2bKrkxQcrXaGkInvjmW7WX/PN4+LF6/XfBW6UOEgWCkzC6b9FJvlSuBPcBPt2MSlaq1gLAfvH8aXKI/BGxnev/YJEb5EEbChRgNK3eNqMILx8mnu39H+ASIwwTKlRNODHIP9uWJWVH5TKXCB/j6Lb2plzvM2Ob9Ir/KtUYSlH9/bjs8sQXlQgtqZ93OJgTgETw7VQmMGIxkQ/vOHz5kikiVCaxQzalm2nMrNujC2F1OkVv4yTBF6Sx/0jrBmPA+kkUMmpRcKaSjvZHzo+pLFUZWU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ux-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/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 25966995da04..af7ed9bedaee 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -18,6 +18,15 @@ #define SR_MPP _AC(0x00001800, UL) /* Previously Machine */ #define SR_SUM _AC(0x00040000, UL) /* Supervisor User Memory Access */ +/* zicfilp landing pad status bit */ +#define SR_SPELP _AC(0x00800000, UL) +#define SR_MPELP _AC(0x020000000000, UL) +#ifdef CONFIG_RISCV_M_MODE +#define SR_ELP SR_MPELP +#else +#define SR_ELP SR_SPELP +#endif + #define SR_FS _AC(0x00006000, UL) /* Floating-point Status */ #define SR_FS_OFF _AC(0x00000000, UL) #define SR_FS_INITIAL _AC(0x00002000, UL) @@ -197,6 +206,8 @@ #define ENVCFG_PBMTE (_AC(1, ULL) << 62) #define ENVCFG_CBZE (_AC(1, UL) << 7) #define ENVCFG_CBCFE (_AC(1, UL) << 6) +#define ENVCFG_LPE (_AC(1, UL) << 2) +#define ENVCFG_SSE (_AC(1, UL) << 3) #define ENVCFG_CBIE_SHIFT 4 #define ENVCFG_CBIE (_AC(0x3, UL) << ENVCFG_CBIE_SHIFT) #define ENVCFG_CBIE_ILL _AC(0x0, UL) @@ -215,6 +226,11 @@ #define SMSTATEEN0_HSENVCFG (_ULL(1) << SMSTATEEN0_HSENVCFG_SHIFT) #define SMSTATEEN0_SSTATEEN0_SHIFT 63 #define SMSTATEEN0_SSTATEEN0 (_ULL(1) << SMSTATEEN0_SSTATEEN0_SHIFT) +/* + * zicfiss user mode csr + * CSR_SSP holds current shadow stack pointer. + */ +#define CSR_SSP 0x011 /* symbolic CSR names: */ #define CSR_CYCLE 0xc00