snd_es137x & -CURRENT, /dev/dsp: Invalid argument -- Could not mmap /dev/dsp - linux emulation problem?

Jung-uk Kim jkim at FreeBSD.org
Tue Jun 12 17:53:28 UTC 2007


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


More information about the freebsd-emulation mailing list