From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263201AbTDGCi6 (for ); Sun, 6 Apr 2003 22:38:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263202AbTDGCi6 (for ); Sun, 6 Apr 2003 22:38:58 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:60548 "EHLO fgwmail7.fujitsu.co.jp") by vger.kernel.org with ESMTP id S263201AbTDGCiw (for ); Sun, 6 Apr 2003 22:38:52 -0400 Date: Mon, 07 Apr 2003 11:50:19 +0900 From: Tachino Nobuhiro Subject: ptrace fix changes output of ps ax To: linux-kernel@vger.kernel.org Message-id: <4r5b81hw.wl@nisaaru.dvs.cs.fujitsu.co.jp> MIME-version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-type: text/plain; charset=US-ASCII User-Agent: Wanderlust/2.8.1 (Something) SEMI/1.14.5 (Awara-Onsen) CLIME/1.14.5 (=?ISO-2022-JP?B?GyRCS1w7ezBmGyhC?=) APEL/10.4 Emacs/21.2 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hello, After 2.4.21-pre6, I found "ps ax" displays some processes as the process names which are embraced with square brackets like these. 1115 ? S 0:00 [httpd] 1478 ? S 0:00 [atd] It is because proc_pid_cmdline() calls access_process_vm() and it fails. The patch below fixes the problem. With this patch, access_process_vm() do not reject requests if the access is read only. I'm not certain this is right fix, but at least I confirmed isec-ptrace-kmot-exploit cannot get root privilege with this patch. Please comment. diff -Nur linux-2.4.org/kernel/ptrace.c linux-2.4/kernel/ptrace.c --- linux-2.4.org/kernel/ptrace.c 2003-03-28 15:59:15.000000000 +0900 +++ linux-2.4/kernel/ptrace.c 2003-04-03 16:04:32.000000000 +0900 @@ -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)) && write) mm = NULL; if (mm) atomic_inc(&mm->mm_users);