mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Norbert Kiesel <nk@iname.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH consolidate sys_ptrace
Date: Tue, 01 Nov 2005 01:51:51 -0800	[thread overview]
Message-ID: <pan.2005.11.01.09.51.40.860720@iname.com> (raw)
In-Reply-To: <20051101051221.GA26017@lst.de>

On Tue, 01 Nov 2005 06:12:21 +0100, Christoph Hellwig wrote:

<snip>

> Index: linux-2.6/kernel/ptrace.c
> ===================================================================
> --- linux-2.6.orig/kernel/ptrace.c	2005-10-31 13:15:52.000000000 +0100
> +++ linux-2.6/kernel/ptrace.c	2005-10-31 17:30:43.000000000 +0100
> @@ -406,3 +406,85 @@
>  
>  	return ret;
>  }
> +
> +#ifndef __ARCH_SYS_PTRACE
> +static int ptrace_get_task_struct(long request, long pid,
> +		struct task_struct **childp)
> +{
> +	struct task_struct *child;
> +	int ret;
This "ret" is basically unused and should go away

> +
> +	/*
> +	 * Callers use child == NULL as an indication to exit early even
> +	 * when the return value is 0, so make sure it is non-NULL here.
> +	 */
> +	*childp = NULL;
> +
> +	if (request == PTRACE_TRACEME) {
> +		/*
> +		 * Are we already being traced?
> +		 */
> +		if (current->ptrace & PT_PTRACED)
> +			return -EPERM;
> +		ret = security_ptrace(current->parent, current);
> +		if (ret)
	if (security_ptrace(current->parent, current))

> +			return -EPERM;
> +		/*
> +		 * Set the ptrace bit in the process ptrace flags.
> +		 */
> +		current->ptrace |= PT_PTRACED;
> +		return 0;
> +	}
> +
> +	/*
> +	 * You may not mess with init
> +	 */
> +	if (pid == 1)
> +		return -EPERM;
> +
> +	ret = -ESRCH;
Not needed (anymore)

> +	read_lock(&tasklist_lock);
> +	child = find_task_by_pid(pid);
> +	if (child)
> +		get_task_struct(child);
> +	read_unlock(&tasklist_lock);
> +	if (!child)
> +		return -ESRCH;
> +
> +	*childp = child;
> +	return 0;
> +}
> +


Best,
  Norbert



  reply	other threads:[~2005-11-01 10:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01  5:09 Christoph Hellwig
2005-11-01  5:12 ` Christoph Hellwig
2005-11-01  9:51   ` Norbert Kiesel [this message]
2005-11-01  9:58   ` Paul Mackerras
2005-11-01 10:30   ` Ralf Baechle
2005-11-01 18:12   ` Russell King
2005-11-02 11:21   ` Paul Mundt
2005-11-01 11:37 ` David Howells
2005-11-02  4:31   ` Andrew Morton
2005-11-11 20:45     ` Blaisorblade
2005-11-05  0:19   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2005-08-10 16:59 [PATCH] " Luck, Tony
2005-08-11  0:20 ` Stephen Rothwell
2005-08-10  8:00 Christoph Hellwig
2005-08-10  8:33 ` Martin Schwidefsky
2005-08-10  8:38   ` Christoph Hellwig
2005-08-10  8:43 ` Andi Kleen
2005-08-10  9:36 ` David Howells
2005-08-10 12:46 ` Paul Mundt
2005-08-10 13:15 ` Ralf Baechle
2005-08-10 13:28 ` Jeff Dike
2005-08-10 17:08 ` Richard Henderson
2005-08-11 10:44 ` Roman Zippel
2005-08-11 13:51   ` Christoph Hellwig
2005-08-11 16:51 ` Russell King
2005-08-11 17:32 ` Richard Henderson
2005-08-11 17:33   ` Christoph Hellwig

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=pan.2005.11.01.09.51.40.860720@iname.com \
    --to=nk@iname.com \
    --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

Powered by JetHome