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: pgpIkDQh3vpHS.pgp
Description: PGP signature

Reply via email to