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: <20230816142219.GA13526@willie-the-truck>
Date:   Wed, 16 Aug 2023 15:22:19 +0100
From:   Will Deacon <will@...nel.org>
To:     Mark Brown <broonie@...nel.org>
Cc:     Catalin Marinas <catalin.marinas@....com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        David Spickett <David.Spickett@....com>
Subject: Re: [PATCH] arm64/ptrace: Ensure that the task sees ZT writes on
 first use

On Mon, Aug 14, 2023 at 10:27:51PM +0100, Mark Brown wrote:
> When the value of ZT is set via ptrace we don't disable traps for SME.
> This means that when a the task has never used SME before then the value
> set via ptrace will never be seen by the target task since it will
> trigger a SME access trap which will flush the register state.
> 
> Disable SME traps when setting ZT, this means we also need to allocate
> storage for SVE if it is not already allocated, for the benefit of
> streaming SVE.
> 
> Fixes: f90b529bcbe5 ("arm64/sme: Implement ZT0 ptrace support")
> Signed-off-by: Mark Brown <broonie@...nel.org>
> ---
>  arch/arm64/kernel/ptrace.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
> index 5b9b4305248b..254eb37e1f07 100644
> --- a/arch/arm64/kernel/ptrace.c
> +++ b/arch/arm64/kernel/ptrace.c
> @@ -1170,6 +1170,11 @@ static int zt_set(struct task_struct *target,
>  	if (!system_supports_sme2())
>  		return -EINVAL;
>  
> +	/* Ensure SVE storage in case this is first use of SME */
> +	sve_alloc(target, false);
> +	if (!target->thread.sve_state)
> +		return -ENOMEM;
> +
>  	if (!thread_za_enabled(&target->thread)) {
>  		sme_alloc(target);
>  		if (!target->thread.sme_state)
> @@ -1182,6 +1187,8 @@ static int zt_set(struct task_struct *target,
>  	if (ret == 0)
>  		target->thread.svcr |= SVCR_ZA_MASK;
>  
> +	set_tsk_thread_flag(target, TIF_SME);

Hmm, this is now weirdly inconsistent with za_set(), which doesn't touch
the thread flag unless the regset copy succeeds. Is that intentional?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ