From owner-freebsd-audit@FreeBSD.ORG Fri Oct 24 00:26:26 2003 Return-Path: Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 391F516A4B3 for ; Fri, 24 Oct 2003 00:26:26 -0700 (PDT) Received: from is1.mh.itc.u-tokyo.ac.jp (is1.mh.itc.u-tokyo.ac.jp [133.11.205.11]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B1A743FDD for ; Fri, 24 Oct 2003 00:26:23 -0700 (PDT) (envelope-from simokawa@sat.t.u-tokyo.ac.jp) Received: from is1.mh.itc.u-tokyo.ac.jp (is1.mh.itc.u-tokyo.ac.jp [127.0.0.1]) by is1.mh.itc.u-tokyo.ac.jp (Postfix) with ESMTP id 7D0EB21841C for ; Fri, 24 Oct 2003 16:26:21 +0900 (JST) Received: from mailhosting.itc.u-tokyo.ac.jp (IDENT:mirapoint@mailhosting.itc.u-tokyo.ac.jp [133.11.205.3]) h9O7QLSs013898 for ; Fri, 24 Oct 2003 16:26:21 +0900 Received: from ett.sat.t.u-tokyo.ac.jp (ett.sat.t.u-tokyo.ac.jp [133.11.135.3])3.3.5-GR) with ESMTP id ALC88292; Fri, 24 Oct 2003 16:26:20 +0900 (JST) Date: Fri, 24 Oct 2003 16:26:20 +0900 Message-ID: From: Hidetoshi Shimokawa To: audit@freebsd.org User-Agent: Wanderlust/2.11.0 (Wonderwall) REMI/1.14.3 (Matsudai) FLIM/1.14.3 (=?ISO-8859-1?Q?Unebigory=F2mae?=) APEL/10.3 MULE XEmacs/21.4 (patch 8) (Honest Recruiter) (i386--freebsd) X-Face: OE([KxWyJI0r[R~S/>7ia}SJ)i%a,$-9%7{*yihQk|]gl}2p#"oXmX/fT}Bn7: #j7i14gu$jgR\S*&C3R/pJX List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2003 07:26:26 -0000 Hi, Does anyone object to committing this patch to the tree? This patch allows kvm_open() to open any raw devices as a crush dump. This enables us to use /dev/fwmem* as a core file. (at least for i386 with hw.firewire.fwmem.eui64_hi/lo) e.g. ps -M /dev/fwmem0.0 -N kernel.debug dmesg -M /dev/fwmem0.0 -N kernel.debug gdb -k -c /dev/fwmem0.0 kernel.debug My concern is setu(g)ided command which is linked with libkvm. As far as I checked, there are only commands setgided with kmem, and the group kmem is allowed to access only /dev/mem and /dev/kmem for default installation. --- //depot/vendor/freebsd/src/lib/libkvm/kvm.c 2003/07/31 16:38:08 +++ //depot/user/simokawa/firewire/lib/libkvm/kvm.c 2003/10/08 09:29:09 @@ -192,11 +192,8 @@ */ if (strcmp(mf, _PATH_DEVNULL) == 0) { kd->vmfd = open(_PATH_DEVNULL, O_RDONLY); - } else if (strcmp(mf, _PATH_MEM) != 0) { - _kvm_err(kd, kd->program, - "%s: not physical memory device", mf); - goto failed; - } else { + return (kd); + } else if (strcmp(mf, _PATH_MEM) == 0) { if ((kd->vmfd = open(_PATH_KMEM, flag)) < 0) { _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; @@ -205,24 +202,24 @@ _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; } + return (kd); } - } else { - /* - * This is a crash dump. - * Initialize the virtual address translation machinery, - * but first setup the namelist fd. - */ - if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { - _kvm_syserr(kd, kd->program, "%s", uf); - goto failed; - } - if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) { - _kvm_syserr(kd, kd->program, "%s", uf); - goto failed; - } - if (_kvm_initvtop(kd) < 0) - goto failed; + } + /* + * This is a crash dump. + * Initialize the virtual address translation machinery, + * but first setup the namelist fd. + */ + if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { + _kvm_syserr(kd, kd->program, "%s", uf); + goto failed; + } + if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) { + _kvm_syserr(kd, kd->program, "%s", uf); + goto failed; } + if (_kvm_initvtop(kd) < 0) + goto failed; return (kd); failed: /* /\ Hidetoshi Shimokawa \/ simokawa@sat.t.u-tokyo.ac.jp PGP public key: http://www.sat.t.u-tokyo.ac.jp/~simokawa/pgp.html