* can read/write to mprotect(PROT_NONE) region with 2.6.14 on au1550
@ 2005-12-07 21:51 Clem Taylor
2006-02-02 16:54 ` Ralf Baechle
0 siblings, 1 reply; 3+ messages in thread
From: Clem Taylor @ 2005-12-07 21:51 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
Hi,
I was trying to use mprotect(PROT_NONE) to help debug a problem, and
it seems that mprotect() isn't actually doing anything with my 2.6.14
linux-mips kernel on an au1550. Attached is a simple test program that
segfaults as expected on x86 (2.6.12), but does not segfault on mips
(2.6.14). I can both read and write PROT_NONE memory without problem,
which should result in a segfault. Originally, I was trying to
mprotect() a mmaped GFP_DMA region which wasn't working and then I
tried a simpler test that also wasn't working.
Shouldn't mprotect() work? Could I be missing a config option, or is
this just broken?
Thanks,
Clem Taylor
[-- Attachment #2: mprotectTest.c --]
[-- Type: text/x-csrc, Size: 1064 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
int main ( int argc, char *argv [ ] )
{
int size = 65536, i, ret;
unsigned char *buffer;
buffer = memalign ( size, size );
if ( buffer == NULL )
{
fprintf ( stderr, "memalign() failed.\n" );
return 1;
}
fprintf ( stderr, "buffer=%p size=%d\n", buffer, size );
/* write and read buffer */
memset ( buffer, 0xAA, size );
for ( i = 0; i < 2; i++ )
fprintf ( stderr, "buffer [ %d ] = 0x%02X\n", i, buffer [ i ] );
/* disable reading and writing */
ret = mprotect ( buffer, size, PROT_NONE );
if ( ret != 0 )
{
fprintf ( stderr, "mprotect(%p,%d,PROT_NONE) failed: %s\n",
buffer, size, strerror ( errno ) );
return 1;
}
/* write and read buffer, should segfault */
memset ( buffer, 0x55, size );
for ( i = 0; i < 2; i++ )
fprintf ( stderr, "buffer [ %d ] = 0x%02X\n", i, buffer [ i ] );
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: can read/write to mprotect(PROT_NONE) region with 2.6.14 on au1550
2005-12-07 21:51 can read/write to mprotect(PROT_NONE) region with 2.6.14 on au1550 Clem Taylor
@ 2006-02-02 16:54 ` Ralf Baechle
2006-04-07 23:09 ` [PATCH] FIx mprotect() syscall for MIPS32 w/36-bit physical address support Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2006-02-02 16:54 UTC (permalink / raw)
To: Clem Taylor; +Cc: linux-mips
On Wed, Dec 07, 2005 at 04:51:23PM -0500, Clem Taylor wrote:
> I was trying to use mprotect(PROT_NONE) to help debug a problem, and
> it seems that mprotect() isn't actually doing anything with my 2.6.14
> linux-mips kernel on an au1550. Attached is a simple test program that
> segfaults as expected on x86 (2.6.12), but does not segfault on mips
> (2.6.14). I can both read and write PROT_NONE memory without problem,
> which should result in a segfault. Originally, I was trying to
> mprotect() a mmaped GFP_DMA region which wasn't working and then I
> tried a simpler test that also wasn't working.
>
> Shouldn't mprotect() work? Could I be missing a config option, or is
> this just broken?
That's a defect in CONFIG_64BIT_PHYS_ADDR which unfortunately is need
on Alchemy SOCs due to the silly address space layout.
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-07 23:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-07 21:51 can read/write to mprotect(PROT_NONE) region with 2.6.14 on au1550 Clem Taylor
2006-02-02 16:54 ` Ralf Baechle
2006-04-07 23:09 ` [PATCH] FIx mprotect() syscall for MIPS32 w/36-bit physical address support Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox