Re: mmap and PROT_WRITE

2002-02-14 Thread Andrew Gallatin


Jason Mawdsley writes:
 > Why can't I write to memory in the first case?
 > 
 > Is there anyway I can implement writable but no readable memory?
 > 
 > I read some where that there is no true write only memory do to the
 > limitations of x86.

I think you must have read correctly -- your sample code runs fine (both
cases) on FreeBSD/alpha.  The same test program dumps core on
FreeBSD/i386

Cheers,

Drew

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: mmap and PROT_WRITE

2002-02-14 Thread Terry Lambert

Jason Mawdsley wrote:

[ ... trying to distinguish between PROT_WRITE and PROT_READ|PROT_WRITE ... ]

> Why can't I write to memory in the first case?
> 
> Is there anyway I can implement writable but no readable memory?

Yes.

Use hardware manufactured by a vendor other than Intel, and
which can support it.

> I read some where that there is no true write only memory do to the
> limitations of x86.

Yes.  And on 386, there's no write protection against
protected mode writes at all, so you have to do dirty
tricks to keep people from doing a "read" into a kernel
address space in order to have the kernel.  It's one of
the reasons (besides /dev/slow^Wrandom) that the 386 is
no longer supported in the GENERIC kernel.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



mmap and PROT_WRITE

2002-02-14 Thread Jason Mawdsley

 {
void * p = mmap( 0, 1024, PROT_WRITE, MAP_ANON, -1, 0 );

if ( p )
{
/*
 * pukes and dies
 * *((int*)(p)) = 5;
 */
}
}

{
void * p = mmap( 0, 1024, PROT_WRITE | PROT_READ, MAP_ANON, -1, 0 );

if ( p )
{
*((int*)(p)) = 5;
}
}
Why can't I write to memory in the first case?

Is there anyway I can implement writable but no readable memory?

I read some where that there is no true write only memory do to the
limitations of x86.

TIA

Jason Mawdsley ~ [EMAIL PROTECTED]
Software Designer ~ m_ a c a d a m i a nt e c h n o l o g i e s

"Software experts for the world's leading technology companies."
http://www.macadamian.com

Because software development cycles should not end in tragedy.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message