From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: "Claude Opus 4.6" <noreply@anthropic.com>,
Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/4] powerpc: fix initjmp storing function pointer at wrong offset
Date: Mon, 2 Mar 2026 14:47:34 +0100 [thread overview]
Message-ID: <20260302134843.195007-3-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260302134843.195007-1-a.fatoum@barebox.org>
initjmp was storing the function pointer at offset 88, which is the CR
(condition register) slot in the jmp_buf, instead of offset 84, which is
the LR (link register) slot. When longjmp later restored the buffer, it
would load uninitialized data into LR and jump to it, causing a crash.
This was caught by the setjmp selftest, which triggered a reboot loop on
qemu-ppce500.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/powerpc/lib/setjmp.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/setjmp.S b/arch/powerpc/lib/setjmp.S
index 021a57eebc3c..7f4d041ce213 100644
--- a/arch/powerpc/lib/setjmp.S
+++ b/arch/powerpc/lib/setjmp.S
@@ -79,8 +79,8 @@ END(longjmp)
ENTRY(initjmp)
addi r3,r3,7 # align to 8 byte boundary
rlwinm r3,r3,0,0,28
- stw r5,0(r3) # offset 0
- stwu r4,88(r3) # offset 88
+ stw r5,0(r3) # offset 0 - stack pointer
+ stw r4,84(r3) # offset 84 - link register
li r3,0
blr
END(initjmp)
--
2.47.3
next prev parent reply other threads:[~2026-03-02 13:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 13:47 [PATCH 0/4] ci: fixes for PowerPC and networking test Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt Ahmad Fatoum
2026-03-02 13:47 ` Ahmad Fatoum [this message]
2026-03-02 13:47 ` [PATCH 3/4] powerpc: qemu-ppce500_defconfig: increase malloc area to default 4 MiB Ahmad Fatoum
2026-03-02 13:47 ` [PATCH 4/4] test: selftest: mmu: skip mirroring tests when not supported Ahmad Fatoum
2026-03-04 7:36 ` [PATCH 0/4] ci: fixes for PowerPC and networking test Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260302134843.195007-3-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=noreply@anthropic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox