Skip to contentSkip to conversation

Testing requested - [PATCH] Fixing SKAS0 compilation problem / TT mode bug report

uml-devel Blaisorblade 3 participants 11 messages Nov 27, 2005 – Dec 3, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

The attached patch is a (hacky) proposal, alternative to Jeff's fix-stub-syscall6, to fix the SKAS0 compilation problem.

In fact, Jeff's patch makes the problem appear on my system (where I never reproduced it).

I'm going to stick this in -bs2, as it makes kernels compiled for me work better. So please test compiling -bs2.

As an aside, I saw this code crashing at shutdown in TT mode, from fs/proc/array.c:do_task_stat() :

        if (mm) {
                vsize = task_vsize(mm);
                eip = KSTK_EIP(task);
                esp = KSTK_ESP(task);
        }

Went looking and guess what? There is full crap (starting from 2.6.14, due to the fixes for sysrq-t IIRC):

include/asm-um/processor-i386.h

#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)
#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)
#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)

include/asm-um/processor-generic.h

#ifdef CONFIG_MODE_SKAS

#define KSTK_REG(tsk, reg) \
        ({ union uml_pt_regs regs; \
           get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
           UPT_REG(&regs, reg); })

#else
#define KSTK_REG(tsk, reg) (0xbadbabe)
#endif

I didn't fully realize the amount of crap in the patch when I reviewed it at that time (but I do remember complaining about 0xbadbabe rather than 0xdeadbeef, so I'm guilty too).

I'll restore for TT mode the 2.6.13 content (which is wrong and kills sysrq-t, but is better than crap).

And there's no reason for letting TT mode bitrot so much, sorry. Making UML work for everybody, plus having a SMP testing mode, still means keeping it working.

Signature · 3 lines
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
arch/um/kernel/skas/clone.c +5 -0
Index: linux-2.6.14/arch/um/kernel/skas/clone.c
===================================================================
@@ -1,5 +1,6 @@
 #include <sched.h>
 #include <signal.h>
+#include <stddef.h>
 #include <sys/mman.h>
 #include <sys/time.h>
 #include <asm/unistd.h>
@@ -39,6 +40,10 @@ stub_clone_handler(void)
 			    from->fd, from->offset);
  out:
 	/* save current result. Parent: pid; child: retcode of mmap */
+#if defined(UML_CONFIG_UML_X86) && !defined(UML_CONFIG_64BIT)
+	__asm__("movl %0, %1": : "r" (err), "g" (*(long*) (UML_CONFIG_STUB_DATA + offsetof(struct stub_data, err))));
+#else
 	from->err = err;
+#endif
 	trap_myself();
 }
#1 lore raw

[uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML

Hi Paolo,

Please create an x86_64 binary so I can play with different 64 bit distros.

Thanks in advance (I know you have lots of spare time on your hands....)

Cheers
Phill.

P.S. the 32 bit binary is wonderful! It does absolutely everything I need.

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw

Re: [uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML

Hi Paolo,

x86_64 binary.

So far so good!

I have managed to create an FC4/x86_64 rootfs from the very impressive (and amazingly simple) shell script on umlwiki where the entire distro is installed via yum. Had some trouble with gpg keys though.

The rootfs starts up and hangs at the usual places to do with consoles etc. I'll get to doing some hacks on the rootfs to get things going.

Thanks again
Phill.

Quoted 11 lines · UML

Hi Paolo,

Please create an x86_64 binary so I can play with different 64 bit distros.

Thanks in advance (I know you have lots of spare time on your hands....)

Cheers
Phill.

P.S. the 32 bit binary is wonderful! It does absolutely everything I need.

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

Re: [uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML

Quoted 5 lines · Phill Wombat

Hi Paolo,

x86_64 binary.

So far so good!

Thanks, I have no 64-bit FS to test it. Btw, there's also some other site with binaries:

http://uml.harlowhill.com/index.php/PrecompiledKernels

http://uml.nagafix.co.uk/

Quoted 9 lines

I have managed to create an FC4/x86_64 rootfs from the very impressive (and amazingly simple) shell script on umlwiki where the entire distro is installed via yum. Had some trouble with gpg keys though.

The rootfs starts up and hangs at the usual places to do with consoles etc. I'll get to doing some hacks on the rootfs to get things going.

Thanks again
Phill.

Signature · 23 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#4 lore raw

Re: [uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML

Hi Paolo,

Use this to create a new FC4/x86_64 rootfs (modified from umlwiki post).

#!/bin/bash

RPM_INSTALL_CHR=./INSTALL

echo " --> Setting up chroot env in $RPM_INSTALL_CHR"

if [ id -u = "0" ] ; then

        mkdir -p \
                $RPM_INSTALL_CHR/etc \
                $RPM_INSTALL_CHR/dev \
                $RPM_INSTALL_CHR/proc \
                $RPM_INSTALL_CHR/sys \
                $RPM_INSTALL_CHR/var/tmp \
                $RPM_INSTALL_CHR/var/cache/yum
        touch $RPM_INSTALL_CHR/etc/fstab
        mknod $RPM_INSTALL_CHR/dev/null c 1 3
        chmod 666 $RPM_INSTALL_CHR/dev/null
        mount --bind /proc $RPM_INSTALL_CHR/proc
        mount --bind /sys $RPM_INSTALL_CHR/sys
#       rpm \
#               --root $PWD/$RPM_INSTALL_CHR \
#               --import http://fedora.redhat.com/about/security/4F2A6FD2.txt
        rpm \
                --root $PWD/$RPM_INSTALL_CHR \
                -Uvh \
                --nodeps \
                --force \
                http://download.fedora.redhat.com/pub/fedora/linux/core/4/x86_64/os/Fedora/RPMS/fedora-release-4-2.noarch.rpm
        yum \
                -y \
                -C \
                --installroot=$PWD/$RPM_INSTALL_CHR \
                groupinstall "Base"
        umount $RPM_INSTALL_CHR/proc
        umount $RPM_INSTALL_CHR/sys

else
echo " *** Sorry, you must be root to setup a chroot environment" exit 1
fi

This is the gpg key installed instead of the commented lines (I couldn't find the right key on the fedora web site). It comes from the live FC4/x86_64 host with rpm -qa gpg-pubkeys*; rpm -qi gpg-pubkey-db42a60e

Name : gpg-pubkey Relocations: (not relocatable)
Version : db42a60e Vendor: (none)
Release : 37ea5438 Build Date: Thu 25 Aug 2005 02:28:19 PM EST
Install Date: Thu 25 Aug 2005 02:28:19 PM EST Build Host: localhost
Group : Public Keys Source RPM: (none)
Size : 0 License: pubkey
Signature : (none)
Summary : gpg(Red Hat, Inc <[email protected]>)
Description :
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.4.1 (beecrypt-3.0.0)

mQGiBDfqVDgRBADBKr3Bl6PO8BQ0H8sJoD6p9U7Yyl7pjtZqioviPwXP+DCWd4u8HQzcxAZ5 7m8ssA1LK1Fx93coJhDzM130+p5BG9mYSWShLabR3N1KXdXQYYcowTOMGxdwYRGr1Spw8Qyd LhjVfU1VSl4xt6bupPbWJbyjkg5Z3P7BlUOUJmrx3wCgobNVEDGaWYJcch5z5B1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rE54XFtOd04NMgWI63u qZc4zkRa+kwEZtmbz3tHSdRCCE+Y7YVP6IUf/w6YPQFQriWYFiA6fD10eB+BlIUqIw80Vgjs BKmCwvKkn4jg8kibXgj4/TzQSx77uYokw1EqQ2wkOZoaEtcubsNMquuLCMWijYhGBBgRAgAG BQI36lRyAAoJECGRgM3bQqYOhyYAnj7hVDY/FJAGqmtZpwVp9IlitW5tAJ4xQApr/jNFZCTk snI+4O1765F7tA==
=3AHZ
-----END PGP PUBLIC KEY BLOCK-----

Quoted 5 lines · Blaisorblade
Quoted 4 lines · Phill Wombat

Hi Paolo,

x86_64 binary.

Quoted 19 lines
Quoted 1 line

So far so good!

Thanks, I have no 64-bit FS to test it. Btw, there's also some other site with binaries:

http://uml.harlowhill.com/index.php/PrecompiledKernels

http://uml.nagafix.co.uk/

Quoted 9 lines

I have managed to create an FC4/x86_64 rootfs from the very impressive (and amazingly simple) shell script on umlwiki where the entire distro is installed via yum. Had some trouble with gpg keys though.

The rootfs starts up and hangs at the usual places to do with consoles etc. I'll get to doing some hacks on the rootfs to get things going.

Thanks again
Phill.

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#5 lore raw

Re: [uml-devel] Blaisorblade's UML binaries - MORE MORE... please give us an x86_64 UML

Quoted 3 lines · Phill Wombat

Hi Paolo,

Use this to create a new FC4/x86_64 rootfs (modified from umlwiki post).

Can that be added there too? Doing collaborative editing is the Wiki purpose.

Quoted 108 lines

#!/bin/bash

RPM_INSTALL_CHR=./INSTALL

echo " --> Setting up chroot env in $RPM_INSTALL_CHR"

if [ id -u = "0" ] ; then

        mkdir -p \
                $RPM_INSTALL_CHR/etc \
                $RPM_INSTALL_CHR/dev \
                $RPM_INSTALL_CHR/proc \
                $RPM_INSTALL_CHR/sys \
                $RPM_INSTALL_CHR/var/tmp \
                $RPM_INSTALL_CHR/var/cache/yum
        touch $RPM_INSTALL_CHR/etc/fstab
        mknod $RPM_INSTALL_CHR/dev/null c 1 3
        chmod 666 $RPM_INSTALL_CHR/dev/null
        mount --bind /proc $RPM_INSTALL_CHR/proc
        mount --bind /sys $RPM_INSTALL_CHR/sys
#       rpm \
#               --root $PWD/$RPM_INSTALL_CHR \
#               --import
http://fedora.redhat.com/about/security/4F2A6FD2.txt rpm \
                --root $PWD/$RPM_INSTALL_CHR \
                -Uvh \
                --nodeps \
                --force \

http://download.fedora.redhat.com/pub/fedora/linux/core/4/x86_64/os/Fedora/

RPMS/fedora-release-4-2.noarch.rpm yum \
                -y \
                -C \
                --installroot=$PWD/$RPM_INSTALL_CHR \
                groupinstall "Base"
        umount $RPM_INSTALL_CHR/proc
        umount $RPM_INSTALL_CHR/sys

else
echo " *** Sorry, you must be root to setup a chroot environment" exit 1
fi

This is the gpg key installed instead of the commented lines (I couldn't find the right key on the fedora web site). It comes from the live FC4/x86_64 host with rpm -qa gpg-pubkeys*; rpm -qi gpg-pubkey-db42a60e

Name : gpg-pubkey Relocations: (not relocatable)
Version : db42a60e Vendor: (none)
Release : 37ea5438 Build Date: Thu 25 Aug 2005
02:28:19 PM EST Install Date: Thu 25 Aug 2005 02:28:19 PM EST Build
Host: localhost Group : Public Keys Source RPM:
(none)
Size : 0 License: pubkey
Signature : (none)
Summary : gpg(Red Hat, Inc <[email protected]>)
Description :
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.4.1 (beecrypt-3.0.0)

mQGiBDfqVDgRBADBKr3Bl6PO8BQ0H8sJoD6p9U7Yyl7pjtZqioviPwXP+DCWd4u8HQzcxAZ5 7m8ssA1LK1Fx93coJhDzM130+p5BG9mYSWShLabR3N1KXdXQYYcowTOMGxdwYRGr1Spw8Qyd LhjVfU1VSl4xt6bupPbWJbyjkg5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2/itDOPGHW07SsVWOR6cmX4VlRRcWB5KejaNvdrE54XFtOd04NMgWI63u qZc4zkRa+kwEZtmbz3tHSdRCCE+Y7YVP6IUf/w6YPQFQriWYFiA6fD10eB+BlIUqIw80Vgjs BKmCwvKkn4jg8kibXgj4/TzQSx77uYokw1EqQ2wkOZoaEtcubsNMquuLCMWijYhGBBgRAgAG BQI36lRyAAoJECGRgM3bQqYOhyYAnj7hVDY/FJAGqmtZpwVp9IlitW5tAJ4xQApr/jNFZCTk snI+4O1765F7tA==
=3AHZ
-----END PGP PUBLIC KEY BLOCK-----

Quoted 23 lines · Blaisorblade
Quoted 5 lines · Phill Wombat

Hi Paolo,

x86_64 binary.

So far so good!

Thanks, I have no 64-bit FS to test it. Btw, there's also some other site with binaries:

http://uml.harlowhill.com/index.php/PrecompiledKernels

http://uml.nagafix.co.uk/

Quoted 9 lines

I have managed to create an FC4/x86_64 rootfs from the very impressive (and amazingly simple) shell script on umlwiki where the entire distro is installed via yum. Had some trouble with gpg keys though.

The rootfs starts up and hangs at the usual places to do with consoles etc. I'll get to doing some hacks on the rootfs to get things going.

Thanks again
Phill.

Signature · 23 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#6 lore raw
In reply to Blaisorblade
Quoted 2 lines · Blaisorblade

The attached patch is a (hacky) proposal, alternative to Jeff's fix-stub-syscall6, to fix the SKAS0 compilation problem.

Bleah :-)

Quoted 2 lines

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?

Quoted 20 lines

As an aside, I saw this code crashing at shutdown in TT mode, from fs/proc/array.c:do_task_stat() :

        if (mm) {
                vsize = task_vsize(mm);
                eip = KSTK_EIP(task);
                esp = KSTK_ESP(task);
        }

Went looking and guess what? There is full crap (starting from 2.6.14, due to the fixes for sysrq-t IIRC):

include/asm-um/processor-i386.h

#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)
#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)
#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)

include/asm-um/processor-generic.h

Quoted 8 lines

#ifdef CONFIG_MODE_SKAS

#define KSTK_REG(tsk, reg) \
        ({ union uml_pt_regs regs; \
           get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
           UPT_REG(&regs, reg); })

#else
#define KSTK_REG(tsk, reg) (0xbadbabe)
#endif

Oops, needs fixing.

Jeff

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#7 lore raw
Quoted 5 lines · Jeff Dike
Quoted 2 lines · Blaisorblade

The attached patch is a (hacky) proposal, alternative to Jeff's fix-stub-syscall6, to fix the SKAS0 compilation problem.

Bleah :-)

Yep :-).

Quoted 4 lines
Quoted 2 lines

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.

Quoted 10 lines
Quoted 8 lines

#ifdef CONFIG_MODE_SKAS

#define KSTK_REG(tsk, reg) \
        ({ union uml_pt_regs regs; \
           get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
           UPT_REG(&regs, 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.

Signature · 23 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#8 lore raw
Quoted 2 lines · Blaisorblade

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?

I would favor the second, although I would just join the mmap and storing of the error value. The stack switching is at the heart of our recent problems here, so some asm which hides that should be OK. I think the rest is OK with the pseudo-C, right?

Jeff

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#9 lore raw
Quoted 6 lines · Jeff Dike
Quoted 2 lines · Blaisorblade

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?

I would favor the second, although I would just join the mmap and storing of the error value.

I want to add the int3 too - that's the only way to be deterministically sure that GCC doesn't use %ebp after the unmap.

Quoted 3 lines

The stack switching is at the heart of our recent
problems here, so some asm which hides that should be OK. I think the rest is OK with the pseudo-C, right?

Yes, mostly.... there is also the problem with hardened toolchains (two different reports), which makes inline syscalls bleach (hardened toolchains use PIE code and need to have %EBX reserved for GOT/PLT handling), but I currently I do not consider fixing it before I can reproduce it.

Signature · 21 lines
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! Messenger: chiamate gratuite in tutto il mondo 
http://it.messenger.yahoo.com



-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#10 lore raw
Quoted 2 lines · Blaisorblade

I want to add the int3 too - that's the only way to be deterministically sure that GCC doesn't use %ebp after the unmap.

Well, my current patch branches to the int3. gcc will have to be pretty imaginative to involve ebp in a branch.

Quoted 4 lines

Yes, mostly.... there is also the problem with hardened toolchains (two different reports), which makes inline syscalls bleach (hardened toolchains use PIE code and need to have %EBX reserved for GOT/PLT handling), but I currently I do not consider fixing it before I can reproduce it.

Yeah, I encountered this in a different context.

Jeff

-------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel