From: Sayali Patil <sayalip@linux.ibm.com>
To: "Mukesh Kumar Chaurasiya (IBM)" <mkchauras@gmail.com>,
maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, sshegde@linux.ibm.com, ruanjinjie@huawei.com,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit
Date: Tue, 16 Jun 2026 12:14:04 +0530 [thread overview]
Message-ID: <c50b1713-a115-4150-9e1d-e144663a6746@linux.ibm.com> (raw)
In-Reply-To: <20260615162617.2861795-1-mkchauras@gmail.com>
On 15/06/26 21:56, Mukesh Kumar Chaurasiya (IBM) wrote:
> During a syscall restart, block KUAP so that pending interrupts can be
> replayed. The original KUAP state is not restored before returning to
> userspace, causing subsequent userspace accesses to fault and eventually
> trigger bad_access_pkey(), crashing the kernel.
>
> The original KUAP register values are already saved in
> arch_enter_from_user_mode(). Restore them on the syscall restart exit
> path before returning to userspace.
>
> Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
> Reported-by: Sayali Patil <sayalip@linux.ibm.com>
> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
> ---
> V1 -> V2:
> - Commit message rephrased
> V1: https://lore.kernel.org/all/20260613123831.1510474-1-mkchauras@gmail.com
>
> arch/powerpc/kernel/interrupt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 89a999be1352..f04978080837 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -166,6 +166,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
> goto again;
> }
>
> + kuap_user_restore(regs);
> regs->exit_result |= regs->exit_flags;
>
> return regs->exit_result;
This fixes the reported issue.
Tested-by: Sayali Patil <sayalip@linux.ibm.com>
prev parent reply other threads:[~2026-06-16 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 16:26 [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit Mukesh Kumar Chaurasiya (IBM)
2026-06-16 6:44 ` Sayali Patil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c50b1713-a115-4150-9e1d-e144663a6746@linux.ibm.com \
--to=sayalip@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mkchauras@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ruanjinjie@huawei.com \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox