On 31/10/2024 10:33, Will Deacon wrote:
Hi Jeff,
Thanks for chiming in!
On Wed, Oct 30, 2024 at 03:01:53PM -0700, Jeff Xu wrote:
On Tue, Oct 29, 2024 at 7:46 AM Kevin Brodsky kevin.brodsky@arm.com wrote:
TL;DR: reset POR_EL0 to "allow all" before writing the signal frame, preventing spurious uaccess failures.
[...]
@@ -924,12 +982,14 @@ SYSCALL_DEFINE0(rt_sigreturn) if (!access_ok(frame, sizeof (*frame))) goto badframe;
if (restore_sigframe(regs, frame))
if (restore_sigframe(regs, frame, &ua_state)) goto badframe; if (restore_altstack(&frame->uc.uc_stack)) goto badframe;
Do you need to move restore_altstack ahead of restore_sigframe? similar as x86 change [1], the discussion for this happened in [2] [3]
[1] https://lore.kernel.org/lkml/20240802061318.2140081-5-aruna.ramakrishna@orac... [2] https://lore.kernel.org/lkml/20240425210540.3265342-1-jeffxu@chromium.org/ [3] https://lore.kernel.org/lkml/d0162c76c25bc8e1c876aebe8e243ff2e6862359.camel@...
restore_user_access_state(&ua_state);
The POR isn't restored until here ^^^, so I _think_ restore_altstack() is fine where it is. Kevin, can you confirm, please?
Yes, that's correct, see my earlier reply [1].
- Kevin
[1] https://lore.kernel.org/all/cd0e114d-57eb-4c90-bb6f-9abf0cc8920f@arm.com/