Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 1997 11:01:32 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        gurney_j@resnet.uoregon.edu
Cc:        terry@lambert.org, freebsd-hackers@FreeBSD.ORG
Subject:   Re: problem with /dev/zero and mmap??
Message-ID:  <199706241801.LAA03662@phaeton.artisoft.com>
In-Reply-To: <19970623145542.29255@hydrogen.nike.efn.org> from "John-Mark Gurney" at Jun 23, 97 02:55:42 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706241801.LAA03662>