Subject: port-sparc/13241: mmap problem on Sparcstation 2
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cliff.wright@boeing.com>
List: netbsd-bugs
Date: 06/18/2001 14:35:31
>Number: 13241
>Category: port-sparc
>Synopsis: mmap returns no error, when not mapping on a Sparcstation 2
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-sparc-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 18 14:29:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Cliff Wright
>Release: NetBSD 1.5
>Organization:
>Environment:
System: NetBSD clone 1.5 NetBSD 1.5 (GENERIC) #1: Wed Nov 29 00:29:52 MET 2000 root@flambard:/usr/src/sys/arch/sparc/compile/GENERIC sparc
>Description:
Mozilla .9 was seg faulting on my Sparcstation 2.
This was due to mmap being used with a large supplied virtual address
hint, rather than 0 for auto select virtual address,
and returning success when it did not useably mmap.
Code that produces the error follows.
I was told that on the sun4c architecture the MMU's can not access
addresses in the range 0x1fffffff through 0xe0000000.
However then I believe mmap should either select a useable address,
as the supplied address is only a hint, or should return
an error. Returning a successful mmap when it was not successful
seems wrong to me.
Test code that duplicates Mozilla error:
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
main()
{
int fdz;
void *rv;
int prot;
char *vaddr = (char*) 0x50000000;
fdz = open("/dev/zero",O_RDWR , 0);
prot = PROT_READ|PROT_WRITE;
rv = mmap(vaddr, 65536L, prot, MAP_PRIVATE, fdz, 0);
printf("rv = 0x%0x\n", rv);
memset(rv, 0, 216);
}
>How-To-Repeat:
>Fix:
I fixed the Mozilla problem by changing
_PR_STACK_VMBASE 0x50000000 to
_PR_STACK_VMBASE 0 (i.e. auto select virtual address) in
nsprpub/pr/include/md/_netbsd.h
>Release-Note:
>Audit-Trail:
>Unformatted: