From: Jeff Dike <jdike@addtoit.com>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH] Early x86_64 crash
Date: Thu, 29 Sep 2005 12:16:17 -0400 [thread overview]
Message-ID: <20050929161617.GA30460@ccure.user-mode-linux.org> (raw)
If you are running UML/x86_64 and are seeing it crash before starting init,
I'd like you to do the following:
- make sure that you have CONFIG_FRAME_POINTER disabled
- enable it and see that UML boots
- apply the patch below, disable CONFIG_FRAME_POINTER again, and
see if UML still boots
- report results back to me
Jeff
Index: test/arch/um/sys-x86_64/stub_segv.c
===================================================================
--- test.orig/arch/um/sys-x86_64/stub_segv.c 2005-09-29 12:19:07.000000000 -0400
+++ test/arch/um/sys-x86_64/stub_segv.c 2005-09-29 12:21:03.000000000 -0400
@@ -11,6 +11,16 @@
#include "sysdep/sigcontext.h"
#include "sysdep/faultinfo.h"
+/* Copied from sys-x86_64/signal.c - Can't find an equivalent definition
+ * in the libc headers anywhere.
+ */
+struct rt_sigframe
+{
+ char *pretcode;
+ struct ucontext uc;
+ struct siginfo info;
+};
+
void __attribute__ ((__section__ (".__syscall_stub")))
stub_segv_handler(int sig)
{
@@ -22,11 +32,14 @@
__asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid));
__asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;"
- "syscall": : "g" (__NR_kill), "g" (SIGUSR1));
- /* Two popqs to restore the stack to the state just before entering
- * the handler, one pops the return address, the other pops the frame
- * pointer.
+ "syscall": : "g" (__NR_kill), "g" (SIGUSR1) :
+ "%rdi", "%rax", "%rsi");
+ /* sys_sigreturn expects that the stack pointer will be 8 bytes into
+ * the signal frame. So, we use the ucontext pointer, which we know
+ * already, to get the signal frame pointer, and add 8 to that.
*/
- __asm__("popq %%rax ; popq %%rax ; movq %0, %%rax ; syscall" : : "g"
- (__NR_rt_sigreturn));
+ __asm__("movq %0, %%rsp": :
+ "g" ((unsigned long) container_of(uc, struct rt_sigframe,
+ uc) + 8));
+ __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn));
}
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next reply other threads:[~2005-09-29 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-29 16:16 Jeff Dike [this message]
2005-09-30 14:41 ` [uml-devel] [PATCH] Early x86_64 crash Blaisorblade
2005-10-02 2:35 ` Jeff Dike
2005-10-02 15:23 ` Blaisorblade
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=20050929161617.GA30460@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.