Skip to contentSkip to conversation

UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes

PATCH In review Chris Wedgwood 7 participants 16 messages Nov 3, 2004 – Nov 19, 2004 2 messages not in the archive User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes

kill(..., SIGKILL) doesn't work to kill host-OS processes created in the exec path in TT mode --- for this we need PTRACE_KILL (it did work in previous kernels, but not by design). Without this process will accumulate on the host-OS (although the won't be visible inside UML).

---

Yes, there are other fixes along these lines which are needed but one at a time as we test these...

arch/um/kernel/tt/exec_user.c +2 -1
Index: cw-current/arch/um/kernel/tt/exec_user.c
===================================================================
@@ -35,7 +35,8 @@
 		tracer_panic("do_exec failed to get registers - errno = %d",
 			     errno);
 
-	kill(old_pid, SIGKILL);
+	if (ptrace(PTRACE_KILL, old_pid, NULL, NULL))
+		printk("Warning: ptrace(PTRACE_KILL, %d, ...) saw %d\n", errno);
 
 	if(ptrace_setregs(new_pid, regs) < 0)
 		tracer_panic("do_exec failed to start new proc - errno = %d",

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 16 lines · Chris Wedgwood

kill(..., SIGKILL) doesn't work to kill host-OS processes created in the exec path in TT mode --- for this we need PTRACE_KILL (it did work in previous kernels, but not by design). Without this process will accumulate on the host-OS (although the won't be visible inside UML).

---

Yes, there are other fixes along these lines which are needed but one at a time as we test these...

Index: cw-current/arch/um/kernel/tt/exec_user.c
===================================================================

arch/um/kernel/tt/exec_user.c line 39

Quoted 6 lines
arch/um/kernel/tt/exec_user.c +2 -1
@@ -35,7 +35,8 @@
 		tracer_panic("do_exec failed to get registers - errno = %d",
 			     errno);
 
-	kill(old_pid, SIGKILL);
+	if (ptrace(PTRACE_KILL, old_pid, NULL, NULL))
+		printk("Warning: ptrace(PTRACE_KILL, %d, ...) saw %d\n", errno);

You have two %d but only one argument. You seem to have forgotten an "old_pid, " in there.

arch/um/kernel/tt/exec_user.c line 42

Quoted 3 lines
arch/um/kernel/tt/exec_user.c +0 -0
 	if(ptrace_setregs(new_pid, regs) < 0)
 		tracer_panic("do_exec failed to start new proc - errno = %d",

Best regards,

Anton

Signature · 16 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw

PATCH 1/1 UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

Quoted 2 lines · Anton Altaparmakov

You have two %d but only one argument. You seem to have forgotten an "old_pid, " in there.

doh! it's a warning if something iffy happens (which so far for me it hasn't) which explains why i missed it... not sure why i didn't get a build warning though... thanks!

---
kill(..., SIGKILL) doesn't work to kill host-OS processes created in the exec path in TT mode --- for this we need PTRACE_KILL (it did work in previous kernels, but not by design). Without this process will accumulate on the host-OS (although the won't be visible inside UML).

---

arch/um/kernel/tt/exec_user.c +2 -1
Index: cw-current/arch/um/kernel/tt/exec_user.c
===================================================================
@@ -35,7 +35,8 @@
 		tracer_panic("do_exec failed to get registers - errno = %d",
 			     errno);
 
-	kill(old_pid, SIGKILL);
+	if (ptrace(PTRACE_KILL, old_pid, NULL, NULL))
+		printk("Warning: ptrace(PTRACE_KILL, %d, ...) saw %d\n", old_pid, errno);
 
 	if(ptrace_setregs(new_pid, regs) < 0)
 		tracer_panic("do_exec failed to start new proc - errno = %d",

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&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] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

Quoted 21 lines · Chris Wedgwood
Quoted 2 lines · Anton Altaparmakov

You have two %d but only one argument. You seem to have forgotten an "old_pid, " in there.

kill(..., SIGKILL) doesn't work to kill host-OS processes created in the exec path in TT mode --- for this we need PTRACE_KILL (it did work in previous kernels, but not by design). Without this process will accumulate on the host-OS (although the won't be visible inside UML).

---

Index: cw-current/arch/um/kernel/tt/exec_user.c
===================================================================
--- cw-current.orig/arch/um/kernel/tt/exec_user.c 2004-11-03 02:10:18.064830204 -0800 +++ cw-current/arch/um/kernel/tt/exec_user.c 2004-11-03 04:05:00.435843464 -0800 @@ -35,7 +35,8 @@
tracer_panic("do_exec failed to get registers - errno = %d",

         errno);
Quoted 7 lines

- kill(old_pid, SIGKILL);
+ if (ptrace(PTRACE_KILL, old_pid, NULL, NULL))
+ printk("Warning: ptrace(PTRACE_KILL, %d, ...) saw %d\n", old_pid, errno);

if(ptrace_setregs(new_pid, regs) < 0)
tracer_panic("do_exec failed to start new proc - errno = %d",

I'm going to test this. I thought that Gerd Knorr patch (which I sent cc'ing LKML and most of you) already solved this (I actually modified that one, replacing his SIGCONT kill()ing with a PTRACE_KILL, but I did this in the places he identified). I guess that old_pid should either already be dead there or going to die after a little, but I'm going to check (after I get UML to run in the current snapshot...)

For now, please hold on this.

Signature · 14 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&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] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

Quoted 1 line · Blaisorblade

I'm going to test this.

please do

Quoted 4 lines

I thought that Gerd Knorr patch (which I sent cc'ing LKML and most of you) already solved this (I actually modified that one, replacing his SIGCONT kill()ing with a PTRACE_KILL, but I did this in the places he identified).

it might, i'm going to check soon

what worries me is that two very different code paths might be fixing the same problem which makes me think the flow of execution here is very vague and needs cleaninng up

also, check your return values for errors --- i bet you will see some. os_kill_process has this problem too --- many invocations of it are pointless and fail, especially those from relase_thread_tt (i need to check the details here, this is all from memory and im getting old)

Quoted 3 lines

I guess that old_pid should either already be dead there or going to die after a little, but I'm going to check (after I get UML to run in the current snapshot...)

it should build pretty close to as-is, if not let me know and i'll sent you what i have

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#6 lore raw

Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

In reply to Blaisorblade
Quoted 2 lines

I'm going to test this. I thought that Gerd Knorr patch (which I sent cc'ing LKML and most of you) already solved this (I actually modified that one,

Not sure whenever tt is fixed with my patch, I've tested skas only (I'm building skas-only dynamically linked kernels these days because due to working on x11 framebuffer stuff which needs dynamically linked libX11). So if Chris actually tested TT then his patch probably is ok and needed as well ...

Gerd

Signature · 12 lines
#define printk(args...) fprintf(stderr, ## args)


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#7 lore raw

Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

Quoted 4 lines · Gerd Knorr

Not sure whenever tt is fixed with my patch, I've tested skas only (I'm building skas-only dynamically linked kernels these days because due to working on x11 framebuffer stuff which needs dynamically linked libX11).

it would be nice to find a way to make this work TT mode for you

Quoted 2 lines

So if Chris actually tested TT then his patch probably is ok and needed as well ...

i'm only using TT mode at present, i don't check esoteric modes that require host-OS patches at present

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&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] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

In reply to Chris Wedgwood
Quoted 4 lines · Chris Wedgwood
Quoted 1 line · Blaisorblade

I'm going to test this.

please do

The Gerd / mine patch seem to work nicely. No thread is left over.

Quoted 10 lines
Quoted 4 lines

I thought that Gerd Knorr patch (which I sent cc'ing LKML and most of you) already solved this (I actually modified that one, replacing his SIGCONT kill()ing with a PTRACE_KILL, but I did this in the places he identified).

it might, i'm going to check soon

what worries me is that two very different code paths might be fixing the same problem which makes me think the flow of execution here is very vague and needs cleaninng up

Yes, but the cleanup should first be revierwed by Jeff Dike and put in his tree. I too don't understand the code. Don't CC Andrew on the first release of the cleanup at least.

To go to the actual fact, the code path I'm fixing didn't exist till a few releases ago.

Follows is the patch containing this fix against 2.4.27, with the changelog, from Jeff Dike.

This fixes a use-after-free bug in the context switching. A process going out of context after exiting wakes up the next process and then kills itself. The problem is that when it gets around to killing itself is up to the host and can happen a long time later, including after the incoming process has freed its stack, and that memory is possibly being used for something else.

The fix is to have the incoming process kill the exiting process just to make sure it can't be running at the point that its stack is freed.

 um-linux-2.4.27-paolo/arch/um/kernel/tt/process_kern.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)

diff -puN arch/um/kernel/tt/process_kern.c~scheduler arch/um/kernel/tt/process_kern.c
--- um-linux-2.4.27/arch/um/kernel/tt/process_kern.c~scheduler 2004-11-02 11:12:28.805815264 +0100
+++ um-linux-2.4.27-paolo/arch/um/kernel/tt/process_kern.c 2004-11-02
11:12:28.807814960 +0100
@@ -25,7 +25,7 @@

void *_switch_to_tt(void *prev, void *next)
{
- struct task_struct *from, *to;

+       struct task_struct *from, *to, *prev_sched;
        unsigned long flags;
        int err, vtalrm, alrm, prof, cpu;
        char c;
@@ -67,6 +67,17 @@ void *_switch_to_tt(void *prev, void *ne
        if(err != sizeof(c))
                panic("read of switch_pipe failed, errno = %d", -err);

+ /* If the process that we have just scheduled away from has exited,

+        * then it needs to be killed here.  The reason is that, even though
+        * it will kill itself when it next runs, that may be too late.  Its
+        * stack will be freed, possibly before then, and if that happens,
+        * we have a use-after-free situation.  So, it gets killed here
+        * in case it has not already killed itself.
+        */

+ prev_sched = current->thread.prev_sched;
+ if(prev_sched->state == TASK_ZOMBIE)
+ os_kill_process(prev_sched->thread.mode.tt.extern_pid, 1);
+
/* This works around a nasty race with 'jail'. If we are switching
* between two threads of a threaded app and the incoming process
* runs before the outgoing process reaches the read, and it makes

Quoted 2 lines

also, check your return values for errors --- i bet you will see some.

That is a separate, on-top of this patch.

Quoted 10 lines

os_kill_process has this problem too --- many invocations of it are pointless and fail, especially those from relase_thread_tt (i need to check the details here, this is all from memory and im getting old)

Quoted 3 lines

I guess that old_pid should either already be dead there or going to die after a little, but I'm going to check (after I get UML to run in the current snapshot...)

it should build pretty close to as-is, if not let me know and i'll sent you what i have

No problem actually in UML, the build environment instead is very complicate. It refuses to work with NPTL, so I must build it in my old Mandrake chroot (it was a distro, now I keep it just for compilation).

Now, I must also run it on the Gentoo, or it gives problems... however, don't worry.

I'm also going to merge some patches (21 it should be). Bye

Signature · 13 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#9 lore raw

Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

In reply to Gerd Knorr
Quoted 5 lines · Gerd Knorr
Quoted 3 lines

I'm going to test this. I thought that Gerd Knorr patch (which I sent cc'ing LKML and most of you) already solved this (I actually modified that one,

Not sure whenever tt is fixed with my patch, I've tested skas only

I've tested it, and it works in fact.

Quoted 5 lines

(I'm
building skas-only dynamically linked kernels these days because due to working on x11 framebuffer stuff which needs dynamically linked libX11). So if Chris actually tested TT then his patch probably is ok and needed as well ...

Actually, from looking at Jeff Dike comment, it seem that the new kill (the one you've changed) is executed earlier and more reliably than the 1st one, the one Chris identified.

So we could ask Jeff to see if he can remove the earlier kill, the one affected by the Chris Wedgwood.

Signature · 13 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#8 lore raw

Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2)

In reply to Chris Wedgwood
Quoted 6 lines · Chris Wedgwood
Quoted 4 lines · Gerd Knorr

Not sure whenever tt is fixed with my patch, I've tested skas only (I'm building skas-only dynamically linked kernels these days because due to working on x11 framebuffer stuff which needs dynamically linked libX11).

Quoted 7 lines

it would be nice to find a way to make this work TT mode for you

Quoted 2 lines

So if Chris actually tested TT then his patch probably is ok and needed as well ...

i'm only using TT mode at present, i don't check esoteric modes that require host-OS patches at present

SKAS mode is currently more used and tested than TT mode. And the SKAS patch is included at least in WOLK, the SuSE kernel, and the -cko patchset (Con Kolivas Overloaded).

That said, feel free not to use it, but at least test that it compiles in SKAS mode.

Bye

Signature · 13 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#12 lore raw

Fixing UML against NPTL (was: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2))

In reply to a message not in the archive
Quoted 10 lines · Chris Wedgwood
Quoted 1 line · Blaisorblade

Well, not a lot of new work should go there.

agreed

Quoted 1 line

Not always. Do you think I'm a luser? Or what?

no, not at all

i was asking what break to see if i can help

Intimate Linking Script and NPTL knowledge would help a lot.

The issues are 2 ones:

1) LKML does not link because the linker does not like it's linker script, which defines a special thread_private section (give a look at switcheroo() and you could maybe realize the issue of copying the .text to a tmpfs file and replacing the mapping to the executable with the tmpfs file mapping).

2) getpid() on a child clone returns the process's pid when run with a NPTL-enabled glibc, while it returns the thread pid with a LinuxThreads one; this causes tons of problems with UML, which uses signals as inter-thread and intra-thread communication.

Note UML is not using pthread_create() to create the threads, where this behaviour is an improvement. I'm using a plain clone() call without the CLONE_THREAD flag (which is not even added in by glibc, according to strace).

I've not yet checked if glibc is hijacking getpid() or not, but that would be strange anyway.

Also, this behaviour has been reported the first time about at the time of 2.6.0, but actually UML has almost never runs against NPTL glibc, because it's statically linked most times.

Signature · 2 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
#13 lore raw

Re: Fixing UML against NPTL (was: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2))

Quoted 11 lines · Blaisorblade

2) getpid() on a child clone returns the process's pid when run with a NPTL-enabled glibc, while it returns the thread pid with a LinuxThreads one; this causes tons of problems with UML, which uses signals as inter-thread and intra-thread communication.

Note UML is not using pthread_create() to create the threads, where this behaviour is an improvement. I'm using a plain clone() call without the CLONE_THREAD flag (which is not even added in by glibc, according to strace).

I've not yet checked if glibc is hijacking getpid() or not, but that would be strange anyway.

Glibc caches the PID. If you're going to use clone directly, use the gettid/getpid syscall directly. It's kind of rude that glibc breaks getpid in this way; I recommend filing a bug in the glibc bugzilla at sources.redhat.com.

Signature · 1 line
Daniel Jacobowitz
#14 lore raw

Re: Fixing UML against NPTL (was: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2))

Am Donnerstag, den 11.11.2004, 12:45 -0500 schrieb Daniel Jacobowitz:

Quoted 4 lines

Glibc caches the PID. If you're going to use clone directly, use the gettid/getpid syscall directly. It's kind of rude that glibc breaks getpid in this way; I recommend filing a bug in the glibc bugzilla at sources.redhat.com.

If glibc insists on caching the pid, it could also simply invalidate the pid cache in the clone function.

#15 lore raw

Re: Fixing UML against NPTL (was: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2))

Quoted 6 lines · Christophe Saout

Am Donnerstag, den 11.11.2004, 12:45 -0500 schrieb Daniel Jacobowitz:

Quoted 4 lines

Glibc caches the PID. If you're going to use clone directly, use the gettid/getpid syscall directly. It's kind of rude that glibc breaks getpid in this way; I recommend filing a bug in the glibc bugzilla at sources.redhat.com.

... but, thinking about it, they'll probably close it as INVALID.

Quoted 2 lines

If glibc insists on caching the pid, it could also simply invalidate the pid cache in the clone function.

It currently does this for vfork, but not clone. Basically, you can't call into glibc at all if you use clone. If you aren't using POSIX threads, then the POSIX-compliant library is going to fall to pieces around you. For instance, all the file locking will break, and anything else that, like the PID cache, relies on either global or per-_thread_ data.

Signature · 1 line
Daniel Jacobowitz
#16 lore raw

Re: Fixing UML against NPTL (was: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2))

Quoted 12 lines · Daniel Jacobowitz
Quoted 5 lines · Christophe Saout

Am Donnerstag, den 11.11.2004, 12:45 -0500 schrieb Daniel Jacobowitz:

Quoted 4 lines

Glibc caches the PID. If you're going to use clone directly, use the gettid/getpid syscall directly. It's kind of rude that glibc breaks getpid in this way; I recommend filing a bug in the glibc bugzilla at sources.redhat.com.

... but, thinking about it, they'll probably close it as INVALID.

Quoted 2 lines

If glibc insists on caching the pid, it could also simply invalidate the pid cache in the clone function.

Quoted 6 lines

It currently does this for vfork, but not clone. Basically, you can't call into glibc at all if you use clone. If you aren't using POSIX threads, then the POSIX-compliant library is going to fall to pieces around you. For instance, all the file locking will break, and anything else that, like the PID cache, relies on either global or per-_thread_ data.

Yes, in fact I guess that the problem is for any _thread variable. And as fork() is not a raw syscall, so clone() shouldn't be.

I'll file a bugreport when I have time to do it properly - I don't want to hear that "if I go into dirty things using clone(), I get to keep the pieces and setup a different TLS for the new process"

Signature · 2 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
#17 lore raw
In reply to Chris Wedgwood
Quoted 28 lines · Chris Wedgwood

kill(..., SIGKILL) doesn't work to kill host-OS processes created in the exec path in TT mode --- for this we need PTRACE_KILL (it did work in previous kernels, but not by design). Without this process will accumulate on the host-OS (although the won't be visible inside UML).

---

Yes, there are other fixes along these lines which are needed but one at a time as we test these...

Index: cw-current/arch/um/kernel/tt/exec_user.c
===================================================================

arch/um/kernel/tt/exec_user.c +2 -2
@@ -35,7 +35,8 @@
 		tracer_panic("do_exec failed to get registers - errno = %d",
 			     errno);
 
-	kill(old_pid, SIGKILL);
+	if (ptrace(PTRACE_KILL, old_pid, NULL, NULL))
+		printk("Warning: ptrace(PTRACE_KILL, %d, ...) saw %d\n", errno);
 
 	if(ptrace_setregs(new_pid, regs) < 0)
 		tracer_panic("do_exec failed to start new proc - errno = %d",
 
 
-------------------------------------------------------
Quoted 8 lines

This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Now, there are some patches out there, to fix the problem:
- this one here
- uml-hang-on-2.6.9-host from BlaisorBlade
- patch-fix-uml-hang-on-2.6.9-host to combine the two and add some new stuff

After a discussion on #uml yesterday, I tried to find out, which parts of the patches are really neccessary. Now here are the results:

1) Chris' patch is neccessary to avoid the amassing threads in tt-mode.
2) All parts from BlaisorBlade's patch regarding SKAS are needed to not have SKAS hanging on shutdown. I used the os_kill_ptraced_process() inserted here for Chris' part.
3) The changes done in switch_to_tt() from BlaisorBlades patch are not needed. Thus, my rework of this isn't needed, too.
4) In release_thread_tt() my change has to inserted, else UML doesn't boot on my system.
5) The changes, I did for kill_of_processes_tt and kill_idlers are not needed.
6) I inserted some small changes in kill_of_processes_tt and kill_idlers to have the killing process waiting for the killed one to exit. Not really needed, but cleaner.
7) I saw some zombies not being reaped immediately before the exec() in case of reboot. Thus, I added a small waitpid-loop in tracer(). Also, not needed, but cleaner.

The resulting new patch is attached in a tar-ball. It applies to 2.6.9-bb2, but you have to remove the patch "uml-hang-on-2.6.9-host and add my small series of patches, which also is in the tar-ball. The fix some small problems, let SKAS reboot without problems and add the new SYSEMU_SINGLESTEP-mode (but runs on older hosts also).
Series:
patch-bb1-fix-1
patch-fix-elf_aux
patch-fix-sysemu-tt
patch-fix-reboot-skas
patch-close-all-fds which is the unnamed patch from Jeff, adapted to 2.6.9-bb2 patch-SYSEMU_SINGLESTEP-1
patch-SYSEMU_SINGLESTEP-2
patch-rework-uml-hang-on-2.6.9-host

Regards Bodo