From nobody Mon Jun 8 06:35:56 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5E3A3C457D for ; Fri, 5 Jun 2026 08:20:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780647659; cv=none; b=gBPKndedxfvOQ9Pc7Nup8bnG/JWHcjWtZT4/XZqpOtyvgJ17/KmQqsqnwX2LgPr3mL9miI/B0coj0hXPnas6GwhOQUDUMm6JopqcsXCzs+V97trcPCR9wgxvXnUJagaPVHM8walmZQCHhF+5XcEhmTtsW2WMAAKhrWLfmBgK8og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780647659; c=relaxed/simple; bh=Z5cgkaEzfcaJ68emA6algu/ym4tDQ1VJHrY2+eQkMVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jRSJmYn4HvxI1aAxSW7pQle0TUXiYTjyhpe8N3eVNe8Yy1M7ZqaQehO0HogAfqFUv+vYJM4bK95MWQWUdy2zN1dSWjZ6sJsYgPWPD3HGSFKX8wJGL9eJ3EoGesYeJb5UVMyy8TMT0ppjdvp3I0jVhdyzY+iuOzIfGMAqdpdEw9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q/HGpjnE; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q/HGpjnE" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490a76757e5so11072285e9.2 for ; Fri, 05 Jun 2026 01:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780647656; x=1781252456; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wm/65akf54/W/3WDtQxdFGp4GPSv3fmHff3gkNB4vO0=; b=Q/HGpjnEL00md7087CWNMRhsDaqr8tXSsFmSlpPes662TGfzaFw2qCHznDOMUICGR0 VW/YXI7AlvR+OKMRIA7LEF8nM+l84b8rFcn0Gclaxs4bbugW28756e4Uq26cfcYM45S9 wx/aci7WyJqbyhsa0qGcPe6olysDzLAfJMntlzeUNtTM3zkp5j8fQF3QNiAATGShBWZ+ 9zayV6Ro12OcHj4+VzroSxd01gPqc0F5Inda72yQ7oPP+yYUqfNBcQ6DwdfYpwT4AXY1 zLooJ+vgOOOhJzEGJdgTXk+P9GUzr1WQVI0u+ZLN0LZuE5F3YHmhvo88rUZ6FbIgsLlG fekA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780647656; x=1781252456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Wm/65akf54/W/3WDtQxdFGp4GPSv3fmHff3gkNB4vO0=; b=WwimHOHWM7qe0ZZ8Ns/02AFxEB9+fMpfI5ogro0irALw99nOY/UtDUWtsogOhUrILA Ou2GHoJiHrqcudYFXUlc1ZFgLrUV+YBw9yYiLpi8pmKWHHYZGz52twVhmP2hdzpufos7 7TNyvlOqF0oDsoWs1pZz8xFvQiCTdfeCkxU1IDlCMPgfSgPxC66SaGWyMpTFSXsVPILW a2w5ux0RIweQUQy/3rWaM/SAXExRIlqeXQUhr+ui3G18loimIHUA96Npy/3TB39NYgDL 1i0mx5g4P2EMR+NNg1Yx306smPoDZZ0V2bX6j8IfwAibpI+fuoBERyoIlogBCDLCyxUm vMXQ== X-Gm-Message-State: AOJu0YzTE7gqDZjXqQ2jH8YwF5EwyYpGRT5lzs94MvhTq64WLr+SIzAD FRQ/fuPLwLQx2bXpKugQpgz9kLuS+g7TWe3uqMMRngtOZkQx0ZMt9LEZ X-Gm-Gg: Acq92OF6CkC1kUB8a5cLuakgWU3HaPdN1cAPYqd5HxqfQWBFQjIiaXSesd+MxKe2orU mQ60G030OmZGkIAzZpCXxiiH1Aue5t/o+cq5x86jqdYXceRqhpdlFMynXOxKfQQoo00BpLOLY/I o3M4GR2v0n3ULdYZcgVHQYhskHzGxpl2uwzAVcnGSqA2mfTSQzTKc7eVXT6FFAFKmr68BUshCiP EH7HE6g/bGrIVV8NN6x5x02TBMTUUvvPCvOtjWtQ18aF4Kf+vEPoWTITRmxyQtu8yaXACaLiDxU CEM7AxsrJf/a8zkSUJx+mQnIGROUbXO0cGUIo0exN0WldwW55DTYWpHtorcU6iFwoUtHpcroVok CKxtjctlz2nyuA3lhiSbFEcvQmam5Mh149Sau0LNL87a8q5AukZiyH2ujhUO6alJSDXyjt0SkVW Sy7NaKv/wbNFx0q6dDopymlMfbZmgBzJtQRLAFm2iouucrjkovbm0igeTFSXbiFm8= X-Received: by 2002:a05:600c:5488:b0:490:9d1b:f07f with SMTP id 5b1f17b1804b1-490c25b1277mr42095655e9.12.1780647656017; Fri, 05 Jun 2026 01:20:56 -0700 (PDT) Received: from ramin-pc ([178.19.210.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc39def5sm127955605e9.5.2026.06.05.01.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 01:20:54 -0700 (PDT) From: Ramin Moussavi To: Michal Simek Cc: linux-kernel@vger.kernel.org, Ramin Moussavi , Ramin Moussavi Subject: [PATCH v2 1/2] microblaze: wire up sigaltstack Date: Fri, 5 Jun 2026 10:20:49 +0200 Message-ID: <842268707ace03f5be69e70a30ff0de7a9a9d6ef.1780647609.git.lordrasmus@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sigaltstack is wired to sys_ni_syscall - microblaze is the only architecture without it - although the microblaze signal delivery code fully supports the alternate signal stack: get_sigframe() picks the stack via sigsp(), setup_rt_frame() saves it with __save_altstack() and sys_rt_sigreturn() calls restore_altstack(). Wire it up to sys_sigaltstack. Tested on qemu petalogix-s3adsp1800 (microblazeel, kernel 6.5.10 and syscall table unchanged in current mainline) with the uClibc-ng test suite: the five sigaltstack-dependent NPTL tests (tst-cancel20/21, tst-cancelx20/21, tst-signal6) pass; before this change sigaltstack() returned ENOSYS. Signed-off-by: Ramin Moussavi --- arch/microblaze/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/= kernel/syscalls/syscall.tbl index 223d26303..b4ce48e8a 100644 --- a/arch/microblaze/kernel/syscalls/syscall.tbl +++ b/arch/microblaze/kernel/syscalls/syscall.tbl @@ -193,7 +193,7 @@ 183 common getcwd sys_getcwd 184 common capget sys_capget 185 common capset sys_capset -186 common sigaltstack sys_ni_syscall +186 common sigaltstack sys_sigaltstack 187 common sendfile sys_sendfile 188 common getpmsg sys_ni_syscall 189 common putpmsg sys_ni_syscall --=20 2.53.0 From nobody Mon Jun 8 06:35:56 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D18013C1974 for ; Fri, 5 Jun 2026 08:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780647660; cv=none; b=TSCjNfdSsg+qgxqroVkGyIZmG4E25wPbl4jV3xdfrn72X7epYx6fqvWMIyFBKsiCTK23sRoeHSADIxBqVnPuvPvnCqZZ4Kx2hCZivHiq3d9JnZRooMyYKxx4fPASp2hbzmm/EWxzKJjx8640c7aM7y/YaBLOZspnG8TUsm57rqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780647660; c=relaxed/simple; bh=H0hVvIjwGizpEWyI+8KCCKEuuBY7O0QheBIN/8pK5Us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AN5vSQ1nhN7TzbYH20/vO4clrxVeDvFPgCxSJq9d64rjPtJwbsqtm94Asp2OCNitMluMLBg6fO30MXMOu0HlTlMkvRe+uz0Y8ifsoUoNH4mp3spokHRkhW07tuK0TYRbn8vKLiykbANBOOgs/XggbB5yiYmzhnPDvO0aiTul8Ag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iOigSely; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iOigSely" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-490b3637b90so13965945e9.3 for ; Fri, 05 Jun 2026 01:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780647657; x=1781252457; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rDe42LdrX6YosSnOY+ewnKOd+gSpyZFjyFyHzW4bb4Y=; b=iOigSelyJdWnSEUP1G7vbIK/RqptapzY1AF8RJ3zj/MPlvEuJ+3GEkpBh1WsCC+oUC VE4wkLJ0qGitaJBp7fA/6tQ7YzjQxiHEa780yit7CFIJYb/siNoNxc2IxHSFumPIfezW j5v8JJgDgkr6e8/GlMq56FgjsA4cjOAVHwn+a5tWN8uSoiKt9CkQYN3hYO/rTagUQWFc VHwUiDS0Z+sv7Pbm3+ryGGBpcCgC2huuQqNJAX8XmwfEtgkRlOTdKogVXI7nfXkFf0Xb 6vj23EnTF0Bkx3Y2ZIoLZJZyRNbVLSMx/lpdKYUW3LAmnNKQFiYtAPE30KDDYPQEkoYm QINg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780647657; x=1781252457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rDe42LdrX6YosSnOY+ewnKOd+gSpyZFjyFyHzW4bb4Y=; b=h9zLnk/ARZanaVz0kILEapfrhXAF0BItbEpd7kvRuERWLeRyApo9FfJVVVE1fTuSeq ehm5p3Py/iwJSqISnUXNgRPQrT8p1hPTBz673J3S2DaUI0IY7R6tvk5GmrsA9GSsU5cL 7GSxAH154svE+FT9zHiUITFSoG9cKaMY7YXzYlBdKF7TAFSvOLgSi7pNbiXWkK7ob6LK ZJ54XNxaKuC7TuqvWe6TYcAfs50V5pi0jXmmM1HkYZKkXQd4o31+Pxdnxx4ydO70rrk+ kmv+KsaykdhfAP6qit17j3aqpKzCeEKqe8GsOQgFRpIZkzJ4M3X4AS8e00qjTUv/y/w/ Gzng== X-Gm-Message-State: AOJu0YwNh0e+wV8LuM+llpJ5s6FPhR/cDKP8yTrpY/3vbFUOnS5IKpxR 8MX6IOYDWaXqvPC5GAORisDxoWEDKZeLzZOvKuub7rAyQ5thpQNnG+dd X-Gm-Gg: Acq92OHIWQv6FchsbmjIOGPtfnHMSskSLKJaw7S6TSsQakIKrW7rMT9atGE1LX4TujB DK5MEQGuImMsbFhomgk5FkbS2bo8ZutM91ZHtqPgp4BeEUbXh8sC77E95s6SRG0w/uLfVuCcHed 345bkJ4pFR5eSvdkHoUQbPPY1MAxkfdXSh85ex+6yD6xA6blEH0Ksn2HP5J7NwWfafB2jBN7h8i B0Vp3yvc7K9NRhETSLKTHTlYpy3vqSCIuBkLGoZQFmKt/G99q/8R15VvG5eHd5CY7B5xi728ebo 3ib/42wj26w1q51zVCD6w6ul6Bwwah2mf14RMRPktX1vsaoHj/n6nsbKLF5rqCuC4JFCz/86NXV X7iJvOiDa7pUoeQRHXVTpPOCenfsm7JRkhFWdbYglghO+crOMxAwgOo1qlI0c8UByIiWpJ9OA/z hYjUvXQmTzKj1Fr9rKN9m7QHtla8G6yNSClnzUG8s27feQiQOYvs7/79wen9QPkKwreFA22SFw5 g== X-Received: by 2002:a05:600c:45d1:b0:490:b9c3:6c62 with SMTP id 5b1f17b1804b1-490c261007dmr29775685e9.28.1780647657122; Fri, 05 Jun 2026 01:20:57 -0700 (PDT) Received: from ramin-pc ([178.19.210.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc39def5sm127955605e9.5.2026.06.05.01.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 01:20:56 -0700 (PDT) From: Ramin Moussavi To: Michal Simek Cc: linux-kernel@vger.kernel.org, Ramin Moussavi , Ramin Moussavi Subject: [PATCH v2 2/2] microblaze: reserve the ABI argument-home area in the signal frame Date: Fri, 5 Jun 2026 10:20:50 +0200 Message-ID: <13d7f86e7e5d56a138646c4beb4150fa7d5a5008.1780647609.git.lordrasmus@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The MicroBlaze procedure call standard reserves [r1+0] for the return address and lets a callee store its incoming register arguments r5..r10 into the caller-provided home slots at [r1+4]..[r1+24]. When the kernel enters a signal handler it sets r1 to point at struct rt_sigframe, whose leading members are the siginfo and ucontext prepared for the handler. A handler that homes its arguments - which an unoptimised (-O0) build always does - therefore overwrites the start of siginfo/ucontext, corrupting the signal state that the handler and sys_rt_sigreturn() depend on. Reserve the home area by making a seven-word gap the first member of struct rt_sigframe, so the handler's argument stores land in scratch space instead of clobbering siginfo. Tested on qemu-system-microblazeel (petalogix-s3adsp1800) with the uClibc-ng NPTL test suite: tst-timer4, tst-timer5, tst-mqueue5 and tst-signal6 pass; before this change they failed because the handler clobbered the signal frame. Signed-off-by: Ramin Moussavi --- arch/microblaze/kernel/signal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signa= l.c index c78a0ff48..9cca06d60 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c @@ -49,6 +49,14 @@ struct sigframe { }; =20 struct rt_sigframe { + /* + * Home area for the handler's register arguments: the MicroBlaze + * ABI reserves [r1+0] for the return address and lets the callee + * store r5..r10 at [r1+4]..[r1+24], and r1 points at this frame + * when the handler is entered. Without the gap those stores + * corrupt info/uc. + */ + unsigned long abi_gap[7]; struct siginfo info; struct ucontext uc; unsigned long tramp[2]; /* signal trampoline */ --=20 2.53.0