[PATCH][2.4-rc1] fix side effects of the kmod/ptrace secfix

Bernhard Kaindl (kaindl@telering.at)
Fri, 25 Apr 2003 12:40:24 +0200


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-6761-1051270687-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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.)
--=_courier-6761-1051270687-0001-2
Content-Type: text/plain; charset=us-ascii; name="ptrace-cleanup-1.diff"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.53.0304251240240.2582@hase.a11.local>
Content-Description:
Content-Disposition: attachment; filename="ptrace-cleanup-1.diff"

LS0tIGtlcm5lbC9wdHJhY2UuYwkyMDAzLzA0LzIyIDIxOjE0OjIwCTEuMQ0K
KysrIGtlcm5lbC9wdHJhY2UuYwkyMDAzLzA0LzI1IDA2OjIxOjE2CTEuMw0K
QEAgLTIxLDkgKzIxLDYgQEANCiA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