From mboxrd@z Thu Jan 1 00:00:00 1970 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 BD121376A15 for ; Wed, 12 Aug 2026 07:29:12 +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=1786519754; cv=none; b=qWW/mOkgyL5wZmwwpzalqbnROlkdhNfEAF2EF7RqEdzQ4bzl87B7T1u80mOn04fHR2jy7pEMLKZ5HA4QRpgg5qz+xrmreEsja94JTfEOyEWNtgpsZd/Off1qlYVdve1iOgoys3XoaJn1TYUYCXjyfi7Tn6t/kI8moM2o/ioJqf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786519754; c=relaxed/simple; bh=4wYPvCbTq/8BkD2bsvkf5s7HshKHTy5IG6ljzWwvcaI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GeaHB2d12ry+4vtwdCxxJC1Ctu9rvH6XNiozyL5OrzX3AwxrfM1LBhpLEdR9UZUtVCozfRSivtqe4Bz7yK79Qo7J70BzL0eezwytt1GqpjFL9IO7aKCoKAOzCwK+NOeAy3kwJx6eNtuRzoncMkSVGHNBlJxuZUD0qq4KkeJGoJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MPSkYXKS; 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="MPSkYXKS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74C501F00AC4 for ; Wed, 12 Aug 2026 07:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786519752; bh=4wYPvCbTq/8BkD2bsvkf5s7HshKHTy5IG6ljzWwvcaI=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=MPSkYXKSjFROOmHtlJBFofz4meQ5xG35mJ+r5QQPY/2VMVNmHNQ60I7VBIR8FJItN qlcUNGDidxt91y5xNJgqqfRXCn1I3vjhuCZy2I8seQI9YwSJa43rFOrjLzQsUpMpne TW2Rc/InlAsg92iRrunY67TSb5ecpjVeDUEAsuWQgu+2h2HnK92rqb+zj1N/990z5D VgNqRVm413H5q5TgjuYCUGjCYH3sIXCbmxZqvkyYSJyaqux5i0RO9+1f7dolT/4TPI +xDlmOGaLy+4AhJdVaP+kLGeF3HXXtqrxJ5d+r2E7zV/t2/ZXfqxSqJz98yrpgGi1n USFtfv7pDuiaw== Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5b0148201fbso475575e87.3 for ; Wed, 12 Aug 2026 00:29:12 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RpJfr2c7vbNgWWng77q2egRqfg2mmLHylXHixOWUWFOALyr5SwjpFQ+oPtbnVecGE6HGj29cPmR8e8OsMQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxnY8a69NZZRFvReTQcPDIGG/eVhs/1jko9rZkEMnt10M4TTEO4 9oUExyar2OrK1yDK3nXZObDkIhN2ei5swuxjfubxmsKPJ4t2p4qTuuTJqZe96Zh/w2cod2TBrtI 9nlgOLvVUxq4pTHYqMksBQZVNan+00sk= X-Received: by 2002:a2e:bc0a:0:b0:39c:6d58:a6e3 with SMTP id 38308e7fff4ca-3a10d57f6c7mr2289731fa.21.1786519751181; Wed, 12 Aug 2026 00:29:11 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260811164528.65747-1-kmehltretter@gmail.com> In-Reply-To: <20260811164528.65747-1-kmehltretter@gmail.com> From: Linus Walleij Date: Wed, 12 Aug 2026 09:28:59 +0200 X-Gmail-Original-Message-ID: X-Gm-Features: AUfX_mySWsnAe9XtBvawNadOQALKRD0MZYPbPofiyEVi3GwFSKQx95g1Gz4umsY Message-ID: Subject: Re: [PATCH RESEND] ARM: alignment: restore uaccess state on emulation fault To: Karl Mehltretter Cc: Russell King , Ard Biesheuvel , Florian Fainelli , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 11, 2026 at 6:45=E2=80=AFPM Karl Mehltretter wrote: > The alignment handlers enable access to user memory while emulating > unaligned instructions. If a checked access faults, its exception table > fixup jumps to the handler's fault label and bypasses uaccess_restore(). > This leaves DOMAIN_USER as DOMAIN_CLIENT with SW domain PAN, or leaves > TTBR0 page table walks enabled with TTBR0 PAN, while the fault is handled= . > > An ARM926 QEMU test using LDMIA across an unmapped page boundary reports > DOMAIN_USER=3D1 at TYPE_FAULT before this change and DOMAIN_USER=3D0 afte= r it. > SW domain PAN is the default on ARMv5, ARMv6, and non-LPAE ARMv7 builds. > > Keep the saved uaccess state at function scope and track whether it was > saved. Restore it at the fault label only when needed. Paths that did not > enable user access continue to skip the restore. > > Fixes: 274e91b81ed2 ("ARM: alignment: fix alignment handling for uaccess = changes") > Cc: stable@vger.kernel.org > Assisted-by: Codex:gpt-5.6-sol > Signed-off-by: Karl Mehltretter Wow nice patch! Reviewed-by: Linus Walleij Please put this patch into Russell's patch tracker so he can apply it! https://www.arm.linux.org.uk/developer/patches/ Yours, Linus Walleij