From owner-svn-src-head@FreeBSD.ORG Mon May 28 17:16:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 199C61065741; Mon, 28 May 2012 17:16:28 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A4A438FC0A; Mon, 28 May 2012 17:16:27 +0000 (UTC) Received: from dhcp-10-249-130-87.fas.harvard.edu (wrls-249-130-87.wrls-client.fas.harvard.edu [140.247.145.87]) by cyrus.watson.org (Postfix) with ESMTPSA id 3C00346B0C; Mon, 28 May 2012 13:16:27 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <20120528133633.GB2358@deviant.kiev.zoral.com.ua> Date: Mon, 28 May 2012 13:16:27 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <71304742-3635-49C6-BE36-60E4F4A6FC20@freebsd.org> References: <201205252150.q4PLomFk035064@svn.freebsd.org> <20120526173233.A885@besplex.bde.org> <20120526164927.GU2358@deviant.kiev.zoral.com.ua> <20120527043827.W3357@besplex.bde.org> <20120528133633.GB2358@deviant.kiev.zoral.com.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1257) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Ed Schouten , Bruce Evans , svn-src-head@freebsd.org, jonathan@freebsd.org Subject: Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2012 17:16:28 -0000 On 28 May 2012, at 09:36, Konstantin Belousov wrote: > On Sun, May 27, 2012 at 07:49:36AM +1000, Bruce Evans wrote: >> On Sat, 26 May 2012, Konstantin Belousov wrote: >>=20 >>> On Sat, May 26, 2012 at 10:21:25PM +1000, Bruce Evans wrote: >>> The 'low level' AKA magic happens in several *_fetch_syscall_args() >>> functions. For both linux32 and freebsd32, the magic code = automatically >>> zero-extends the arguments into 64bit entities. Linux passes args in >>> registers, while FreeBSD uses words on stack. >>=20 >> Actually, the amd64 linux_fetch32_fetch_syscall_args() just copies = from >> 64-bit registers frame->tf_r* to 64-bit sa->args[*]. I can't see how >> this gives anything except garbage in the top bits. Is there magic = in >> the switch to 64-bit mode that sets the top bits? Anyway, sign = extension >> would give garbage for unsigned args, and zero-extension would give >> garbage for negative signed args. > Hardware zero-extends any register touched in the 32bit mode. >=20 > In fact, please see r217991 for related bug. This may well be true on Intel, but is not true of MIPS -- which we = probably don't care about currently for the purposes of Linux emulation, = but maybe someday we will. On MIPS, 32-bit values are sign-extended = rather than zero-extended. I see a somewhat complex thread here, but am not sure I quite understand = the import for Capsicum. Is the 64-bit rights mask as part of system = call arguments not working properly in compat32 scenarios? Or are there = issues outside of the compat environment? Right now compat32 is not = well-supported with Capsicum, but fixing that is quite important to = productionising Capsicum. Robert=