lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240912231650.3740732-10-debug@rivosinc.com>
Date: Thu, 12 Sep 2024 16:16:28 -0700
From: Deepak Gupta <debug@...osinc.com>
To: paul.walmsley@...ive.com,
	palmer@...ive.com,
	conor@...nel.org,
	linux-doc@...r.kernel.org,
	linux-riscv@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org,
	linux-arch@...r.kernel.org,
	linux-kselftest@...r.kernel.org
Cc: corbet@....net,
	palmer@...belt.com,
	aou@...s.berkeley.edu,
	robh@...nel.org,
	krzk+dt@...nel.org,
	oleg@...hat.com,
	tglx@...utronix.de,
	mingo@...hat.com,
	bp@...en8.de,
	dave.hansen@...ux.intel.com,
	x86@...nel.org,
	hpa@...or.com,
	peterz@...radead.org,
	akpm@...ux-foundation.org,
	arnd@...db.de,
	ebiederm@...ssion.com,
	kees@...nel.org,
	Liam.Howlett@...cle.com,
	vbabka@...e.cz,
	lorenzo.stoakes@...cle.com,
	shuah@...nel.org,
	brauner@...nel.org,
	samuel.holland@...ive.com,
	debug@...osinc.com,
	andy.chiu@...ive.com,
	jerry.shih@...ive.com,
	greentime.hu@...ive.com,
	charlie@...osinc.com,
	evan@...osinc.com,
	cleger@...osinc.com,
	xiao.w.wang@...el.com,
	ajones@...tanamicro.com,
	anup@...infault.org,
	mchitale@...tanamicro.com,
	atishp@...osinc.com,
	sameo@...osinc.com,
	bjorn@...osinc.com,
	alexghiti@...osinc.com,
	david@...hat.com,
	libang.li@...group.com,
	jszhang@...nel.org,
	leobras@...hat.com,
	guoren@...nel.org,
	samitolvanen@...gle.com,
	songshuaishuai@...ylab.org,
	costa.shul@...hat.com,
	bhe@...hat.com,
	zong.li@...ive.com,
	puranjay@...nel.org,
	namcaov@...il.com,
	antonb@...storrent.com,
	sorear@...tmail.com,
	quic_bjorande@...cinc.com,
	ancientmodern4@...il.com,
	ben.dooks@...ethink.co.uk,
	quic_zhonhan@...cinc.com,
	cuiyunhui@...edance.com,
	yang.lee@...ux.alibaba.com,
	ke.zhao@...ngroup.cn,
	sunilvl@...tanamicro.com,
	tanzhasanwork@...il.com,
	schwab@...e.de,
	dawei.li@...ngroup.cn,
	rppt@...nel.org,
	willy@...radead.org,
	usama.anjum@...labora.com,
	osalvador@...e.de,
	ryan.roberts@....com,
	andrii@...nel.org,
	alx@...nel.org,
	catalin.marinas@....com,
	broonie@...nel.org,
	revest@...omium.org,
	bgray@...ux.ibm.com,
	deller@....de,
	zev@...ilderbeest.net
Subject: [PATCH v4 09/30] riscv: zicfiss / zicfilp extension csr and bit definitions

zicfiss and zicfilp extension gets enabled via b3 and b2 in *envcfg CSR.
menvcfg controls enabling for S/HS mode. henvcfg control enabling for VS
while senvcfg controls enabling for U/VU mode.

zicfilp extension extends *status CSR to hold `expected landing pad` bit.
A trap or interrupt can occur between an indirect jmp/call and target
instr. `expected landing pad` bit from CPU is recorded into xstatus CSR so
that when supervisor performs xret, `expected landing pad` state of CPU can
be restored.

zicfiss adds one new CSR
- CSR_SSP: CSR_SSP contains current shadow stack pointer.

Signed-off-by: Deepak Gupta <debug@...osinc.com>
Reviewed-by: Charlie Jenkins <charlie@...osinc.com>
---
 arch/riscv/include/asm/csr.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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
-- 
2.45.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ