From: Brian Cain <brian.cain@oss.qualcomm.com>
To: linux-hexagon@vger.kernel.org
Cc: sid.manning@oss.qualcomm.com, pierrick.bouvier@oss.qualcomm.com,
Brian Cain <brian.cain@oss.qualcomm.com>
Subject: [PATCH 6/7] hexagon: set the user stack pointer in start_thread
Date: Sat, 5 Sep 2026 19:17:11 -0700 [thread overview]
Message-ID: <20260906021712.2498266-7-brian.cain@oss.qualcomm.com> (raw)
In-Reply-To: <20260906021712.2498266-1-brian.cain@oss.qualcomm.com>
start_thread() set only the stack pointer that vmrte restores on the way
back to user mode, leaving the copy in pt_regs holding whatever the
previous thread had. A ptrace stop between execve() and the first return
to user mode therefore reported a stale r29. Set both.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
arch/hexagon/kernel/process.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index f5e9934c36e3..6953c4b1fd5c 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -16,6 +16,7 @@
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/resume_user_mode.h>
+#include <asm/hexagon_vm.h>
/*
* Program thread launch. Often defined as a macro in processor.h,
@@ -33,6 +34,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
/* We might want to also zero all Processor registers here */
pt_set_usermode(regs);
pt_set_elr(regs, pc);
+ regs->r29 = sp;
pt_set_rte_sp(regs, sp);
}
--
2.34.1
next prev parent reply other threads:[~2026-09-06 2:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 2:17 [PATCH 0/7] Hexagon build/syscall/etc fixes Brian Cain
2026-09-06 2:17 ` [PATCH 1/7] hexagon: disable the LLVM packetizer Brian Cain
2026-09-06 2:17 ` [PATCH 2/7] hexagon: define ELF_CORE_EFLAGS for V4-and-later architectures Brian Cain
2026-09-06 2:17 ` [PATCH 3/7] hexagon: stop passing -mv${CONFIG_HEXAGON_ARCH_VERSION} to the linker Brian Cain
2026-09-06 2:17 ` [PATCH 4/7] hexagon: read the thread-info register with a volatile asm Brian Cain
2026-09-06 2:17 ` [PATCH 5/7] hexagon: let do_work_pending return without pending work Brian Cain
2026-09-06 2:17 ` Brian Cain [this message]
2026-09-06 2:17 ` [PATCH 7/7] hexagon: return -ENOSYS for unimplemented syscalls Brian Cain
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=20260906021712.2498266-7-brian.cain@oss.qualcomm.com \
--to=brian.cain@oss.qualcomm.com \
--cc=linux-hexagon@vger.kernel.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=sid.manning@oss.qualcomm.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