linux-um archives
 help / color / mirror / Atom feed
From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
To: Chris Wedgwood <cw@f00f.org>
Cc: Jeff Dike <jdike@addtoit.com>,
	Blaisorblade <blaisorblade_spam@yahoo.it>,
	user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes
Date: Fri, 19 Nov 2004 17:17:20 +0100	[thread overview]
Message-ID: <419E1C90.70903@fujitsu-siemens.com> (raw)
In-Reply-To: <20041103113736.GA23041@taniwha.stupidest.org>

[-- Attachment #1: Type: text/plain, Size: 3491 bytes --]

Chris Wedgwood wrote:
> 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).
> 
> Signed-off-by: Chris Wedgwood <cw@f00f.org>
> ---
> 
> 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
> ===================================================================
> --- 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 02:12:10.447716745 -0800
> @@ -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
> User-mode-linux-devel@lists.sourceforge.net
> 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

[-- Attachment #2: bb2-addon-bodo.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 7062 bytes --]

      parent reply	other threads:[~2004-11-19 16:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-03 11:37 [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes Chris Wedgwood
2004-11-03 11:47 ` [uml-devel] " Anton Altaparmakov
2004-11-03 12:08   ` [uml-devel] [PATCH] UML: Use PTRACE_KILL instead of SIGKILL to kill host-OS processes (take #2) Chris Wedgwood
2004-11-03 19:28     ` Blaisorblade
2004-11-03 20:09       ` Chris Wedgwood
2004-11-03 22:51         ` Blaisorblade
2004-11-03 20:18       ` Gerd Knorr
2004-11-03 20:48         ` Chris Wedgwood
2004-11-04  0:23           ` Blaisorblade
2004-11-03 23:19         ` Blaisorblade
2004-11-19 16:17 ` Bodo Stroesser [this message]

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=419E1C90.70903@fujitsu-siemens.com \
    --to=bstroesser@fujitsu-siemens.com \
    --cc=blaisorblade_spam@yahoo.it \
    --cc=cw@f00f.org \
    --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