Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2007 13:13:49 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        freebsd-emulation@FreeBSD.org
Cc:        Ariff Abdullah <ariff@FreeBSD.org>
Subject:   Re: snd_es137x & -CURRENT, /dev/dsp: Invalid argument -- Could not mmap /dev/dsp - linux emulation problem?
Message-ID:  <200706121313.51377.jkim@FreeBSD.org>
In-Reply-To: <20070612223746.25d44a5c.ariff@FreeBSD.org>
References:  <466AFD29.7040108@barafranca.com> <466BE4FA.1020804@barafranca.com> <20070612223746.25d44a5c.ariff@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 12 June 2007 10:37 am, Ariff Abdullah wrote:
> (as per rdivacky suggestion..)
>
> jkim, are there any reasons why linux_mmap PROT_EXECing everywhere?
> (thus causing this breakage).
>
> http://people.freebsd.org/~ariff/test/grrrrrrr.diff

To mimic (broken) Linux behavior. ;-)  Seriously Linux kernel for i386 
(without NX/XD bit support) implies PROT_EXEC when PROT_READ or 
PROT_WRITE is set even if you don't specify.  In FreeBSD, we have to 
explicitly specify PROT_EXEC.  Therefore the hack was required.  In 
fact, 32-bit mmap implementation for Linux/ia64 does exactly this to 
run i386 binaries.  Many (broken) Linux-only applications had abused 
this bug in the past and I believe they still exist widely.  If you 
want, you can add a tunable to turn off this behavior but please 
leave it on by default.

Jung-uk Kim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706121313.51377.jkim>