Authentication-Results: name.execsw.org; dkim=pass (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=ihF7u2hm; dkim=fail reason="signature verification failed" (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=va7hKK65 Received: by mail.netbsd.org (Postfix, from userid 605) id B9CA384E70; Sun, 14 Apr 2024 12:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1713099078; bh=OQXAfSdZtD0JwMtQ31AQuU2uezkoUvZPUO0ItaQp9FY=; h=Date:From:Subject:To:List-Id:Reply-To:List-Unsubscribe; b=ihF7u2hmFUHvkpUEHpwflzw6mnF8CcO+cPMVDRyGceZsCMDOq2BXapj7UuEj0CI22 Z8HKw1JkIGxcCT/vhDH+6dveD8xTMYEasV87fP+9u6l6gxLix6Oc0CZrLY3kbzcDSP xhAhSV5QI/DWJQbTtFO7rJxod07dDbGvZuEGaRGU= Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id A4D3684E6F for ; Sun, 14 Apr 2024 12:51:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Authentication-Results: mail.netbsd.org (amavisd-new); dkim=pass (1024-bit key) header.d=netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id Pxeq8vvp1RP6 for ; Sun, 14 Apr 2024 12:51:17 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 2B0E384D1B for ; Sun, 14 Apr 2024 12:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1713099077; bh=OQXAfSdZtD0JwMtQ31AQuU2uezkoUvZPUO0ItaQp9FY=; h=Date:From:Subject:To:Reply-To; b=va7hKK654rmn5WDovdRuMCDk3uOANJ9J8QHkajkgRWLGN3sKp4Fr1I2dhuyojGhi8 u2yojsF/XE2uVPdfEPJwkef0BQ/w2dxTfjqfdOK898XTvz7+Ptt4vGiEWIym0LFItz bkX93NuoOdZwDqmF6gnL0ZPG0+aYhWE8pQYMza/s= Received: by cvs.NetBSD.org (Postfix, from userid 500) id 1D149FA2C; Sun, 14 Apr 2024 12:51:17 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Sun, 14 Apr 2024 12:51:17 +0000 From: "Nick Hudson" Subject: CVS commit: src/sys/arch/aarch64/aarch64 To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20240414125117.1D149FA2C@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Nick Hudson" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: skrll Date: Sun Apr 14 12:51:17 UTC 2024 Modified Files: src/sys/arch/aarch64/aarch64: cpu_machdep.c sig_machdep.c Log Message: kern/58149: aarch64: Cannot return from a signal handler if SP was misaligned when the signal arrived Apply the kernel diff from the PR 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. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/aarch64/cpu_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/sig_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.