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: <ZsXjiTlfLE61-jJC@arm.com>
Date: Wed, 21 Aug 2024 13:54:33 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Mark Brown <broonie@...nel.org>
Cc: Will Deacon <will@...nel.org>, Jonathan Corbet <corbet@....net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>,
	James Morse <james.morse@....com>,
	Suzuki K Poulose <suzuki.poulose@....com>,
	Arnd Bergmann <arnd@...db.de>, Oleg Nesterov <oleg@...hat.com>,
	Eric Biederman <ebiederm@...ssion.com>,
	Shuah Khan <shuah@...nel.org>,
	"Rick P. Edgecombe" <rick.p.edgecombe@...el.com>,
	Deepak Gupta <debug@...osinc.com>, Ard Biesheuvel <ardb@...nel.org>,
	Szabolcs Nagy <Szabolcs.Nagy@....com>, Kees Cook <kees@...nel.org>,
	"H.J. Lu" <hjl.tools@...il.com>,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Palmer Dabbelt <palmer@...belt.com>,
	Albert Ou <aou@...s.berkeley.edu>,
	Florian Weimer <fweimer@...hat.com>,
	Christian Brauner <brauner@...nel.org>,
	Thiago Jung Bauermann <thiago.bauermann@...aro.org>,
	Ross Burton <ross.burton@....com>,
	linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
	kvmarm@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
	linux-arch@...r.kernel.org, linux-mm@...ck.org,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v10 21/40] arm64/gcs: Implement shadow stack prctl()
 interface

On Thu, Aug 01, 2024 at 01:06:48PM +0100, Mark Brown wrote:
> Implement the architecture neutral prtctl() interface for setting the

s/prtctl/prctl/

> +int arch_set_shadow_stack_status(struct task_struct *task, unsigned long arg)
> +{
> +	unsigned long gcs, size;
> +	int ret;
> +
> +	if (!system_supports_gcs())
> +		return -EINVAL;
> +
> +	if (is_compat_thread(task_thread_info(task)))
> +		return -EINVAL;
> +
> +	/* Reject unknown flags */
> +	if (arg & ~PR_SHADOW_STACK_SUPPORTED_STATUS_MASK)
> +		return -EINVAL;
> +
> +	ret = gcs_check_locked(task, arg);
> +	if (ret != 0)
> +		return ret;
> +
> +	/* If we are enabling GCS then make sure we have a stack */
> +	if (arg & PR_SHADOW_STACK_ENABLE) {
> +		if (!task_gcs_el0_enabled(task)) {
> +			/* Do not allow GCS to be reenabled */
> +			if (task->thread.gcs_base)
> +				return -EINVAL;
> +
> +			if (task != current)
> +				return -EBUSY;
> +
> +			size = gcs_size(0);
> +			gcs = alloc_gcs(0, size);
> +			if (!gcs)
> +				return -ENOMEM;
> +
> +			task->thread.gcspr_el0 = gcs + size - sizeof(u64);
> +			task->thread.gcs_base = gcs;
> +			task->thread.gcs_size = size;
> +			if (task == current)
> +				write_sysreg_s(task->thread.gcspr_el0,
> +					       SYS_GCSPR_EL0);
> +
> +		}
> +	}

Nitpick: use a single 'if' instead of nesting (unless subsequent patches
add more to the first block).

Otherwise it looks fine.

Reviewed-by: Catalin Marinas <catalin.marinas@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ