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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQndAnoFClKOSer2@e129823.arm.com>
Date: Tue, 4 Nov 2025 11:01:22 +0000
From: Yeoreum Yun <yeoreum.yun@....com>
To: catalin.marinas@....com, will@...nel.org, maz@...nel.org,
	broonie@...nel.org, oliver.upton@...ux.dev, miko.lenczewski@....com,
	kevin.brodsky@....com, ardb@...nel.org, suzuki.poulose@....com,
	lpieralisi@...nel.org, yangyicong@...ilicon.com,
	scott@...amperecomputing.com, joey.gouly@....com,
	yuzenghui@...wei.com, pbonzini@...hat.com, shuah@...nel.org,
	mark.rutland@....com
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	kvmarm@...ts.linux.dev, kvm@...r.kernel.org,
	linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v10 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for
 swpX emulation.

[...]

> +static __always_inline int
> +__lsui_user_swpb_asm(unsigned int *data, unsigned int addr)
> +{
> +	unsigned char idx;
> +	int err;
> +	unsigned int addr_al;
> +	union {
> +		unsigned int var;
> +		unsigned char raw[4];
> +	} data_al;
> +
> +	idx = addr & (sizeof(unsigned int) - 1);
> +	addr_al = ALIGN_DOWN(addr, sizeof(unsigned int));
> +
> +	if (get_user(data_al.var, (unsigned int *)(unsigned long)addr_al))
> +		return -EFAULT;
> +
> +	data_al.raw[idx] = *data;
> +
> +	err = __lsui_user_swp_asm(&data_al.var, addr_al);

I found that using swpt for swpb can cause a race condition
when each CPU accesses its own dedicated byte memory region in 4 bytes.
So, unless there are any comments,
I’ll rework it with a cast in the next version.

> +	if (!err)
> +		*data = data_al.raw[idx];
> +
> +	return err;
> +}
> +#endif /* CONFIG_AS_HAS_LSUI */

Thanks.

--
Sincerely,
Yeoreum Yun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ