NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58149: aarch64: Cannot return from a signal handler if SP was misaligned when the signal arrived
>Number: 58149
>Category: kern
>Synopsis: aarch64: Cannot return from a signal handler if SP was misaligned when the signal arrived
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 14 03:40:00 +0000 2024
>Originator: PHO
>Release: 10.0
>Organization:
>Environment:
NetBSD yukari.cielonegro.org 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
Copied from the commit message of my patch to fix it:
aarch64: Don't trip up on misaligned SP when a signal is sent to a process
1. sendsig_siginfo() previously assumed that user SP was always aligned to
16 bytes and could call signal handlers with SP misaligned. This is a
wrong assumption because aarch64 demands that SP is aligned *only while*
it's being used to access memory. Now it properly aligns it before
pusing anything on the stack.
2. cpu_mcontext_validate() used to check if _REG_SP was aligned and
considered the ucontext invalid otherwise. This meant if a signal was
sent to a process whose SP was misaligned, the signal handler would fail
to return because the ucontext passed from the kernel was an invalid
one. Now setcontext(2) doesn't complain about misaligned SP.
>How-To-Repeat:
>Fix:
Apply this patch:
https://github.com/NetBSD/src/commit/f672806f26384c093c73b4ee0fb94f1fa309ca4a
Home |
Main Index |
Thread Index |
Old Index