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: <20240409061043.3269676-13-debug@rivosinc.com>
Date: Mon,  8 Apr 2024 23:10:43 -0700
From: Deepak Gupta <debug@...osinc.com>
To: linux-riscv@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Cc: paul.walmsley@...ive.com,
	palmer@...belt.com,
	aou@...s.berkeley.edu,
	nathan@...nel.org,
	ndesaulniers@...gle.com,
	morbo@...gle.com,
	justinstitt@...gle.com,
	andy.chiu@...ive.com,
	debug@...osinc.com,
	hankuan.chen@...ive.com,
	guoren@...nel.org,
	greentime.hu@...ive.com,
	samitolvanen@...gle.com,
	cleger@...osinc.com,
	apatel@...tanamicro.com,
	ajones@...tanamicro.com,
	conor.dooley@...rochip.com,
	mchitale@...tanamicro.com,
	dbarboza@...tanamicro.com,
	waylingii@...il.com,
	sameo@...osinc.com,
	alexghiti@...osinc.com,
	akpm@...ux-foundation.org,
	shikemeng@...weicloud.com,
	rppt@...nel.org,
	charlie@...osinc.com,
	xiao.w.wang@...el.com,
	willy@...radead.org,
	jszhang@...nel.org,
	leobras@...hat.com,
	songshuaishuai@...ylab.org,
	haxel@....de,
	samuel.holland@...ive.com,
	namcaov@...il.com,
	bjorn@...osinc.com,
	cuiyunhui@...edance.com,
	wangkefeng.wang@...wei.com,
	falcon@...ylab.org,
	viro@...iv.linux.org.uk,
	bhe@...hat.com,
	chenjiahao16@...wei.com,
	hca@...ux.ibm.com,
	arnd@...db.de,
	kent.overstreet@...ux.dev,
	boqun.feng@...il.com,
	oleg@...hat.com,
	paulmck@...nel.org,
	broonie@...nel.org,
	rick.p.edgecombe@...el.com
Subject: [RFC PATCH 12/12] riscv: enable kernel shadow stack and landing pad enforcement

This patch enables kernel shadow stack and landing pad enforcement by
invoking a SBI call. As of now it just issues a SBI_EXT_BASE and a hacked
up opensbi implementation sets the LPE/SSE bits in menvcfg

Eventually, we should have fwft [1] interface using which kernel should be
able to set this enforcement properly

[1] - https://lists.riscv.org/g/tech-prs/message/833

Signed-off-by: Deepak Gupta <debug@...osinc.com>
---
 arch/riscv/kernel/head.S | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index bc248c137c90..1e5bc7b2ee75 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -164,6 +164,13 @@ secondary_start_sbi:
 	call relocate_enable_mmu
 #endif
 	call .Lsetup_trap_vector
+	/*
+	 * Temp hack to get menvcfg.SSE=1 and menvcfg.LPE=1 by invoking
+	 * SBI_EXT_BASE
+	 */
+	li a6, 0
+	li a7, 0x10
+	ecall
 	scs_load_current t0
 	lui t2, 0x1
 	tail smp_callin
@@ -313,6 +320,13 @@ SYM_CODE_START(_start_kernel)
 	la tp, init_task
 	la sp, init_thread_union + THREAD_SIZE
 	addi sp, sp, -PT_SIZE_ON_STACK
+	/*
+	 * Temp hack to get menvcfg.SSE=1 and menvcfg.LPE=1 by invoking
+	 * SBI_EXT_BASE
+	 */
+	li a6, 0
+	li a7, 0x10
+	ecall
 	scs_load_current t0
 
 #ifdef CONFIG_KASAN
-- 
2.43.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ