From: Russell King <rmk@arm.linux.org.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: 2.4+ptrace exploit fix breaks root's ability to strace
Date: Sat, 22 Mar 2003 14:10:06 +0000 [thread overview]
Message-ID: <20030322141006.A8159@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1048345130.8912.9.camel@irongate.swansea.linux.org.uk>; from alan@lxorguk.ukuu.org.uk on Sat, Mar 22, 2003 at 02:58:51PM +0000
On Sat, Mar 22, 2003 at 02:58:51PM +0000, Alan Cox wrote:
> On Sat, 2003-03-22 at 10:31, Russell King wrote:
> > Are the authors of the ptrace patch aware that, in addition to closing the
> > hole, the "fix" also prevents a ptrace-capable task (eg, strace started by
> > root) from ptracing user threads?
> >
> > For example, you can't strace vsftpd processes started from xinetd.
> >
> > Is this intended behaviour?
>
> Its an unintended side effect, nobody has sent a patch to fix it yet.
How about this fix? PT_PTRACE_CAP is set when we attach to a process
and the process doing the attaching has the ptrace capability.
Note that this patch is against the 2.4.19 version of ptrace.c with the
2.4.20 ptrace patch applied.
--- orig/kernel/ptrace.c Wed Mar 19 15:54:45 2003
+++ linux/kernel/ptrace.c Sat Mar 22 10:14:01 2003
@@ -22,7 +22,7 @@
int ptrace_check_attach(struct task_struct *child, int kill)
{
mb();
- if (!is_dumpable(child))
+ if (!is_dumpable(child) && !(child->ptrace & PT_PTRACE_CAP))
return -EPERM;
if (!(child->ptrace & PT_PTRACED))
@@ -140,7 +140,7 @@
/* Worry about races with exit() */
task_lock(tsk);
mm = tsk->mm;
- if (!is_dumpable(tsk) || (&init_mm == mm))
+ if ((!is_dumpable(tsk) || (&init_mm == mm)) && !(tsk->ptrace & PT_PTRACE_CAP))
mm = NULL;
if (mm)
atomic_inc(&mm->mm_users);
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
next prev parent reply other threads:[~2003-03-22 13:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-22 10:31 2.4+ptrace exploit fix breaks root's ability to strace Russell King
2003-03-22 14:58 ` Alan Cox
2003-03-22 14:10 ` Russell King [this message]
2003-03-22 15:28 ` Arjan van de Ven
2003-03-22 17:13 ` Russell King
2003-03-22 17:28 ` Arjan van de Ven
2003-03-22 19:09 ` Alan Cox
2003-03-22 18:01 ` Russell King
2003-03-23 10:31 ` Lists (lst)
2003-03-23 10:38 ` Russell King
2003-03-23 11:11 ` Martin Loschwitz
2003-03-23 10:43 ` Arjan van de Ven
-- strict thread matches above, loose matches on Subject: below --
2003-04-17 5:46 Yusuf Wilajati Purna
2003-04-19 5:57 ` Bernhard Kaindl
2003-04-22 5:03 ` Yusuf Wilajati Purna
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=20030322141006.A8159@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=alan@lxorguk.ukuu.org.uk \
--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