Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47F7C4BF939 for ; Tue, 22 Sep 2026 15:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790090574; cv=none; b=qotWue4RtidhiDvtpT1kMFnScQ9cEvgBRif2lr0ptiJ7uwnlnXFdy/wp/CVNYHhG1m6eIagt58H8nfWxRmK3859QBtEwRaHse8GhP8P6CtDDh/Y4pyNWGLt7mdgboIkuJlutpMAaZqbeBpv50NtRmN7AInX6De2jgTdMA9Na6co= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790090574; c=relaxed/simple; bh=zUk812i3RX1SnYfAogigJkC4oxIEX8B/elESkAPS/2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VjmBseYHjGu2RCVa6FxXfRTRucRyfXZh9iGKvEKh1kXW19YpQU032Iz8zZdGHlLvSR/bLOjCwly5RIk30/6QxqMlQmSHVYyinZSUxgHukaDlGPy0l79w6t35FPtzz4PblhBQS7vMHr5l6qWnVVN7L7XdMcUYufVOeck0UtBwuiw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SbuYZPAX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SbuYZPAX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8D611F00899; Tue, 22 Sep 2026 15:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790090573; bh=E4Hf8FYDhMQfObsIum5mXwnQPAroQlmlTeISr/+NdV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SbuYZPAXMYf96Lxgkag/+zKFVaES25RnxwWczhPeWyTyHuiXQDLK5A2NPSxvJ6PDy YJ5CN6+U2NLJCwaHOJUtK0vpcQrW2qC8jWb8/pWoJq1j7g31S8eOewGE7DMY5VgoaY aThg/Y76WUQytyTpg6NHs66pRyC5mbheDREqWOemoQ+K+YC3PlCU9aAOEdW1B8LMsY smDRYuVythaFLlmk8a/XtSK5oukdG4vdykYkosY1MN6j33WOH2/A6G7rTdBr8t1xv6 FLQzvrrIi9PMBVLkv24kb+eHTs3CQf/9u6iQX+Y1u5nJKQM4/ZGz77h5GECWGyl5u4 2wq1TuXUoR6lw== From: Sasha Levin To: stable@vger.kernel.org Cc: Mark Rutland , Jinjie Ruan , Ada Couprie Diaz , Ard Biesheuvel , Catalin Marinas , James Morse , Marc Zyngier , Peter Zijlstra , Vladimir Murzin , Will Deacon , Yang Shi , Sasha Levin Subject: [PATCH 6.12.y 2/2] arm64: percpu: Fix LSE operations on {8,16}-bit types Date: Tue, 22 Sep 2026 11:22:49 -0400 Message-ID: <20260922152249.2800142-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260922152249.2800142-1-sashal@kernel.org> References: <2026092222-surpass-tapping-3d56@gregkh> <20260922152249.2800142-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Mark Rutland [ Upstream commit 8cf2093f5372952a9ebc805c418d45df7112cd14 ] The assembly for __percpu_##name##_case_##sz() and __percpu_##name##_return_case_##sz() doesn't use the 'sfx' macro argument to form the LSE instruction. Without 'sfx', a W register argument will imply a 32-bit memory location, and consequently {8,16}-bit ops will erroneously read and write 32 bits of memory when the LSE instruction is used. Fix this by appending 'sfx' to 'op_lse' to LSE instruction. It is not necessary (and not valid) to append 'sfx' to 'op_llsc', as 'op_llsc' is a register-register operation which does not access memory (and does not take a size suffix). Fixes: 959bf2fd03b5 ("arm64: percpu: Rewrite per-cpu ops to allow use of LSE atomics") Signed-off-by: Mark Rutland Reviewed-by: Jinjie Ruan Cc: Ada Couprie Diaz Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: James Morse Cc: Marc Zyngier Cc: Peter Zijlstra Cc: Vladimir Murzin Cc: Will Deacon Cc: Yang Shi Cc: stable@vger.kernel.org Reviewed-by: Vladimir Murzin Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/percpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index b57b2bb009677..cb83d6776c6f5 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h @@ -77,7 +77,7 @@ __percpu_##name##_case_##sz(void *ptr, unsigned long val) \ " stxr" #sfx "\t%w[loop], %" #w "[tmp], %[ptr]\n" \ " cbnz %w[loop], 1b", \ /* LSE atomics */ \ - #op_lse "\t%" #w "[val], %" #w "[tmp], %[ptr]\n" \ + #op_lse #sfx "\t%" #w "[val], %" #w "[tmp], %[ptr]\n" \ __nops(3)) \ : [loop] "=&r" (loop), [tmp] "=&r" (tmp), \ [ptr] "+Q"(*(u##sz *)ptr) \ @@ -98,7 +98,7 @@ __percpu_##name##_return_case_##sz(void *ptr, unsigned long val) \ " stxr" #sfx "\t%w[loop], %" #w "[ret], %[ptr]\n" \ " cbnz %w[loop], 1b", \ /* LSE atomics */ \ - #op_lse "\t%" #w "[val], %" #w "[ret], %[ptr]\n" \ + #op_lse #sfx "\t%" #w "[val], %" #w "[ret], %[ptr]\n" \ #op_llsc "\t%" #w "[ret], %" #w "[ret], %" #w "[val]\n" \ __nops(2)) \ : [loop] "=&r" (loop), [ret] "=&r" (ret), \ -- 2.53.0