From owner-freebsd-emulation@FreeBSD.ORG Tue Jun 12 17:53:28 2007 Return-Path: X-Original-To: freebsd-emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0B8E16A41F; Tue, 12 Jun 2007 17:53:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.freebsd.org (Postfix) with ESMTP id 82F2213C447; Tue, 12 Jun 2007 17:53:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.6/8.13.6) with ESMTP id l5CHDrHH095246; Tue, 12 Jun 2007 13:13:53 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-emulation@FreeBSD.org Date: Tue, 12 Jun 2007 13:13:49 -0400 User-Agent: KMail/1.6.2 References: <466AFD29.7040108@barafranca.com> <466BE4FA.1020804@barafranca.com> <20070612223746.25d44a5c.ariff@FreeBSD.org> In-Reply-To: <20070612223746.25d44a5c.ariff@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200706121313.51377.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.90.2/3411/Tue Jun 12 10:55:03 2007 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Ariff Abdullah Subject: Re: snd_es137x & -CURRENT, /dev/dsp: Invalid argument -- Could not mmap /dev/dsp - linux emulation problem? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2007 17:53:28 -0000 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