linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Kaindl <kaindl@telering.at>
To: Andreas Gietl <Listen@e-admin.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH][2.4-rc1] fix side effects of the kmod/ptrace secfix
Date: Fri, 25 Apr 2003 12:40:24 +0200	[thread overview]
Message-ID: <Pine.LNX.4.53.0304251215200.2582@hase.a11.local> (raw)
In-Reply-To: <200304250037.45133.Listen@e-admin.de>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1295 bytes --]

On Fri, 25 Apr 2003, Andreas Gietl wrote:
> > system monitoring stuff this way(I've even heard shutdown is affected)
>
> i can confirm that shutdown (halt|reboot) does not work on my 2.4.21-rc1-ac1
> boxes. (gentoo + redhat).

Thanks for the info!

> But your patch does not seem to fix it.

Very interesting also, the two liner adressed only the well-known problems.
To fix the other not so well-known side effects, a real cleanup is the way
to go.

Can you try the attached cleanup patch instead of the two-liner?

It's an inital cleanup and should fix the other side effects which
I described in my mails.

Bernhard Kaindl

PS: If either patch is applied correctly, this

	su guest -c 'ps $PPID;wc -m </proc/$PPID/cmdline'

should give:

  PID TTY      STAT   TIME COMMAND
 2452 pts/2    S      0:00 su bin -c ps $PPID;wc -m </proc/$PPID/cmdline
     46

If it does not, access_process_vm is not fixed properly.

Second, calling this as root:

	strace -fewrite su -c /bin/echo 2>&1 | grep pid

should give:

[pid  2599] --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
[pid  2599] write(1, "\n", 1

If it does not, ptrace_check_attach is not fixed properly.

(These are only the checks for the well known side
effects which should be fixed even with the short
is_dumpable() -> task_dumpable patch.)

[-- Attachment #2: Type: TEXT/PLAIN, Size: 895 bytes --]

--- kernel/ptrace.c	2003/04/22 21:14:20	1.1
+++ kernel/ptrace.c	2003/04/25 06:21:16	1.3
@@ -21,9 +21,6 @@
  */
 int ptrace_check_attach(struct task_struct *child, int kill)
 {
-	mb();
-	if (!is_dumpable(child))
-		return -EPERM;
 
 	if (!(child->ptrace & PT_PTRACED))
 		return -ESRCH;
@@ -127,8 +124,6 @@ int access_process_vm(struct task_struct
 	/* Worry about races with exit() */
 	task_lock(tsk);
 	mm = tsk->mm;
-	if (!is_dumpable(tsk) || (&init_mm == mm))
-		mm = NULL;
 	if (mm)
 		atomic_inc(&mm->mm_users);
 	task_unlock(tsk);
--- kernel/sys.c	2003/04/25 06:23:15	1.1
+++ kernel/sys.c	2003/04/25 06:23:51
@@ -1252,8 +1252,7 @@ asmlinkage long sys_prctl(int option, un
 				error = -EINVAL;
 				break;
 			}
-			if (is_dumpable(current))
-				current->mm->dumpable = arg2;
+			current->mm->dumpable = arg2;
 			break;
 
 	        case PR_SET_UNALIGN:

  reply	other threads:[~2003-04-25 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-24 22:37 [PATCH][2.4+ptrace] fix side effects of the kmod/ptrace secfix Andreas Gietl
2003-04-25 10:40 ` Bernhard Kaindl [this message]
2003-04-25 14:40   ` [PATCH][2.4-rc1] " Andreas Gietl
2003-04-25 14:30     ` Bernhard Kaindl
2003-04-26 16:58       ` Andreas Gietl

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=Pine.LNX.4.53.0304251215200.2582@hase.a11.local \
    --to=kaindl@telering.at \
    --cc=Listen@e-admin.de \
    --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).