From owner-freebsd-stable Sun Mar 22 06:47:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA07020 for freebsd-stable-outgoing; Sun, 22 Mar 1998 06:47:19 -0800 (PST) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from whqvax.picker.com (whqvax.picker.com [144.54.1.1]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id GAA07005; Sun, 22 Mar 1998 06:47:14 -0800 (PST) (envelope-from rhh@ct.picker.com) Received: from ct.picker.com by whqvax.picker.com with SMTP; Sun, 22 Mar 1998 9:45:04 -0500 (EST) Received: from elmer.ct.picker.com by ct.picker.com (4.1/SMI-4.1) id AA23090; Sun, 22 Mar 98 09:45:02 EST Received: by elmer.ct.picker.com (SMI-8.6/SMI-SVR4) id JAA12578; Sun, 22 Mar 1998 09:44:36 -0500 Message-Id: <19980322094436.65505@ct.picker.com> Date: Sun, 22 Mar 1998 09:44:36 -0500 From: Randall Hopper To: Bruce Evans , Joao Carlos Mendes Luis , Amancio Hasty Cc: multimedia@FreeBSD.ORG, stable@FreeBSD.ORG Subject: Re: Fxtv vs Stable Mail-Followup-To: Bruce Evans , Joao Carlos Mendes Luis , Amancio Hasty , multimedia@freebsd.org, stable@FreeBSD.ORG References: <199803220221.NAA18775@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1i In-Reply-To: <199803220221.NAA18775@godzilla.zeta.org.au>; from Bruce Evans on Sun, Mar 22, 1998 at 01:21:39PM +1100 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk Joao Carlos Mendes Luis: |#define quoting(Randall Hopper) |// 1) Comment out the "|PROT_WRITE" in: |// |// c->drv_buf = (TV_UINT8 *) mmap( (caddr_t)0, MAX_MMAP_BUF_SIZE, |// PROT_READ|PROT_WRITE, 0, c->fd, (off_t)0 ); | |Well, if you intend to mmap with PROT_WRITE, why do you open the device |with O_RDONLY ? :) Capture buffer access was originally read-only. When I needed to clear the buffer, I only had to add write on the mmap. I forgot about the open(), and the kernel was fine with the old, so it never got changed. Conceptually, I guess mmap() access now overrides open(). Though like you, seems to me mmap() allowable access probably should be a subset, for read & write at least. Maybe that should apply to PROT_EXEC as well. Thoughts? Wouldn't this also obviate the need for having any special mmap() IS-ROOT? checks for PROT_WRITE access? It does seem a little odd that an app can write to an mmaped buffer related to a device file they don't have write access to. At any rate, in this particular case we should pursue have the driver clear the buffer, so client apps only need to mmap PROT_READ/MAP_SHARED, and open the device O_RDONLY. Randall To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message