From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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/signal.c index c78a0ff48..9cca06d60 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c @@ -49,6 +49,14 @@ struct sigframe { }; 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 */ -- 2.53.0