Message ID | 20241029-v5_user_cfi_series-v7-8-2727ce9936cb@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 642DCD7494D for <linux-mm@archiver.kernel.org>; Tue, 29 Oct 2024 23:44:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21E4C6B00A0; Tue, 29 Oct 2024 19:44:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C9246B00A1; Tue, 29 Oct 2024 19:44:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06C256B00A2; Tue, 29 Oct 2024 19:44:40 -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 DAB466B00A0 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 19:44:39 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A48EA1C5DCA for <linux-mm@kvack.org>; Tue, 29 Oct 2024 23:44:39 +0000 (UTC) X-FDA: 82728270786.19.93E85A7 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf02.hostedemail.com (Postfix) with ESMTP id 21B4B80009 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 23:43:49 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=SfLSppfw; dmarc=none; spf=pass (imf02.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730245434; a=rsa-sha256; cv=none; b=ynZ8EDt2CmtNiAZVzPsHTEggUt8Oa3LT0TmOUhgvenKNljKsHFja3Vlq/8d2jZWwTR4TZE kdIxdZT+7YvAzjA9ZqlEoBiHRagtxaPopVfLTJsuFWyHKWmELDQOxtcPCCaRgvBW3WgGH9 Sr5542O+6xqkXeyeoD1sLMnJSFjG8IE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=SfLSppfw; dmarc=none; spf=pass (imf02.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 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=1730245434; 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=Vc3xum6aGJsQxt7BwGXU6tv/D45yqqkNrU/wViua7no=; b=pJ2mqJWoBakUTKaEwDJEdWDZqoQyNI9MLsQxTg0fCfzM2mpy0BSskeLZa8wEAJWY8bvMVi yXwp2N0NOzMugxW9dWGid3FNI40vk9NzEWqkJoQ1vrK0hR/i57ylf3fT8+qLzlW9+Aupss i5vQ4ROPksz221ThQ1OQyvBv/00ns9c= Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ea76a12c32so4653380a12.1 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 16:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1730245476; x=1730850276; 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=Vc3xum6aGJsQxt7BwGXU6tv/D45yqqkNrU/wViua7no=; b=SfLSppfwzh1DtIROgefZPUlubw/ju5frl8eHF2KGL9nNP33MPTDd5vqF3aEtxzQGf0 +4PemUxKi/trOGewpyqNdpNzznGjraDEUi6CNQZKjv1isayOXqbDbEozuKq0flD41vki bw5CyXuZDwtU6Z5tBZbtxoE3srtNCu4Oeyq1sitnbBWCyVY1WeaAJk94Lb29SGNp5Eni xiBSDNbQraRHfOlPGnLw80e8V02yaO+h1U/N7OwmLF4bt0YpYRuo6Y6StyAxyeEl4blU myzoqIWgurl5ri81hpMQaGICogqofO3uVix+SlgMw5HbN17wvpQ4PQtDLZ69lH339jFG nnWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730245476; x=1730850276; 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=Vc3xum6aGJsQxt7BwGXU6tv/D45yqqkNrU/wViua7no=; b=sLxZ2nW6BkrhbWjLJOCxIlOC8pFt6uUa3KLoRIdL3NFnhfOVGojeXbjdJKt/y3iRNt twCE+ANm4dWHJcXUfD5RnDEiPrsU8qTCybTf2wu0Cl5BcT/S3c2W8xP8zUEku7pbU4+U Fwkkg3xH8bQiTsHu4NB57Al8MvzB3Bm+oMds4ZpHK/qkeDbPIcEgqrAl4sz2PFr8PKfY HjSiksW0W6voxapxhuaM1FvSZyP4zGL93qptT/K7kgbGDTWi1SfjDoO2xjwjTv7EazpF gp7NWqEk6TyArYr8WFj+0krSXhWa2J7XjLzBxh4UsFWgRqYUYInyWs/N7I1oZth7uuRd +7dw== X-Forwarded-Encrypted: i=1; AJvYcCUSt5HSihvsmgD1yLOmGE7jEx7wDmauoE3QHfy4pSXL4bxR0t2GvmfOv59UNyR3HDDyqU3wPWyWTA==@kvack.org X-Gm-Message-State: AOJu0YyNPQiYsovU47oRQs9UrAvr3Z9onZsWqiNJSd8pUb5Z/RuBGtGJ tdUWflLZf02YLr+TanoP64OP8pZFwPb2klCR295yMBd4WkHRQnhXDvnMf6wuH5M= X-Google-Smtp-Source: AGHT+IGvhAl0GoTCR6wpiYv9Nay6FcDGtnYTBZHKhrK9M6c3oN51TKIQjb4l2hAH4eTwfkMYzc6GGA== X-Received: by 2002:a05:6a21:1190:b0:1d9:215c:c63a with SMTP id adf61e73a8af0-1d9a850aaf7mr18291142637.47.1730245476543; Tue, 29 Oct 2024 16:44:36 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72057921863sm8157643b3a.33.2024.10.29.16.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 16:44:36 -0700 (PDT) From: Deepak Gupta <debug@rivosinc.com> Date: Tue, 29 Oct 2024 16:44:08 -0700 Subject: [PATCH v7 08/32] 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: <20241029-v5_user_cfi_series-v7-8-2727ce9936cb@rivosinc.com> References: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@rivosinc.com> In-Reply-To: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@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-Rspam-User: X-Stat-Signature: shpy6dagcogrzx55st7ppq3fq3i8mien X-Rspamd-Queue-Id: 21B4B80009 X-Rspamd-Server: rspam02 X-HE-Tag: 1730245429-939011 X-HE-Meta: U2FsdGVkX1/hgAY+FfrEw44upTag0UGR5NFKr4hL8o2kLeQxp71tQrGDRQ2Tk/78miixSYP/NzZ3XzG70i4GqoFcSs2EChbBbEF26tKvOFWFipX3fx7Jzpu7N1C3ARl5pt11g1KpifVaRdBFlbQxiO/HZ/rQ/JrxgeaPJ7gWuKxxpXgsqbeBoiSqPx9BytFX5NHDphAUEMMyCyGhA+pJn9jtSF/1nMhy6Qg8Tr1gwThpE33ggNEaXMoiy0F19GtOhe5Wpl5ii6Xc19tiTT2uYr7ISrdWu5T7fvQ67vluTX6GZ3U9I7YN0wLLWecSXp5MUpzK2Mxj1tXgxS2iVIVhfGVsp3rIhzlD4xrvihmG22uL9122NRHnP6yJ90Fczc19dfvxZROXy7k5YRTGctSStPdw+6Vz3LsEdZieHDN70v9/MAxyLjYjbOifOG+ZYEy2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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