[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: mmap on emulated i386
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2013-09-18 6:15:54
Message-ID: 20130918061554.GV41229 () kib ! kiev ! ua
[Download RAW message or body]


On Tue, Sep 17, 2013 at 07:01:16PM -0700, Rui Paulo wrote:
> Hi,
> 
> I'm trying to figure out why the following fails when compiled on amd64 with -m32:
> 
> 	mmap(NULL, 0x70000, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
> 
> It returns EINVAL. I looked around everywhere but I couldn't find where the EINVAL \
> is coming from. The length argument doesn't really make any difference. At this \
> point I'm thinking it's a bug...

What is the version of your system, including the userspace ? -m32 only
works on HEAD.  Do you have r255657/r255658 in your kernel ?

Please provide kdump of the ktraced execution of your test program, as
well as the test program itself.

N.B. The following worked fine for me, both in 64 and 32 bit binary.

#include <sys/mman.h>
#include <err.h>
#include <stdlib.h>

int
main(void)
{
	char *p;

	p = mmap(NULL, 0x70000, PROT_READ | PROT_WRITE | PROT_EXEC,
	    MAP_ANON | MAP_PRIVATE, -1, 0);
	if (p == MAP_FAILED)
		err(1, "mmap");
	return (0);
}


[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic