From: Blaisorblade <blaisorblade@yahoo.it>
To: Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] Testing requested - [PATCH] Fixing SKAS0 compilation problem / TT mode bug report
Date: Tue, 29 Nov 2005 17:28:56 +0100 [thread overview]
Message-ID: <200511291728.56515.blaisorblade@yahoo.it> (raw)
In-Reply-To: <20051128042327.GA28500@ccure.user-mode-linux.org>
On Monday 28 November 2005 05:23, Jeff Dike wrote:
> On Sun, Nov 27, 2005 at 09:59:37PM +0100, Blaisorblade wrote:
> > The attached patch is a (hacky) proposal, alternative to Jeff's
> > fix-stub-syscall6, to fix the SKAS0 compilation problem.
> Bleah :-)
Yep :-).
> > In fact, Jeff's patch makes the problem appear on my system (where I
> > never reproduced it).
> What assembly did you end up with, with my patch?
Actually, looking at it today, it's a different story than the usual one:
====working (from the .s output rather than disassembly):
#APP
push %ebp ; movl %eax,%ebp ; movl $192,%eax ; int $0x80 ; pop %ebp
#NO_APP
movl %eax, %edi
.L4:
movl %edi, -1073745896
#APP
int3
====not-working:
#APP
push %ebp ; movl %eax,%ebp ; movl $192,%eax ; int $0x80 ; pop %ebp
#NO_APP
movl %eax, -16(%ebp)
.L4:
movl -16(%ebp), %eax
movl %eax, -1073745896
#APP
int3
Command line for GCC:
gcc -Wp,-MD,arch/um/kernel/skas/.clone.s.d -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2
-fno-omit-frame-pointer -fno-optimize-sibling-calls -D__arch_um__
-DSUBARCH=\"i386\" -Dvmap=kernel_vmap
-Din6addr_loopback=kernel_in6addr_loopback -Iarch/um/include
-I/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/arch/um/include
-I/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/arch/um/kernel/tt/include
-I/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/arch/um/kernel/skas/include
-D_FILE_OFFSET_BITS=64 -m32 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -S -o
arch/um/kernel/skas/clone.s /home/paolo/Admin/kernel/6/VCS/linux-2.6.14/arch/um/kernel/skas/clone.c
As you see, what's moved is the scratch pid location, put in %edi register
normally and in the stack on the faulty assembly (btw, I'm puzzled why GCC
should do this puzzling around).
So, indeed, with your patch GCC understands that the variable is at a known
location, but becomes silly for other reasons.
So, again: can we finally rewrite clone.c in assembly? Or, otherwise, to use a
unique assembly macro joining mmap, the return and trap_myself?
It could be nicer to have it in C, but hey, GCC won, we lost. So let gcc suck
and work without it.
It's fundamentally hacky to get GCC not to use the stack, it's not written for
that. Either you say "ok, let's copy the whole stack content when remapping"
a-la switcheroo() or we agree on ASM.
> > #ifdef CONFIG_MODE_SKAS
> > #define KSTK_REG(tsk, reg) \
> > ({ union uml_pt_regs regs; \
> > get_thread_regs(®s, tsk->thread.mode.skas.switch_buf); \
> > UPT_REG(®s, reg); })
> > #else
> > #define KSTK_REG(tsk, reg) (0xbadbabe)
> > #endif
> Oops, needs fixing.
Btw, the old code was probably uncorrect but didn't crash except for sysrq-t.
Actually, in TT mode we possibly don't have the right location (do we save
the stack pointer before entering the kernel)? Let's just use the old code as
fallback for that, it's not worth implementing such a feature for TT mode.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2005-11-29 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-27 20:59 [uml-devel] Testing requested - [PATCH] Fixing SKAS0 compilation problem / TT mode bug report Blaisorblade
2005-11-28 0:47 ` [uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML UML
2005-11-29 12:22 ` Phill Wombat
2005-11-29 16:52 ` Blaisorblade
2005-11-30 20:32 ` Phill Wombat
2005-12-01 12:34 ` Blaisorblade
2005-11-28 4:23 ` [uml-devel] Testing requested - [PATCH] Fixing SKAS0 compilation problem / TT mode bug report Jeff Dike
2005-11-29 16:28 ` Blaisorblade [this message]
2005-11-29 17:55 ` Jeff Dike
2005-12-02 0:18 ` Blaisorblade
2005-12-03 5:54 ` Jeff Dike
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=200511291728.56515.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox