/[linux-patches]/genpatches-2.6/trunk/2.6.14/1005_2_ptrace-self-attach.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1005_2_ptrace-self-attach.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 208 - (show annotations) (download) (as text)
Fri Nov 11 11:24:33 2005 UTC (15 years ago) by dsd
File MIME type: text/x-diff
File size: 822 byte(s)
Linux 2.6.14.2
1 From torvalds@osdl.org Wed Nov 9 12:04:07 2005
2 Date: Wed, 9 Nov 2005 11:37:57 -0800 (PST)
3 From: Linus Torvalds <torvalds@osdl.org>
4 Subject: Fix ptrace self-attach rule
5
6 Before we did CLONE_THREAD, the way to check whether we were attaching
7 to ourselves was to just check "current == task", but with CLONE_THREAD
8 we should check that the thread group ID matches instead.
9
10 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
11 ---
12 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
13 index 5b8dd98..b88d418 100644
14 --- a/kernel/ptrace.c
15 +++ b/kernel/ptrace.c
16 @@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *ta
17 retval = -EPERM;
18 if (task->pid <= 1)
19 goto bad;
20 - if (task == current)
21 + if (task->tgid == current->tgid)
22 goto bad;
23 /* the same process cannot be attached many times */
24 if (task->ptrace & PT_PTRACED)
25

  ViewVC Help
Powered by ViewVC 1.1.20