NetBSD Problem Report #13241

Received: (qmail 26814 invoked from network); 18 Jun 2001 21:26:56 -0000
Message-Id: <200106182135.f5ILZVi07625@clone.itdl.ds.boeing.com>
Date: Mon, 18 Jun 2001 14:35:31 -0700 (PDT)
From: cliff.wright@boeing.com
Reply-To: cliff.wright@boeing.com
To: gnats-bugs@gnats.netbsd.org
Subject: mmap problem on Sparcstation 2
X-Send-Pr-Version: 3.95

>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 21:29:00 +0000 2001
>Closed-Date:    
>Last-Modified:  Tue Jun 19 00:26:00 +0000 2001
>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:

From: Cliff Wright <cliff@vixen.itdl.ds.boeing.com>
To: gnats-bugs@netbsd.org
Cc:  
Subject: Re: port-sparc/13241
Date: Mon, 18 Jun 2001 17:27:40 -0700

 Looking further into this I see that kern/init_main.c uses a hard coded value 
 for the maximum virtual address(VM_MAX_ADDRESS). This value it set in 
 arch/sparc/include/vmparam.h. So to have different values depending on sparc 
 architecture would require a change to the machine independent code. Otherwise 
 a compile of the kernel to the specific architecture with an ifdef in param.h, 
 or a GENERIC that limits non sun4c to the sun4c virtual address limit. None of 
 these sound all that great to me. Maybe a smarter uvm_map_findspace(in 
 uvm/uvm_map.c), this is where the range check is done.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.