From owner-freebsd-commit Mon Dec 25 18:27:12 1995 Return-Path: owner-commit Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA12618 for freebsd-commit-outgoing; Mon, 25 Dec 1995 18:27:12 -0800 (PST) Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA12606 for cvs-all-outgoing; Mon, 25 Dec 1995 18:27:00 -0800 (PST) Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA12596 for cvs-sys-outgoing; Mon, 25 Dec 1995 18:26:57 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id SAA12591 Mon, 25 Dec 1995 18:26:48 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id NAA14941; Tue, 26 Dec 1995 13:22:49 +1100 Date: Tue, 26 Dec 1995 13:22:49 +1100 From: Bruce Evans Message-Id: <199512260222.NAA14941@godzilla.zeta.org.au> To: bde@freefall.freebsd.org, davidg@Root.COM Subject: Re: cvs commit: src/sys/kern subr_prof.c Cc: CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org Sender: owner-commit@FreeBSD.ORG Precedence: bulk >> efficiency is recovered. However, addupc() may be broken on plain >> i386's since it doesn't check for write permission like copyout(). > Are you going to fix this? By replacing the use of it with addupc_task? I wasn't sure that it's actually broken. The profile buffer could be validated in profil() (it should be in user space and writable). Then I think it could only be invalidated by a weird mmap() that makes it readonly. However, no up front validation is done. pr_size could be 4G. The whole NetBSD implementation should be copied but that's more than I want to do right now. BTW, I'd like to be able to statistically profile processes that don't have profiling built into them. The interface should be like ktrace's. The main difficulty is mapping in the profiling buffer for another process. The addupc_intr()/addupc_task() interface should be able to handle this (slowly) simply by switching to the other process. However, the process arg to these functions is bogus - these functions call copyout() and other functions that only work if p == curproc. Bruce