From owner-freebsd-hackers Tue Jun 24 11:13:21 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id LAA28400 for hackers-outgoing; Tue, 24 Jun 1997 11:13:21 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id LAA28393 for ; Tue, 24 Jun 1997 11:13:17 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA03662; Tue, 24 Jun 1997 11:01:33 -0700 From: Terry Lambert Message-Id: <199706241801.LAA03662@phaeton.artisoft.com> Subject: Re: problem with /dev/zero and mmap?? To: gurney_j@resnet.uoregon.edu Date: Tue, 24 Jun 1997 11:01:32 -0700 (MST) Cc: terry@lambert.org, freebsd-hackers@FreeBSD.ORG In-Reply-To: <19970623145542.29255@hydrogen.nike.efn.org> from "John-Mark Gurney" at Jun 23, 97 02:55:42 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > The write succeeds because pages you mapped are not associated with > > the fd after the mapping. > > no.. the write succeeds because the permission checking isn't done > early enough in the mapping process... didn't you look at the code > I sited?? I did. You want the pages to be read-only so you get a write fault? Or you want the mapping to fail? The flags PROT_WRITE and MAP_SHARED only require an EACCES response when the fd is not open for writing and they are used in combination. The question I have is whether MAP_SHARED is meaningful for anonymous pages mapped from /dev/zero. I don't think it is. The next question I have for you is "isn't it acceptable to you for the option to be ignored rather than uselessly enforced against?". > > 2) The mmap() would fail because of the conflict between > > O_RDONLY and PROT_WRITE. > > yes.. this second one is what I want... you specificly opened the > file for read only access.. and that is what you should get... the > permissions on /dev/zero permit you to open it read/write so why > don't you?? It's not a file, it's a device. The rules are permitted to vary, per device. Unless you want MAP_SHARED to result in you being able to change the "contents" of /dev/zero for everyone else, then it is being ignored. Your complaint seems to stem from your belief that it's being ignored in the wrong place. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.