mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 3/X] ptrace: introduce the empty "struct ptrace_task"
Date: Tue, 26 May 2009 13:48:46 -0700 (PDT)	[thread overview]
Message-ID: <20090526204846.898CCFC2BD@magilla.sf.frob.com> (raw)
In-Reply-To: Oleg Nesterov's message of  Monday, 25 May 2009 02:00:01 +0200 <20090525000001.GA2218@redhat.com>

>  /**
> + * tracehook_init_task - initialize the new child
> + * @child:		new child task

s/child/task/

> + * @clone_flags:	%CLONE_* flags from clone/fork/vfork system call
> + * @trace:		return value from tracehook_prepare_clone()
> + *
> + * This is called immediately after dup_task_struct().

    * It must clear/reset any tracing state so that tracehook_free_task()
    * will work safely if the task creation fails.  If the task creation 
    * succeeds, a tracehook_finish_clone() call will follow with locks
    * held, before @task starts or is accessible to anyone else.

> +int alloc_ptrace_task(struct task_struct *tsk)

This deserves a short comment about the context it's called from,
and when it is or isn't called at all.

> +	if (cmpxchg(&tsk->ptrace_task, NULL, ptrace_task) != NULL)
> +		kfree(ptrace_task);

I don't see cmpxchg() used very often at all in generic kernel code.  I
wonder how good a choice it is across every arch.  Is there a reason not to
use e.g. task_lock() to mediate installing a new ->ptrace_task pointer?
That seems like a more conservative route.


Thanks,
Roland

      parent reply	other threads:[~2009-05-26 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25  0:00 Oleg Nesterov
2009-05-25  3:30 ` Ingo Molnar
2009-05-25 15:50   ` Oleg Nesterov
2009-05-26 20:33   ` Roland McGrath
2009-05-26 20:48 ` Roland McGrath [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=20090526204846.898CCFC2BD@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    /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

all inboxes | Powered by JetHome®