linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Éric Brunet" <ebrunet@quatramaran.ens.fr>
To: linux-kernel@vger.kernel.org
Subject: Re: PATCH(?): linux-2.4.4-pre2: fork should run child first
Date: Tue, 17 Apr 2001 11:15:35 +0200	[thread overview]
Message-ID: <200104170915.LAA00596@quatramaran.ens.fr> (raw)
In-Reply-To: <200104121238.f3CCcZHQ030519@pincoya.inf.utfsm.cl>
In-Reply-To: <200104121238.f3CCcZHQ030519@pincoya.inf.utfsm.cl>

>"Adam J. Richter" <adam@yggdrasil.com> said:
>
>> 	I suppose that running the child first also has a minor
>> advantage for clone() in that it should make programs that spawn lots
>> of threads to do little bits of work behave better on machines with a

There is another issue with this proposition. I have begun to write (free
time, slow pace) an userland sandbox which allows me to prevent a process
and its childs to perform some given actions, like removing files or
writing in some directories. This works by ptrace-ing the process,
modifying system calls and faking return values. It also needs,
obviously, to ptrace-attach childs of the sandboxed process. When the
parent in a fork runs first, the sandbox program has time to
ptrace-attach the child before it does any system call. Obviously, if the
child runs first, this is no longer the case.

If it is decided that the child should run first in a fork, there should
be a way to reliably ptrace-attach it before it can do anything.

By the way, I tried to solve this problem in my sandbox program by
masqerading any fork call into a clone system call with the flag
CLONE_PTRACE. I had hoped that the child would in this way start already
ptraced. However, this didn't work as expected. The child did start in a
ptraced state, but the owner of the trace was its parent (which issued
the fork), and not my sandbox process which was ptracing this parent. I
find that this behaviour is really weird and useless. I could simulate
the current behaviour simply by calling ptrace(TRACE_ME,..) in the child.
What is the real use of the CLONE_PTRACE flag ?

Éric Brunet

  reply	other threads:[~2001-04-17  9:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-12  8:55 PATCH(?): linux-2.4.4-pre2: fork should run child first Adam J. Richter
2001-04-12 12:38 ` Horst von Brand
2001-04-17  9:15   ` Éric Brunet [this message]
2001-04-17 14:26     ` Jesse Pollard
2001-04-17 15:32     ` Éric Brunet
2001-04-13 21:08 ` John Fremlin
2001-04-14  3:53 ` Rik van Riel
2001-04-14  4:40   ` Linus Torvalds
2001-04-14 13:35     ` Rik van Riel
2001-04-12 13:44 Hubertus Franke
2001-04-12 19:15 Adam J. Richter
2001-04-12 19:45 Adam J. Richter
2001-04-13 16:28 Hubertus Franke
2001-04-13 23:51 Adam J. Richter
2001-04-14  1:54 ` John Fremlin
2001-04-14  2:29   ` Linus Torvalds
2001-04-14  2:51     ` Alexander Viro
2001-04-14  2:52     ` Ulrich Drepper
2001-04-14  2:45 Adam J. Richter
2001-04-14  7:58 Adam J. Richter
2001-04-14  8:42 ` Michael O'Reilly
2001-04-14  9:00 ` Linus Torvalds
2001-04-14 15:06   ` Rik van Riel
2001-04-14 16:11 Adam J. Richter

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=200104170915.LAA00596@quatramaran.ens.fr \
    --to=ebrunet@quatramaran.ens.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).